WeChatCallbackOrderTrait.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. namespace addons\WechatVideoShop\common\logic\traits;
  3. use addons\WechatVideoShop\common\service\OrderCallbackService;
  4. trait WeChatCallbackOrderTrait
  5. {
  6. /**
  7. * {
  8. * "ToUserName": "gh_*",
  9. * "FromUserName": "OPENID",
  10. * "CreateTime": 1662480000,
  11. * "MsgType": "event",
  12. * "Event": "channels_ec_order_new",
  13. * "order_info": {
  14. * "order_id": 3705115058471208928
  15. * }
  16. * }
  17. * 订单下单
  18. * @return void
  19. * @throws \Exception
  20. */
  21. public function channels_ec_order_new(array $params)
  22. {
  23. $this->init($params);
  24. (new OrderCallbackService($this->shop_id, $this->mall_id, $this->customer_num))->create($this->data);
  25. }
  26. /**
  27. * {
  28. * "ToUserName": "gh_*",
  29. * "FromUserName": "OPENID",
  30. * "CreateTime": 1662480000,
  31. * "MsgType": "event",
  32. * "Event": "channels_ec_order_cancel",
  33. * "order_info": {
  34. * "order_id": 3705115058471208928,
  35. * "cancel_type": 1
  36. * }
  37. * }
  38. * 订单取消
  39. * @return void
  40. * @throws \Exception
  41. */
  42. public function channels_ec_order_cancel(array $params)
  43. {
  44. $this->init($params);
  45. (new OrderCallbackService($this->shop_id, $this->mall_id))->cancel($this->data);
  46. }
  47. /**
  48. * {
  49. * "ToUserName": "gh_*",
  50. * "FromUserName": "OPENID",
  51. * "CreateTime": 1662480000,
  52. * "MsgType": "event",
  53. * "Event": "channels_ec_order_pay",
  54. * "order_info": {
  55. * "order_id": 3705115058471208928,
  56. * "pay_time": 1658509200
  57. * }
  58. * }
  59. * 订单支付
  60. * @return void
  61. * @throws \Exception
  62. */
  63. public function channels_ec_order_pay(array $params)
  64. {
  65. $this->init($params);
  66. (new OrderCallbackService($this->shop_id, $this->mall_id))->paid($this->data);
  67. }
  68. /**
  69. * {
  70. * "ToUserName": "gh_*",
  71. * "FromUserName": "OPENID",
  72. * "CreateTime": 1662480000,
  73. * "MsgType": "event",
  74. * "Event": "channels_ec_order_deliver",
  75. * "order_info": {
  76. * "order_id": 3705115058471208928,
  77. * "finish_delivery": 1
  78. * }
  79. * }
  80. * 订单发货
  81. * @return void
  82. * @throws \Exception
  83. */
  84. public function channels_ec_order_deliver(array $params)
  85. {
  86. $this->init($params);
  87. (new OrderCallbackService($this->shop_id, $this->mall_id))->ship($this->data);
  88. }
  89. /**
  90. * {
  91. * "ToUserName": "gh_*",
  92. * "FromUserName": "OPENID",
  93. * "CreateTime": 1662480000,
  94. * "MsgType": "event",
  95. * "Event": "channels_ec_order_confirm",
  96. * "order_info": {
  97. * "order_id": 3705115058471208928,
  98. * "confirm_type": 1
  99. * }
  100. * }
  101. * 订单收货
  102. * @return void
  103. * @throws \Exception
  104. */
  105. public function channels_ec_order_confirm(array $params)
  106. {
  107. $this->init($params);
  108. (new OrderCallbackService($this->shop_id, $this->mall_id))->sing($this->data);
  109. }
  110. /**
  111. * {
  112. * "ToUserName": "gh_*",
  113. * "FromUserName": "OPENID",
  114. * "CreateTime": 1662480000,
  115. * "MsgType": "event",
  116. * "Event": "channels_ec_order_settle",
  117. * "order_info": {
  118. * "order_id": 3705115058471208928,
  119. * "settle_time": 1662480000
  120. * }
  121. * }
  122. * 订单结算
  123. * @return void
  124. * @throws \Exception
  125. */
  126. public function channels_ec_order_settle(array $params)
  127. {
  128. $this->init($params);
  129. (new OrderCallbackService($this->shop_id, $this->mall_id))->settlement($this->data);
  130. }
  131. /**
  132. * {
  133. * "ToUserName": "gh_*",
  134. * "FromUserName": "OPENID",
  135. * "CreateTime": 1662480000,
  136. * "MsgType": "event",
  137. * "Event": "channels_ec_order_ext_info_update",
  138. * "order_info": {
  139. * "order_id": 3705115058471208928,
  140. * "type": 1
  141. * }
  142. * }
  143. * 订单其他信息更新
  144. * @return void
  145. * @throws \Exception
  146. */
  147. public function channels_ec_order_ext_info_update(array $params)
  148. {
  149. $this->init($params);
  150. (new OrderCallbackService($this->shop_id, $this->mall_id))->update($this->data);
  151. }
  152. /**
  153. * @return void
  154. * @throws \Exception
  155. */
  156. public function product_order_status_update(array $params)
  157. {
  158. $this->init($params);
  159. // $key = 'ProductOrderStatusUpdate';
  160. // switch ($this->data[$key]['status']) {
  161. // case 10: // 待付款
  162. // (new OrderCallbackService($this->shop_id, $this->mall_id))->create($this->data, $key);
  163. // break;
  164. // case 20: // 已支付
  165. // (new OrderCallbackService($this->shop_id, $this->mall_id))->paid($this->data, $key);
  166. // break;
  167. // case 21: // 部分发货
  168. // break;
  169. // case 30: // 待收货
  170. // (new OrderCallbackService($this->shop_id, $this->mall_id))->ship($this->data, $key);
  171. // break;
  172. // case 100: // 订单完成
  173. // (new OrderCallbackService($this->shop_id, $this->mall_id))->sing($this->data, $key);
  174. // break;
  175. // case 200: // 全部商品售后之后,订单取消
  176. // (new OrderCallbackService($this->shop_id, $this->mall_id))->cancel($this->data, $key);
  177. // break;
  178. // case 250: // 未付款用户主动取消或超时未付款订单自动取消
  179. // (new OrderCallbackService($this->shop_id, $this->mall_id))->cancel($this->data, $key);
  180. // break;
  181. // }
  182. }
  183. }