store_bean_entity_helper.dart 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import 'package:bbyyy/beans/store_bean_entity.dart';
  2. storeBeanEntityFromJson(StoreBeanEntity data, Map<String, dynamic> json) {
  3. if (json['data'] != null) {
  4. data.data = StoreBeanData().fromJson(json['data']);
  5. }
  6. if (json['error'] != null) {
  7. data.error = json['error'].toString();
  8. }
  9. return data;
  10. }
  11. Map<String, dynamic> storeBeanEntityToJson(StoreBeanEntity entity) {
  12. final Map<String, dynamic> data = new Map<String, dynamic>();
  13. data['data'] = entity.data?.toJson();
  14. data['error'] = entity.error;
  15. return data;
  16. }
  17. storeBeanDataFromJson(StoreBeanData data, Map<String, dynamic> json) {
  18. if (json['total'] != null) {
  19. data.total = json['total'] is String
  20. ? int.tryParse(json['total'])
  21. : json['total'].toInt();
  22. }
  23. if (json['data'] != null) {
  24. data.data = (json['data'] as List).map((v) => StoreBeanDataData().fromJson(v)).toList();
  25. }
  26. return data;
  27. }
  28. Map<String, dynamic> storeBeanDataToJson(StoreBeanData entity) {
  29. final Map<String, dynamic> data = new Map<String, dynamic>();
  30. data['total'] = entity.total;
  31. data['data'] = entity.data?.map((v) => v.toJson())?.toList();
  32. return data;
  33. }
  34. storeBeanDataDataFromJson(StoreBeanDataData data, Map<String, dynamic> json) {
  35. if (json['create_time'] != null) {
  36. data.createTime = json['create_time'].toString();
  37. }
  38. if (json['inner_trade'] != null) {
  39. data.innerTrade = json['inner_trade'];
  40. }
  41. if (json['shop_commission_threshold'] != null) {
  42. data.shopCommissionThreshold = json['shop_commission_threshold'] is String
  43. ? double.tryParse(json['shop_commission_threshold'])
  44. : json['shop_commission_threshold'].toDouble();
  45. }
  46. if (json['notice'] != null) {
  47. data.notice = json['notice'].toString();
  48. }
  49. if (json['state'] != null) {
  50. data.state = json['state'] is String
  51. ? int.tryParse(json['state'])
  52. : json['state'].toInt();
  53. }
  54. if (json['banned'] != null) {
  55. data.banned = json['banned'];
  56. }
  57. if (json['shop_commission_pricing'] != null) {
  58. data.shopCommissionPricing = json['shop_commission_pricing'] is String
  59. ? double.tryParse(json['shop_commission_pricing'])
  60. : json['shop_commission_pricing'].toDouble();
  61. }
  62. if (json['pay_discount'] != null) {
  63. data.payDiscount = json['pay_discount'] is String
  64. ? double.tryParse(json['pay_discount'])
  65. : json['pay_discount'].toDouble();
  66. }
  67. if (json['shop_commission_receiver_uid'] != null) {
  68. data.shopCommissionReceiverUid = json['shop_commission_receiver_uid'] is String
  69. ? int.tryParse(json['shop_commission_receiver_uid'])
  70. : json['shop_commission_receiver_uid'].toInt();
  71. }
  72. if (json['private'] != null) {
  73. data.private = json['private'];
  74. }
  75. if (json['owner_uid'] != null) {
  76. data.ownerUid = json['owner_uid'] is String
  77. ? int.tryParse(json['owner_uid'])
  78. : json['owner_uid'].toInt();
  79. }
  80. if (json['owner_name'] != null) {
  81. data.ownerName = json['owner_name'].toString();
  82. }
  83. if (json['owner_pic'] != null) {
  84. data.ownerPic = json['owner_pic'].toString();
  85. }
  86. if (json['hide_members'] != null) {
  87. data.hideMembers = json['hide_members'];
  88. }
  89. if (json['hide_offline_pay'] != null) {
  90. data.hideOfflinePay = json['hide_offline_pay'];
  91. }
  92. if (json['fee_type'] != null) {
  93. data.feeType = json['fee_type'] is String
  94. ? int.tryParse(json['fee_type'])
  95. : json['fee_type'].toInt();
  96. }
  97. if (json['mobile'] != null) {
  98. data.mobile = json['mobile'].toString();
  99. }
  100. if (json['id'] != null) {
  101. data.id = json['id'] is String
  102. ? int.tryParse(json['id'])
  103. : json['id'].toInt();
  104. }
  105. if (json['picture'] != null) {
  106. data.picture = json['picture'].toString();
  107. }
  108. if (json['ban_expire_date'] != null) {
  109. data.banExpireDate = json['ban_expire_date'].toString();
  110. }
  111. if (json['address'] != null) {
  112. data.address = json['address'].toString();
  113. }
  114. if (json['introduction'] != null) {
  115. data.introduction = json['introduction'].toString();
  116. }
  117. if (json['uid'] != null) {
  118. data.uid = json['uid'] is String
  119. ? int.tryParse(json['uid'])
  120. : json['uid'].toInt();
  121. }
  122. if (json['name'] != null) {
  123. data.name = json['name'].toString();
  124. }
  125. if (json['ban_start_date'] != null) {
  126. data.banStartDate = json['ban_start_date'].toString();
  127. }
  128. if (json['shop_commission_percent'] != null) {
  129. data.shopCommissionPercent = json['shop_commission_percent'];
  130. }
  131. if (json['owner_pay_platform_fee'] != null) {
  132. data.ownerPayPlatformFee = json['owner_pay_platform_fee'];
  133. }
  134. if (json['longitude'] != null) {
  135. data.longitude = json['longitude'] is String
  136. ? double.tryParse(json['longitude'])
  137. : json['longitude'].toDouble();
  138. }
  139. if (json['latitude'] != null) {
  140. data.latitude = json['latitude'] is String
  141. ? double.tryParse(json['latitude'])
  142. : json['latitude'].toDouble();
  143. }
  144. return data;
  145. }
  146. Map<String, dynamic> storeBeanDataDataToJson(StoreBeanDataData entity) {
  147. final Map<String, dynamic> data = new Map<String, dynamic>();
  148. data['create_time'] = entity.createTime;
  149. data['inner_trade'] = entity.innerTrade;
  150. data['shop_commission_threshold'] = entity.shopCommissionThreshold;
  151. data['notice'] = entity.notice;
  152. data['state'] = entity.state;
  153. data['banned'] = entity.banned;
  154. data['shop_commission_pricing'] = entity.shopCommissionPricing;
  155. data['pay_discount'] = entity.payDiscount;
  156. data['shop_commission_receiver_uid'] = entity.shopCommissionReceiverUid;
  157. data['private'] = entity.private;
  158. data['owner_uid'] = entity.ownerUid;
  159. data['owner_name'] = entity.ownerName;
  160. data['owner_pic'] = entity.ownerPic;
  161. data['hide_members'] = entity.hideMembers;
  162. data['hide_offline_pay'] = entity.hideOfflinePay;
  163. data['fee_type'] = entity.feeType;
  164. data['mobile'] = entity.mobile;
  165. data['id'] = entity.id;
  166. data['picture'] = entity.picture;
  167. data['ban_expire_date'] = entity.banExpireDate;
  168. data['address'] = entity.address;
  169. data['introduction'] = entity.introduction;
  170. data['uid'] = entity.uid;
  171. data['name'] = entity.name;
  172. data['ban_start_date'] = entity.banStartDate;
  173. data['shop_commission_percent'] = entity.shopCommissionPercent;
  174. data['owner_pay_platform_fee'] = entity.ownerPayPlatformFee;
  175. data['longitude'] = entity.longitude;
  176. data['latitude'] = entity.latitude;
  177. return data;
  178. }