services_respository.dart 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. import 'package:domain/constants/api_constants.dart';
  2. import 'package:domain/entity/garage_sale_rent_detail_entity.dart';
  3. import 'package:domain/entity/garage_sale_rent_entity.dart';
  4. import 'package:domain/entity/myposts_sale_rent_entity.dart';
  5. import 'package:domain/entity/newsfeed_foryou_entity.dart';
  6. import 'package:domain/entity/newsfeed_news_entity.dart';
  7. import 'package:domain/entity/paid_service_detail_entity.dart';
  8. import 'package:domain/entity/paid_service_entity.dart';
  9. import 'package:domain/entity/paid_service_pay_success_info_entity.dart';
  10. import 'package:domain/entity/server_time.dart';
  11. import 'package:domain/entity/service_category_entity.dart';
  12. import 'package:domain/entity/service_time_period_entity.dart';
  13. import 'package:plugin_platform/engine/toast/toast_engine.dart';
  14. import 'package:plugin_platform/platform_export.dart';
  15. import 'package:plugin_platform/http/dio_engine.dart';
  16. import 'package:plugin_platform/http/http_result.dart';
  17. import 'package:riverpod_annotation/riverpod_annotation.dart';
  18. import 'package:shared/utils/log_utils.dart';
  19. import 'package:shared/utils/util.dart';
  20. import 'package:flutter_riverpod/flutter_riverpod.dart';
  21. import 'package:plugin_basic/provider/http_provider/http_provider.dart';
  22. part 'services_respository.g.dart';
  23. @Riverpod(keepAlive: true)
  24. ServicesRespository servicesRespository(Ref ref) {
  25. final dioEngine = ref.watch(dioEngineProvider);
  26. return ServicesRespository(dioEngine: dioEngine);
  27. }
  28. /*
  29. * 数据仓库
  30. */
  31. class ServicesRespository {
  32. DioEngine dioEngine;
  33. ServicesRespository({required this.dioEngine});
  34. //服务 获取 分类 字典
  35. Future<HttpResult<Object>> fetchServiceCateGoryList(
  36. Map<String, dynamic>? data, {
  37. CancelToken? cancelToken,
  38. }) async {
  39. Map<String, dynamic> params = {};
  40. params = data!;
  41. Map<String, String> headers = {};
  42. headers["Content-Type"] = "application/x-www-form-urlencoded";
  43. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  44. final result = await dioEngine.requestNetResult(
  45. // ApiConstants.apiServerTime, // api 地址
  46. '/api/v1/user/service/category/index', // api 地址
  47. params: params,
  48. headers: headers,
  49. method: HttpMethod.GET,
  50. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  51. networkDebounce: false, //是否防抖防止重复请求
  52. cancelToken: cancelToken,
  53. );
  54. //根据返回的结果,封装原始数据为Bean/Entity对象
  55. if (result.isSuccess) {
  56. //重新赋值data或list
  57. final listJson = result.getListJson();
  58. var listData = listJson!.map((e) => ServiceCategoryEntity.fromJson(e!)).toList();
  59. //重新赋值data或list
  60. return result.convert(list: listData);
  61. }else {
  62. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  63. ToastEngine.show("${result.errorMsg}");
  64. }
  65. }
  66. return result.convert();
  67. }
  68. // 付费服务 获取 列表
  69. Future<HttpResult<Object>> fetchPaidServiceDataList(
  70. Map<String, dynamic>? data, {
  71. CancelToken? cancelToken,
  72. }) async {
  73. Map<String, dynamic> params = {};
  74. params = data!;
  75. Map<String, String> headers = {};
  76. headers["Content-Type"] = "application/x-www-form-urlencoded";
  77. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  78. final result = await dioEngine.requestNetResult(
  79. '/api/v1/user/service/paid-service/index', // api 地址
  80. params: params,
  81. headers: headers,
  82. method: HttpMethod.GET,
  83. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  84. networkDebounce: true, //是否防抖防止重复请求
  85. cancelToken: cancelToken,
  86. );
  87. //根据返回的结果,封装原始数据为Bean/Entity对象
  88. if (result.isSuccess) {
  89. //重新赋值data或list
  90. final json = result.getDataJson();
  91. var data = PaidServiceEntity.fromJson(json!);
  92. //重新赋值data或list
  93. return result.convert(data: data);
  94. }else {
  95. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  96. ToastEngine.show("${result.errorMsg}");
  97. }
  98. }
  99. return result.convert();
  100. }
  101. // 付费/维修 服务 列表 点赞/取消点赞
  102. Future<HttpResult<Object>> fetchServiceLiked(
  103. Map<String, dynamic>? data, {
  104. CancelToken? cancelToken,
  105. }) async {
  106. Map<String, dynamic> params = {};
  107. params = data!;
  108. Map<String, String> headers = {};
  109. headers["Content-Type"] = "application/x-www-form-urlencoded";
  110. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  111. final result = await dioEngine.requestNetResult(
  112. // ApiConstants.apiServerTime, // api 地址
  113. '/api/v1/user/service/paid-service/liked', // api 地址
  114. params: params,
  115. headers: headers,
  116. method: HttpMethod.POST,
  117. isShowLoadingDialog: true, //是否展示默认的Loading弹窗
  118. networkDebounce: true, //是否防抖防止重复请求
  119. cancelToken: cancelToken,
  120. );
  121. //根据返回的结果,封装原始数据为Bean/Entity对象
  122. if (result.isSuccess) {
  123. //重新赋值data或list
  124. final json = result.getDataDynamic();
  125. // var data = NewsfeedForyouEntity.fromJson(json!);
  126. //重新赋值data或list
  127. return result.convert(data: json);
  128. }else {
  129. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  130. ToastEngine.show("${result.errorMsg}");
  131. }
  132. }
  133. return result.convert();
  134. }
  135. // 提交评价
  136. Future<HttpResult<Object>> fetchPublishEvaluation(
  137. Map<String, dynamic>? data, {
  138. CancelToken? cancelToken,
  139. }) async {
  140. Map<String, dynamic> params = {};
  141. params = data!;
  142. Map<String, String> headers = {};
  143. headers["Content-Type"] = "application/x-www-form-urlencoded";
  144. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  145. List<String> paths = data!["resources"] as List<String>;
  146. Map<String, String> files = {};
  147. if (paths != null && paths.isNotEmpty) {
  148. paths.asMap().forEach((index, path) {
  149. files["resources[$index]"] = path;
  150. });
  151. }
  152. // 删除 resources 属性
  153. params.remove("resources");
  154. final result = await dioEngine.requestNetResult(
  155. // ApiConstants.apiServerTime, // api 地址
  156. '/api/v1/user/service/evaluation/publish', // api 地址
  157. params: params,
  158. paths: files,
  159. headers: headers,
  160. method: HttpMethod.POST,
  161. isShowLoadingDialog: true, //是否展示默认的Loading弹窗
  162. networkDebounce: true, //是否防抖防止重复请求
  163. cancelToken: cancelToken,
  164. );
  165. //根据返回的结果,封装原始数据为Bean/Entity对象
  166. if (result.isSuccess) {
  167. //重新赋值data或list
  168. final json = result.getDataJson();
  169. // var data = NewsfeedForyouEntity.fromJson(json!);
  170. //重新赋值data或list
  171. return result.convert(data: json);
  172. }else {
  173. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  174. ToastEngine.show("${result.errorMsg}");
  175. }
  176. }
  177. return result.convert();
  178. }
  179. // 评价列表
  180. Future<HttpResult<Object>> fetchEvaluationDataList(
  181. Map<String, dynamic>? data, {
  182. CancelToken? cancelToken,
  183. }) async {
  184. Map<String, dynamic> params = {};
  185. params = data!;
  186. Map<String, String> headers = {};
  187. headers["Content-Type"] = "application/x-www-form-urlencoded";
  188. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  189. final result = await dioEngine.requestNetResult(
  190. // ApiConstants.apiServerTime, // api 地址
  191. '/api/v1/user/service/evaluation/index', // api 地址
  192. params: params,
  193. headers: headers,
  194. method: HttpMethod.GET,
  195. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  196. networkDebounce: true, //是否防抖防止重复请求
  197. cancelToken: cancelToken,
  198. );
  199. //根据返回的结果,封装原始数据为Bean/Entity对象
  200. if (result.isSuccess) {
  201. //重新赋值data或list
  202. final json = result.getDataJson();
  203. var data = GarageSaleRentEntity.fromJson(json!);
  204. //重新赋值data或list
  205. return result.convert(data: data);
  206. }else {
  207. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  208. ToastEngine.show("${result.errorMsg}");
  209. }
  210. }
  211. return result.convert();
  212. }
  213. // 获取 付费服务 详情信息
  214. Future<HttpResult<Object>> fetchPaidServiceCleanDetailInfo(
  215. Map<String, dynamic>? data, {
  216. CancelToken? cancelToken,
  217. }) async {
  218. Map<String, dynamic> params = {};
  219. params = data!;
  220. Map<String, String> headers = {};
  221. // headers["Content-Type"] = "application/x-www-form-urlencoded";
  222. // headers["Accept"] = "application/x.yyjobs-api.v1+json";
  223. final result = await dioEngine.requestNetResult(
  224. '/api/v1/user/service/paid-service/detail', // api 地址
  225. params: params,
  226. headers: headers,
  227. method: HttpMethod.GET,
  228. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  229. networkDebounce: true, //是否防抖防止重复请求
  230. cancelToken: cancelToken,
  231. );
  232. //根据返回的结果,封装原始数据为Bean/Entity对象
  233. if (result.isSuccess) {
  234. //重新赋值data或list
  235. final json = result.getDataJson();
  236. var data = PaidServiceDetailEntity.fromJson(json!);
  237. //重新赋值data或list
  238. return result.convert(data: data);
  239. }else {
  240. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  241. ToastEngine.show("${result.errorMsg}");
  242. }
  243. }
  244. return result.convert();
  245. }
  246. // 获取 付费服务 时间段
  247. Future<HttpResult<Object>> fetchPaidServiceTimePeriod(
  248. Map<String, dynamic>? data, {
  249. CancelToken? cancelToken,
  250. }) async {
  251. Map<String, dynamic> params = {};
  252. params = data!;
  253. Map<String, String> headers = {};
  254. // headers["Content-Type"] = "application/x-www-form-urlencoded";
  255. // headers["Accept"] = "application/x.yyjobs-api.v1+json";
  256. final result = await dioEngine.requestNetResult(
  257. '/api/v1/user/service/paid-service/time-period', // api 地址
  258. params: params,
  259. headers: headers,
  260. method: HttpMethod.GET,
  261. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  262. networkDebounce: false, //是否防抖防止重复请求
  263. cancelToken: cancelToken,
  264. );
  265. //根据返回的结果,封装原始数据为Bean/Entity对象
  266. if (result.isSuccess) {
  267. //重新赋值data或list
  268. final list = result.getListJson();
  269. List<ServiceTimePeriodEntity> listEntity= list!.map((e)=>ServiceTimePeriodEntity.fromJson(e)).toList();
  270. //重新赋值data或list
  271. return result.convert(list: listEntity);
  272. }else {
  273. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  274. ToastEngine.show("${result.errorMsg}");
  275. }
  276. }
  277. return result.convert();
  278. }
  279. // 付费服务 下单
  280. Future<HttpResult<Object>> fetchPaidServiceBook(
  281. Map<String, dynamic>? data, {
  282. CancelToken? cancelToken,
  283. }) async {
  284. Map<String, dynamic> params = {};
  285. params = data!;
  286. Map<String, String> headers = {};
  287. headers["Content-Type"] = "application/x-www-form-urlencoded";
  288. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  289. final result = await dioEngine.requestNetResult(
  290. // ApiConstants.apiServerTime, // api 地址
  291. '/api/v1/user/service/paid-service-order/book', // api 地址
  292. params: params,
  293. headers: headers,
  294. method: HttpMethod.POST,
  295. isShowLoadingDialog: true, //是否展示默认的Loading弹窗
  296. networkDebounce: true, //是否防抖防止重复请求
  297. cancelToken: cancelToken,
  298. );
  299. //根据返回的结果,封装原始数据为Bean/Entity对象
  300. if (result.isSuccess) {
  301. //重新赋值data或list
  302. final json = result.getDataJson();
  303. var data = PaidServicePaySuccessInfoEntity.fromJson(json!);
  304. //重新赋值data或list
  305. return result.convert(data: data);
  306. }else {
  307. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  308. ToastEngine.show("${result.errorMsg}");
  309. }
  310. }
  311. return result.convert();
  312. }
  313. // 付费服务 订单列表
  314. Future<HttpResult<Object>> fetchPaidServiceOrderList(
  315. Map<String, dynamic>? data, {
  316. CancelToken? cancelToken,
  317. }) async {
  318. Map<String, dynamic> params = {};
  319. params = data!;
  320. Map<String, String> headers = {};
  321. headers["Content-Type"] = "application/x-www-form-urlencoded";
  322. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  323. final result = await dioEngine.requestNetResult(
  324. // ApiConstants.apiServerTime, // api 地址
  325. '/api/v1/user/service/paid-service-order/index', // api 地址
  326. params: params,
  327. headers: headers,
  328. method: HttpMethod.GET,
  329. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  330. networkDebounce: true, //是否防抖防止重复请求
  331. cancelToken: cancelToken,
  332. );
  333. //根据返回的结果,封装原始数据为Bean/Entity对象
  334. if (result.isSuccess) {
  335. //重新赋值data或list
  336. final json = result.getDataJson();
  337. var data = GarageSaleRentEntity.fromJson(json!);
  338. //重新赋值data或list
  339. return result.convert(data: data);
  340. }else {
  341. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  342. ToastEngine.show("${result.errorMsg}");
  343. }
  344. }
  345. return result.convert();
  346. }
  347. // 获取 付费服务 订单详情
  348. Future<HttpResult<Object>> fetchPaidServiceCleanOrderDetailInfo(
  349. Map<String, dynamic>? data, {
  350. CancelToken? cancelToken,
  351. }) async {
  352. Map<String, dynamic> params = {};
  353. params = data!;
  354. Map<String, String> headers = {};
  355. // headers["Content-Type"] = "application/x-www-form-urlencoded";
  356. // headers["Accept"] = "application/x.yyjobs-api.v1+json";
  357. final result = await dioEngine.requestNetResult(
  358. // ApiConstants.apiServerTime, // api 地址
  359. '/api/v1/user/service/paid-service-order/detail', // api 地址
  360. params: params,
  361. headers: headers,
  362. method: HttpMethod.GET,
  363. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  364. networkDebounce: true, //是否防抖防止重复请求
  365. cancelToken: cancelToken,
  366. );
  367. //根据返回的结果,封装原始数据为Bean/Entity对象
  368. if (result.isSuccess) {
  369. //重新赋值data或list
  370. final json = result.getDataJson();
  371. // var data = GarageSaleRentDetailEntity.fromJson(json!);
  372. //重新赋值data或list
  373. return result.convert(data: json);
  374. }else {
  375. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  376. ToastEngine.show("${result.errorMsg}");
  377. }
  378. }
  379. return result.convert();
  380. }
  381. // 获取 付费订单实际需要支付的价格
  382. Future<HttpResult<Object>> fetchPaidServiceCleanOrderPrice(
  383. Map<String, dynamic>? data, {
  384. CancelToken? cancelToken,
  385. }) async {
  386. Map<String, dynamic> params = {};
  387. params = data!;
  388. Map<String, String> headers = {};
  389. // headers["Content-Type"] = "application/x-www-form-urlencoded";
  390. // headers["Accept"] = "application/x.yyjobs-api.v1+json";
  391. final result = await dioEngine.requestNetResult(
  392. // ApiConstants.apiServerTime, // api 地址
  393. '/api/v1/user/service/paid-service-order/price', // api 地址
  394. params: params,
  395. headers: headers,
  396. method: HttpMethod.GET,
  397. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  398. networkDebounce: true, //是否防抖防止重复请求
  399. cancelToken: cancelToken,
  400. );
  401. //根据返回的结果,封装原始数据为Bean/Entity对象
  402. if (result.isSuccess) {
  403. //重新赋值data或list
  404. final json = result.getDataJson();
  405. // var data = GarageSaleRentDetailEntity.fromJson(json!);
  406. //重新赋值data或list
  407. return result.convert(data: json);
  408. }else {
  409. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  410. ToastEngine.show("${result.errorMsg}");
  411. }
  412. }
  413. return result.convert();
  414. }
  415. // 付费服务 取消订单
  416. Future<HttpResult<Object>> fetchCancelPaidServiceOrder(
  417. Map<String, dynamic>? data, {
  418. CancelToken? cancelToken,
  419. }) async {
  420. Map<String, dynamic> params = {};
  421. params = data!;
  422. Map<String, String> headers = {};
  423. headers["Content-Type"] = "application/x-www-form-urlencoded";
  424. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  425. final result = await dioEngine.requestNetResult(
  426. // ApiConstants.apiServerTime, // api 地址
  427. '/api/v1/user/service/paid-service-order/cancel', // api 地址
  428. params: params,
  429. headers: headers,
  430. method: HttpMethod.POST,
  431. isShowLoadingDialog: true, //是否展示默认的Loading弹窗
  432. networkDebounce: true, //是否防抖防止重复请求
  433. cancelToken: cancelToken,
  434. );
  435. //根据返回的结果,封装原始数据为Bean/Entity对象
  436. if (result.isSuccess) {
  437. //重新赋值data或list
  438. final json = result.getDataJson();
  439. // var data = NewsfeedForyouEntity.fromJson(json!);
  440. //重新赋值data或list
  441. return result.convert(data: json);
  442. }else {
  443. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  444. ToastEngine.show("${result.errorMsg}");
  445. }
  446. }
  447. return result.convert();
  448. }
  449. ///-------------------咨询类---------------------------------
  450. // 维修服务 列表
  451. Future<HttpResult<Object>> fetchRepairServiceList(
  452. Map<String, dynamic>? data, {
  453. CancelToken? cancelToken,
  454. }) async {
  455. Map<String, dynamic> params = {};
  456. params = data!;
  457. Map<String, String> headers = {};
  458. headers["Content-Type"] = "application/x-www-form-urlencoded";
  459. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  460. final result = await dioEngine.requestNetResult(
  461. // ApiConstants.apiServerTime, // api 地址
  462. '/api/v1/user/service/inquiry-service/index', // api 地址
  463. params: params,
  464. headers: headers,
  465. method: HttpMethod.GET,
  466. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  467. networkDebounce: true, //是否防抖防止重复请求
  468. cancelToken: cancelToken,
  469. );
  470. //根据返回的结果,封装原始数据为Bean/Entity对象
  471. if (result.isSuccess) {
  472. //重新赋值data或list
  473. final json = result.getDataJson();
  474. var data = GarageSaleRentEntity.fromJson(json!);
  475. //重新赋值data或list
  476. return result.convert(data: data);
  477. }else {
  478. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  479. ToastEngine.show("${result.errorMsg}");
  480. }
  481. }
  482. return result.convert();
  483. }
  484. // 获取 repair 详情信息
  485. Future<HttpResult<Object>> fetchServiceRepairDetailInfo(
  486. Map<String, dynamic>? data, {
  487. CancelToken? cancelToken,
  488. }) async {
  489. Map<String, dynamic> params = {};
  490. params = data!;
  491. Map<String, String> headers = {};
  492. // headers["Content-Type"] = "application/x-www-form-urlencoded";
  493. // headers["Accept"] = "application/x.yyjobs-api.v1+json";
  494. final result = await dioEngine.requestNetResult(
  495. // ApiConstants.apiServerTime, // api 地址
  496. '/api/v1/user/service/inquiry-service/detail', // api 地址
  497. params: params,
  498. headers: headers,
  499. method: HttpMethod.GET,
  500. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  501. networkDebounce: true, //是否防抖防止重复请求
  502. cancelToken: cancelToken,
  503. );
  504. //根据返回的结果,封装原始数据为Bean/Entity对象
  505. if (result.isSuccess) {
  506. //重新赋值data或list
  507. final json = result.getDataJson();
  508. var data = GarageSaleRentDetailEntity.fromJson(json!);
  509. //重新赋值data或list
  510. return result.convert(data: data);
  511. }else {
  512. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  513. ToastEngine.show("${result.errorMsg}");
  514. }
  515. }
  516. return result.convert();
  517. }
  518. // 维修服务 提交咨询
  519. Future<HttpResult<Object>> fetchRepairServiceSubmit(
  520. Map<String, dynamic>? data, {
  521. CancelToken? cancelToken,
  522. }) async {
  523. Map<String, dynamic> params = {};
  524. params = data!;
  525. Map<String, String> headers = {};
  526. headers["Content-Type"] = "application/x-www-form-urlencoded";
  527. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  528. final result = await dioEngine.requestNetResult(
  529. // ApiConstants.apiServerTime, // api 地址
  530. '/api/v1/user/service/inquiry-service-order/submit', // api 地址
  531. params: params,
  532. headers: headers,
  533. method: HttpMethod.POST,
  534. isShowLoadingDialog: true, //是否展示默认的Loading弹窗
  535. networkDebounce: true, //是否防抖防止重复请求
  536. cancelToken: cancelToken,
  537. );
  538. //根据返回的结果,封装原始数据为Bean/Entity对象
  539. if (result.isSuccess) {
  540. //重新赋值data或list
  541. final json = result.getDataJson();
  542. // var data = NewsfeedForyouEntity.fromJson(json!);
  543. //重新赋值data或list
  544. return result.convert(data: json);
  545. }else {
  546. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  547. ToastEngine.show("${result.errorMsg}");
  548. }
  549. }
  550. return result.convert();
  551. }
  552. // 维修服务 订单列表
  553. Future<HttpResult<Object>> fetchRepairServiceOrderList(
  554. Map<String, dynamic>? data, {
  555. CancelToken? cancelToken,
  556. }) async {
  557. Map<String, dynamic> params = {};
  558. params = data!;
  559. Map<String, String> headers = {};
  560. headers["Content-Type"] = "application/x-www-form-urlencoded";
  561. headers["Accept"] = "application/x.yyjobs-api.v1+json";
  562. final result = await dioEngine.requestNetResult(
  563. // ApiConstants.apiServerTime, // api 地址
  564. '/api/v1/user/service/inquiry-service-order/index', // api 地址
  565. params: params,
  566. headers: headers,
  567. method: HttpMethod.GET,
  568. isShowLoadingDialog: false, //是否展示默认的Loading弹窗
  569. networkDebounce: true, //是否防抖防止重复请求
  570. cancelToken: cancelToken,
  571. );
  572. //根据返回的结果,封装原始数据为Bean/Entity对象
  573. if (result.isSuccess) {
  574. //重新赋值data或list
  575. final json = result.getDataJson();
  576. var data = GarageSaleRentEntity.fromJson(json!);
  577. //重新赋值data或list
  578. return result.convert(data: data);
  579. }else {
  580. if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
  581. ToastEngine.show("${result.errorMsg}");
  582. }
  583. }
  584. return result.convert();
  585. }
  586. }