store_bean_entity_helper.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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['shop_commission_receiver_uid'] != null) {
  63. data.shopCommissionReceiverUid = json['shop_commission_receiver_uid'] is String
  64. ? int.tryParse(json['shop_commission_receiver_uid'])
  65. : json['shop_commission_receiver_uid'].toInt();
  66. }
  67. if (json['private'] != null) {
  68. data.private = json['private'];
  69. }
  70. if (json['owner_uid'] != null) {
  71. data.ownerUid = json['owner_uid'] is String
  72. ? int.tryParse(json['owner_uid'])
  73. : json['owner_uid'].toInt();
  74. }
  75. if (json['owner_name'] != null) {
  76. data.ownerName = json['owner_name'].toString();
  77. }
  78. if (json['owner_pic'] != null) {
  79. data.ownerPic = json['owner_pic'].toString();
  80. }
  81. if (json['hide_members'] != null) {
  82. data.hideMembers = json['hide_members'];
  83. }
  84. if (json['hide_offline_pay'] != null) {
  85. data.hideOfflinePay = json['hide_offline_pay'];
  86. }
  87. if (json['fee_type'] != null) {
  88. data.feeType = json['fee_type'] is String
  89. ? int.tryParse(json['fee_type'])
  90. : json['fee_type'].toInt();
  91. }
  92. if (json['mobile'] != null) {
  93. data.mobile = json['mobile'].toString();
  94. }
  95. if (json['id'] != null) {
  96. data.id = json['id'] is String
  97. ? int.tryParse(json['id'])
  98. : json['id'].toInt();
  99. }
  100. if (json['picture'] != null) {
  101. data.picture = json['picture'].toString();
  102. }
  103. if (json['ban_expire_date'] != null) {
  104. data.banExpireDate = json['ban_expire_date'].toString();
  105. }
  106. if (json['address'] != null) {
  107. data.address = json['address'].toString();
  108. }
  109. if (json['introduction'] != null) {
  110. data.introduction = json['introduction'].toString();
  111. }
  112. if (json['uid'] != null) {
  113. data.uid = json['uid'] is String
  114. ? int.tryParse(json['uid'])
  115. : json['uid'].toInt();
  116. }
  117. if (json['name'] != null) {
  118. data.name = json['name'].toString();
  119. }
  120. if (json['ban_start_date'] != null) {
  121. data.banStartDate = json['ban_start_date'].toString();
  122. }
  123. if (json['shop_commission_percent'] != null) {
  124. data.shopCommissionPercent = json['shop_commission_percent'];
  125. }
  126. if (json['owner_pay_platform_fee'] != null) {
  127. data.ownerPayPlatformFee = json['owner_pay_platform_fee'];
  128. }
  129. if (json['longitude'] != null) {
  130. data.longitude = json['longitude'] is String
  131. ? double.tryParse(json['longitude'])
  132. : json['longitude'].toDouble();
  133. }
  134. if (json['latitude'] != null) {
  135. data.latitude = json['latitude'] is String
  136. ? double.tryParse(json['latitude'])
  137. : json['latitude'].toDouble();
  138. }
  139. return data;
  140. }
  141. Map<String, dynamic> storeBeanDataDataToJson(StoreBeanDataData entity) {
  142. final Map<String, dynamic> data = new Map<String, dynamic>();
  143. data['create_time'] = entity.createTime;
  144. data['inner_trade'] = entity.innerTrade;
  145. data['shop_commission_threshold'] = entity.shopCommissionThreshold;
  146. data['notice'] = entity.notice;
  147. data['state'] = entity.state;
  148. data['banned'] = entity.banned;
  149. data['shop_commission_pricing'] = entity.shopCommissionPricing;
  150. data['shop_commission_receiver_uid'] = entity.shopCommissionReceiverUid;
  151. data['private'] = entity.private;
  152. data['owner_uid'] = entity.ownerUid;
  153. data['owner_name'] = entity.ownerName;
  154. data['owner_pic'] = entity.ownerPic;
  155. data['hide_members'] = entity.hideMembers;
  156. data['hide_offline_pay'] = entity.hideOfflinePay;
  157. data['fee_type'] = entity.feeType;
  158. data['mobile'] = entity.mobile;
  159. data['id'] = entity.id;
  160. data['picture'] = entity.picture;
  161. data['ban_expire_date'] = entity.banExpireDate;
  162. data['address'] = entity.address;
  163. data['introduction'] = entity.introduction;
  164. data['uid'] = entity.uid;
  165. data['name'] = entity.name;
  166. data['ban_start_date'] = entity.banStartDate;
  167. data['shop_commission_percent'] = entity.shopCommissionPercent;
  168. data['owner_pay_platform_fee'] = entity.ownerPayPlatformFee;
  169. data['longitude'] = entity.longitude;
  170. data['latitude'] = entity.latitude;
  171. return data;
  172. }