Delivery.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://think.ctolog.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/WeChatDeveloper
  12. // +----------------------------------------------------------------------
  13. namespace WeMini;
  14. use WeChat\Contracts\BasicWeChat;
  15. /**
  16. * 小程序即时配送
  17. * Class Delivery
  18. * @package WeMini
  19. */
  20. class Delivery extends BasicWeChat
  21. {
  22. /**
  23. * 异常件退回商家商家确认收货接口
  24. * @param array $data
  25. * @return array
  26. * @throws \WeChat\Exceptions\InvalidResponseException
  27. * @throws \WeChat\Exceptions\LocalCacheException
  28. */
  29. public function abnormalConfirm($data)
  30. {
  31. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/confirm_return?access_token=ACCESS_TOKEN';
  32. $this->registerApi($url, __FUNCTION__, func_get_args());
  33. return $this->callPostApi($url, $data, true);
  34. }
  35. /**
  36. * 下配送单接口
  37. * @param array $data
  38. * @return array
  39. * @throws \WeChat\Exceptions\InvalidResponseException
  40. * @throws \WeChat\Exceptions\LocalCacheException
  41. */
  42. public function addOrder($data)
  43. {
  44. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/add?access_token=ACCESS_TOKEN';
  45. $this->registerApi($url, __FUNCTION__, func_get_args());
  46. return $this->callPostApi($url, $data, true);
  47. }
  48. /**
  49. * 可以对待接单状态的订单增加小费
  50. * @param array $data
  51. * @return array
  52. * @throws \WeChat\Exceptions\InvalidResponseException
  53. * @throws \WeChat\Exceptions\LocalCacheException
  54. */
  55. public function addTip($data)
  56. {
  57. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/addtips?access_token=ACCESS_TOKEN';
  58. $this->registerApi($url, __FUNCTION__, func_get_args());
  59. return $this->callPostApi($url, $data, true);
  60. }
  61. /**
  62. * 取消配送单接口
  63. * @param array $data
  64. * @return array
  65. * @throws \WeChat\Exceptions\InvalidResponseException
  66. * @throws \WeChat\Exceptions\LocalCacheException
  67. */
  68. public function cancelOrder($data)
  69. {
  70. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/cancel?access_token=ACCESS_TOKEN';
  71. $this->registerApi($url, __FUNCTION__, func_get_args());
  72. return $this->callPostApi($url, $data, true);
  73. }
  74. /**
  75. * 获取已支持的配送公司列表接口
  76. * @param array $data
  77. * @return array
  78. * @throws \WeChat\Exceptions\InvalidResponseException
  79. * @throws \WeChat\Exceptions\LocalCacheException
  80. */
  81. public function getAllImmeDelivery($data)
  82. {
  83. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/delivery/getall?access_token=ACCESS_TOKEN';
  84. $this->registerApi($url, __FUNCTION__, func_get_args());
  85. return $this->callPostApi($url, $data, true);
  86. }
  87. /**
  88. * 拉取已绑定账号
  89. * @param array $data
  90. * @return array
  91. * @throws \WeChat\Exceptions\InvalidResponseException
  92. * @throws \WeChat\Exceptions\LocalCacheException
  93. */
  94. public function getBindAccount($data)
  95. {
  96. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/shop/get?access_token=ACCESS_TOKEN';
  97. $this->registerApi($url, __FUNCTION__, func_get_args());
  98. return $this->callPostApi($url, $data, true);
  99. }
  100. /**
  101. * 拉取配送单信息
  102. * @param array $data
  103. * @return array
  104. * @throws \WeChat\Exceptions\InvalidResponseException
  105. * @throws \WeChat\Exceptions\LocalCacheException
  106. */
  107. public function getOrder($data)
  108. {
  109. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/get?access_token=ACCESS_TOKEN';
  110. $this->registerApi($url, __FUNCTION__, func_get_args());
  111. return $this->callPostApi($url, $data, true);
  112. }
  113. /**
  114. * 模拟配送公司更新配送单状态
  115. * @param array $data
  116. * @return array
  117. * @throws \WeChat\Exceptions\InvalidResponseException
  118. * @throws \WeChat\Exceptions\LocalCacheException
  119. */
  120. public function mockUpdateOrder($data)
  121. {
  122. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/test_update_order?access_token=ACCESS_TOKEN';
  123. $this->registerApi($url, __FUNCTION__, func_get_args());
  124. return $this->callPostApi($url, $data, true);
  125. }
  126. /**
  127. * 预下配送单接口
  128. * @param array $data
  129. * @return array
  130. * @throws \WeChat\Exceptions\InvalidResponseException
  131. * @throws \WeChat\Exceptions\LocalCacheException
  132. */
  133. public function preAddOrder($data)
  134. {
  135. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=ACCESS_TOKEN';
  136. $this->registerApi($url, __FUNCTION__, func_get_args());
  137. return $this->callPostApi($url, $data, true);
  138. }
  139. /**
  140. * 预取消配送单接口
  141. * @param array $data
  142. * @return array
  143. * @throws \WeChat\Exceptions\InvalidResponseException
  144. * @throws \WeChat\Exceptions\LocalCacheException
  145. */
  146. public function preCancelOrder($data)
  147. {
  148. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/precancel?access_token=ACCESS_TOKEN';
  149. $this->registerApi($url, __FUNCTION__, func_get_args());
  150. return $this->callPostApi($url, $data, true);
  151. }
  152. /**
  153. * 重新下单
  154. * @param array $data
  155. * @return array
  156. * @throws \WeChat\Exceptions\InvalidResponseException
  157. * @throws \WeChat\Exceptions\LocalCacheException
  158. */
  159. public function reOrder($data)
  160. {
  161. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/readd?access_token=ACCESS_TOKEN';
  162. $this->registerApi($url, __FUNCTION__, func_get_args());
  163. return $this->callPostApi($url, $data, true);
  164. }
  165. }