apidoc.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <?php
  2. /**
  3. * @api {get} common 公共参数说明
  4. * @apiVersion 1.0.0
  5. * @apiName common
  6. * @apiGroup Common
  7. *
  8. * @apiDescription 介绍公共参数
  9. *
  10. * @apiParam {Number} json 是否返回json格式的数据1为返回2为不返回
  11. * @apiParam {Number} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  12. * @apiParam {Number} pg 用于分页传参,比如请求第二页数据,则加上该参数pg=2,没有分页和瀑布流不需要该参数
  13. *
  14. * @apiSuccess {Number} status 状态,1为有效2为无效
  15. * @apiSuccess {String} msg 请求的数据是否成功的提示
  16. * @apiSuccess {String} data 如果status为1,data有值
  17. * @apiSuccess {Object[]} page 分页信息
  18. * @apiSuccess {Number} page.total 分页总数
  19. * @apiSuccess {Number} page.current_page 当前页
  20. * @apiSuccess {Number} page.total_page 总页数
  21. * @apiSuccess {Number} page.next_page 下一页
  22. * @apiSuccess {Number} page.prev_page 上一页
  23. * @apiSuccess {Number} page.status 是否有下一页数据,0为没有
  24. */
  25. /**
  26. * @api {get} passport/?l=applet.bind 用户登录
  27. * @apiVersion 1.0.0
  28. * @apiName applet.bind
  29. * @apiGroup Passport
  30. *
  31. * @apiDescription 用户登录
  32. *
  33. * @apiParam {String} code 微信登录返回的code
  34. *
  35. * @apiSuccess {Number} vid 微信id,请保存在本地
  36. * @apiSuccess {Number} uid 用户id,请保存在本地
  37. * @apiSuccess {String} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  38. */
  39. /**
  40. * @api {get} passport/?l=applet.update 更新用户信息
  41. * @apiVersion 1.0.0
  42. * @apiName applet.update
  43. * @apiGroup Passport
  44. *
  45. * @apiDescription 更新用户信息
  46. *
  47. * @apiParam {String} nickname 用户昵称
  48. * @apiParam {String} avatarurl 用户头像
  49. * @apiParam {String} iv 微信的加密参数
  50. * @apiParam {String} encryptedData 微信的加密参数
  51. * @apiParam {Number} vid 微信id
  52. * @apiParam {Number} uid 用户id
  53. * @apiParam {String} signature signature
  54. *
  55. *
  56. * @apiSuccess {Number} vid 微信id,请保存在本地
  57. * @apiSuccess {Number} uid 用户id,请保存在本地
  58. * @apiSuccess {String} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  59. */
  60. /**
  61. * @api {get} passport/?l=applet.mobile 更新用户手机号-微信绑定
  62. * @apiVersion 1.0.0
  63. * @apiName applet.mobile
  64. * @apiGroup Passport
  65. *
  66. * @apiDescription 更新用户手机号-微信绑定
  67. *
  68. * @apiParam {String} iv 微信的加密参数
  69. * @apiParam {String} encryptedData 微信的加密参数
  70. * @apiParam {Number} vid 微信id
  71. * @apiParam {Number} uid 用户id
  72. * @apiParam {String} signature signature
  73. *
  74. *
  75. * @apiSuccess {Number} vid 微信id,请保存在本地
  76. * @apiSuccess {Number} uid 用户id,请保存在本地
  77. * @apiSuccess {String} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  78. */
  79. /**
  80. * @api {get} passport/?l=applet.bind_mobile 绑定手机号-验证码绑定
  81. * @apiVersion 1.0.0
  82. * @apiName applet.bind_mobile
  83. * @apiGroup Passport
  84. *
  85. * @apiDescription 绑定手机号-验证码绑定
  86. *
  87. * @apiParam {Number} uid 用户id
  88. * @apiParam {Number} mobile 手机号
  89. * @apiParam {String} mcode 验证码
  90. * @apiParam {String} signature signature
  91. *
  92. * @apiSuccess {Number} uid 用户id,请保存在本地
  93. * @apiSuccess {String} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  94. */
  95. /**
  96. * @api {get} passport/?l=reg.getMCode 获取手机验证码
  97. * @apiVersion 1.0.0
  98. * @apiName reg.getMCode
  99. * @apiGroup Passport
  100. *
  101. * @apiDescription 获取手机验证码
  102. *
  103. * @apiParam {Number} mobile 手机号
  104. * @apiParam {String} signature signature
  105. *
  106. * @apiSuccess {String} msg 验证码已发送至您的手机,请注意查收,十分钟之内有效
  107. */
  108. /**
  109. * @api {get} product/?l=api.home 获取首页数据
  110. * @apiVersion 1.0.0
  111. * @apiName api.home
  112. * @apiGroup Product
  113. *
  114. * @apiDescription 获取首页数据
  115. *
  116. * @apiParam {String} signature signature
  117. *
  118. *
  119. * @apiSuccess {Number} uid 用户id 所有Service接口中都有该项
  120. * @apiSuccess {Object[]} config 基本配置 所有Service接口中都有该项
  121. * @apiSuccess {String} config.name 小程序名称
  122. * @apiSuccess {String} config.logo 小程序logo
  123. * @apiSuccess {Object[]} focus 焦点图 暂时无用
  124. * @apiSuccess {String} focus.name 名称
  125. * @apiSuccess {String} focus.pic 图片
  126. * @apiSuccess {Object[]} product 产品列表
  127. * @apiSuccess {String} product.id 产品id
  128. * @apiSuccess {String} product.name 名称
  129. * @apiSuccess {String} product.pic 产品封面
  130. * @apiSuccess {String} product.focus 产品轮播图 多个用逗号隔开
  131. * @apiSuccess {String} product.content 内容
  132. * @apiSuccess {String} product.price 显示价格
  133. * @apiSuccess {Number} product.pay_price 支付价格
  134. * @apiSuccess {Number} product.content 产品介绍
  135. */
  136. /**
  137. * @api {get} product/?l=api.view 获取产品详情
  138. * @apiVersion 1.0.0
  139. * @apiName api.view
  140. * @apiGroup Product
  141. *
  142. * @apiDescription 获取产品详情
  143. *
  144. * @apiParam {String} signature signature
  145. * @apiParam {String} id 产品id
  146. * @apiSuccess {Object[]} focus 焦点图
  147. * @apiSuccess {String} focus.name 名称
  148. * @apiSuccess {String} focus.pic 图片
  149. * @apiSuccess {Object[]} product 产品信息
  150. * @apiSuccess {String} product.id 产品id
  151. * @apiSuccess {String} product.name 名称
  152. * @apiSuccess {String} product.pic 产品封面
  153. * @apiSuccess {String} product.focus 产品轮播图 多个用逗号隔开
  154. * @apiSuccess {String} product.content 内容
  155. * @apiSuccess {String} product.price 显示价格
  156. * @apiSuccess {Number} product.pay_price 支付价格
  157. * @apiSuccess {Number} product.content 产品介绍
  158. */
  159. /**
  160. * @api {get} product/?l=api.order 我的订单
  161. * @apiVersion 1.0.0
  162. * @apiName api.order
  163. * @apiGroup Product
  164. *
  165. * @apiDescription 我的订单
  166. *
  167. * @apiParam {String} signature signature
  168. *
  169. * @apiSuccess {Object[]} order 订单信息
  170. * @apiSuccess {String} order.name 名称
  171. * @apiSuccess {String} order.order_id 订单编号
  172. * @apiSuccess {String} order.del_status 产品在线状态1为在线2为已下线
  173. */
  174. /**
  175. * @api {get} product/?l=api.code 提交兑换码
  176. * @apiVersion 1.0.0
  177. * @apiName api.code
  178. * @apiGroup Product
  179. *
  180. * @apiDescription 提交兑换码
  181. *
  182. * @apiParam {String} signature signature
  183. * @apiParam {String} product_id 产品id
  184. * @apiParam {String} code 兑换码
  185. */
  186. /**
  187. * @api {get} product/?l=api.buy 发起微信支付
  188. * @apiVersion 1.0.0
  189. * @apiName api.buy
  190. * @apiGroup Product
  191. *
  192. * @apiDescription 发起微信支付
  193. *
  194. * @apiParam {String} signature signature
  195. * @apiParam {String} product_id 产品id
  196. *
  197. * @apiSuccess {Object[]} pay 微信支付返回的数据
  198. * @apiSuccess {String} pay.time 服务器时间戳
  199. * @apiSuccess {String} pay.nonce_str 随机字符串
  200. * @apiSuccess {String} pay.prepay_id 统一下单接口返回的 prepay_id 参数值,通过'prepay_id=' + prepay_id 拼装成package
  201. * @apiSuccess {String} pay.sign_type 签名算法
  202. * @apiSuccess {String} pay.sign 签名
  203. */
  204. /**
  205. * @api {get} product/?l=api.writeFormId 记录formid,用于发送通知 请再按钮的地方加上该接口请求
  206. * @apiVersion 1.0.0
  207. * @apiName api.writeFormId
  208. * @apiGroup Product
  209. *
  210. * @apiDescription 记录formid,用于发送通知
  211. *
  212. * @apiParam {String} signature signature
  213. * @apiParam {String} product_id 产品id
  214. */
  215. /**
  216. * @api {get} product/?l=api.poster 生成海报
  217. * @apiVersion 1.0.0
  218. * @apiName api.poster
  219. * @apiGroup Product
  220. *
  221. * @apiDescription 生成海报
  222. *
  223. * @apiParam {String} signature signature
  224. * @apiParam {String} product_id 产品id
  225. * @apiParam {String} path 生成的二维码跳转的path,请不要带上参数,该path会自动加上scene=uid,product_id,请直接在onLoad 的方法中解析该参数:const scene = decodeURIComponent(options.scene);scene = scene.split(',');var uid = scene[0];var product_id = scene[1];如果有该参数,请直接跳转到产品详情页。
  226. *
  227. * @apiSuccess {String} pic 直接返回海报图片
  228. */
  229. /**
  230. * @api {get} product/?l=api.addCarts 添加产品到购物车
  231. * @apiVersion 1.0.0
  232. * @apiName api.addCarts
  233. * @apiGroup Product
  234. *
  235. * @apiDescription 添加产品到购物车
  236. *
  237. * @apiParam {String} signature signature
  238. * @apiParam {String} product_id 产品id
  239. * @apiParam {String} num 数量
  240. *
  241. * @apiSuccess {String} data 返回ok
  242. */
  243. /**
  244. * @api {get} product/?l=api.carts 获取购物车列表
  245. * @apiVersion 1.0.0
  246. * @apiName api.buy
  247. * @apiGroup Product
  248. *
  249. * @apiDescription 获取购物车列表
  250. *
  251. * @apiParam {String} signature signature
  252. *
  253. * @apiSuccess {Object[]} carts 购物车信息
  254. * @apiSuccess {String} carts.product 产品信息
  255. * @apiSuccess {String} carts.num 数量
  256. * @apiSuccess {Object[]} address 收货地址
  257. * @apiSuccess {String} address.name 收货人姓名
  258. * @apiSuccess {String} address.address 收货人地址
  259. * @apiSuccess {String} address.mobile 收货人联系电话
  260. */
  261. /**
  262. * @api {get} product/?l=api.addAddress 添加收货地址
  263. * @apiVersion 1.0.0
  264. * @apiName api.addAddress
  265. * @apiGroup Product
  266. *
  267. * @apiDescription 添加收货地址
  268. *
  269. * @apiParam {String} signature signature
  270. * @apiParam {String} name 收货人姓名
  271. * @apiParam {String} address 收货人地址
  272. * @apiParam {String} mobile 收货人联系电话
  273. *
  274. * @apiSuccess {String} data 返回ok
  275. */