store_bean_entity_helper.dart 5.2 KB

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