Delivery.php 5.6 KB

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