ShelfPostData.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #region Apache License Version 2.0
  2. /*----------------------------------------------------------------
  3. Copyright 2019 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
  4. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  5. except in compliance with the License. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software distributed under the
  8. License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  9. either express or implied. See the License for the specific language governing permissions
  10. and limitations under the License.
  11. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
  12. ----------------------------------------------------------------*/
  13. #endregion Apache License Version 2.0
  14. using System.Collections.Generic;
  15. namespace Senparc.Weixin.MP.AdvancedAPIs.MerChant
  16. {
  17. public class MBase
  18. {
  19. public int eid { get; protected set; }//控件ID
  20. }
  21. public class M1 : MBase
  22. {
  23. public M1_GroupInfo group_info { get; set; }//分组信息
  24. /// <summary>
  25. /// 控件1数据初始化
  26. /// </summary>
  27. /// <param name="group_info_filter_count">group_info/filter/count</param>
  28. /// <param name="group_info_group_id">group_info/group_id</param>
  29. public M1(int group_info_filter_count, int group_info_group_id)
  30. {
  31. base.eid = 1;
  32. group_info = new M1_GroupInfo()
  33. {
  34. filter = new Filter()
  35. {
  36. count = group_info_filter_count
  37. },
  38. group_id = group_info_group_id
  39. };
  40. }
  41. }
  42. public class M1_GroupInfo
  43. {
  44. public Filter filter { get; set; }
  45. public int group_id { get; set; }//分组ID
  46. }
  47. public class Filter
  48. {
  49. public int count { get; set; }//该控件展示商品个数
  50. }
  51. public class M2 : MBase
  52. {
  53. public M2_GroupInfos group_infos { get; set; }//分组数组
  54. /// <summary>
  55. /// 控件2数据初始化
  56. /// </summary>
  57. /// <param name="groupIds">groups/[group_id]</param>
  58. public M2(int[] groupIds)
  59. {
  60. group_infos = new M2_GroupInfos()
  61. {
  62. groups = new List<Group>()
  63. };
  64. for (int i = 0; i < groupIds.Length; i++)
  65. {
  66. group_infos.groups.Add(new Group() { group_id = groupIds[i] });
  67. }
  68. base.eid = 2;
  69. }
  70. }
  71. public class M2_GroupInfos
  72. {
  73. public List<Group> groups { get; set; }//分组ID
  74. }
  75. public class Group
  76. {
  77. public int group_id { get; set; }//分组ID
  78. }
  79. public class M3 : MBase
  80. {
  81. public GroupInfo group_info { get; set; }//分组信息
  82. /// <summary>
  83. /// 控件3数据初始化
  84. /// </summary>
  85. /// <param name="group_info_group_id"></param>
  86. /// <param name="group_info_image"></param>
  87. public M3(int group_info_group_id, string group_info_image)
  88. {
  89. base.eid = 3;
  90. group_info = new GroupInfo()
  91. {
  92. group_id = group_info_group_id,
  93. img = group_info_image
  94. };
  95. }
  96. }
  97. public class GroupInfo
  98. {
  99. public int group_id { get; set; }//分组ID
  100. public string img { get; set; }//分组照片(图片需调用图片上传接口获得图片Url填写至此,否则添加货架失败,建议分辨率600*208)
  101. }
  102. public class M4 : MBase
  103. {
  104. public M4_GroupInfos group_infos { get; set; }
  105. /// <summary>
  106. /// 控件4数据初始化
  107. /// </summary>
  108. /// <param name="groupIds">groups/[group_id]</param>
  109. /// <param name="imgs">groups/[img]</param>
  110. /// 注意groupIds和imgs要对应
  111. public M4(int[] groupIds,string[] imgs)
  112. {
  113. group_infos = new M4_GroupInfos()
  114. {
  115. groups = new List<GroupInfo>()
  116. };
  117. for (int i = 0; i < groupIds.Length; i++)
  118. {
  119. group_infos.groups.Add(new GroupInfo() { group_id = groupIds[i], img = imgs[i] });
  120. }
  121. base.eid = 4;
  122. }
  123. }
  124. public class M4_GroupInfos
  125. {
  126. public List<GroupInfo> groups { get; set; }
  127. }
  128. public class M5 : MBase
  129. {
  130. public M5_GroupInfos group_infos { get; set; }
  131. /// <summary>
  132. /// 控件5数据初始化
  133. /// </summary>
  134. /// <param name="groupIds">groups/[group_id]</param>
  135. /// <param name="imgBackground">groups/img_background</param>
  136. public M5(int[] groupIds, string imgBackground)
  137. {
  138. group_infos = new M5_GroupInfos()
  139. {
  140. groups = new List<Group>(),
  141. img_background = imgBackground
  142. };
  143. for (int i = 0; i < groupIds.Length; i++)
  144. {
  145. group_infos.groups.Add(new Group() { group_id = groupIds[i] });
  146. }
  147. base.eid = 4;
  148. }
  149. }
  150. public class M5_GroupInfos
  151. {
  152. public List<Group> groups { get; set; }
  153. public string img_background { get; set; }
  154. }
  155. }