Delivery.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  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. return $this->callPostApi($url, $data, true);
  33. }
  34. /**
  35. * 下配送单接口
  36. * @param array $data
  37. * @return array
  38. * @throws \WeChat\Exceptions\InvalidResponseException
  39. * @throws \WeChat\Exceptions\LocalCacheException
  40. */
  41. public function addOrder($data)
  42. {
  43. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/add?access_token=ACCESS_TOKEN';
  44. return $this->callPostApi($url, $data, true);
  45. }
  46. /**
  47. * 可以对待接单状态的订单增加小费
  48. * @param array $data
  49. * @return array
  50. * @throws \WeChat\Exceptions\InvalidResponseException
  51. * @throws \WeChat\Exceptions\LocalCacheException
  52. */
  53. public function addTip($data)
  54. {
  55. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/addtips?access_token=ACCESS_TOKEN';
  56. return $this->callPostApi($url, $data, true);
  57. }
  58. /**
  59. * 取消配送单接口
  60. * @param array $data
  61. * @return array
  62. * @throws \WeChat\Exceptions\InvalidResponseException
  63. * @throws \WeChat\Exceptions\LocalCacheException
  64. */
  65. public function cancelOrder($data)
  66. {
  67. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/cancel?access_token=ACCESS_TOKEN';
  68. return $this->callPostApi($url, $data, true);
  69. }
  70. /**
  71. * 获取已支持的配送公司列表接口
  72. * @param array $data
  73. * @return array
  74. * @throws \WeChat\Exceptions\InvalidResponseException
  75. * @throws \WeChat\Exceptions\LocalCacheException
  76. */
  77. public function getAllImmeDelivery($data)
  78. {
  79. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/delivery/getall?access_token=ACCESS_TOKEN';
  80. return $this->callPostApi($url, $data, true);
  81. }
  82. /**
  83. * 拉取已绑定账号
  84. * @param array $data
  85. * @return array
  86. * @throws \WeChat\Exceptions\InvalidResponseException
  87. * @throws \WeChat\Exceptions\LocalCacheException
  88. */
  89. public function getBindAccount($data)
  90. {
  91. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/shop/get?access_token=ACCESS_TOKEN';
  92. return $this->callPostApi($url, $data, true);
  93. }
  94. /**
  95. * 拉取配送单信息
  96. * @param array $data
  97. * @return array
  98. * @throws \WeChat\Exceptions\InvalidResponseException
  99. * @throws \WeChat\Exceptions\LocalCacheException
  100. */
  101. public function getOrder($data)
  102. {
  103. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/get?access_token=ACCESS_TOKEN';
  104. return $this->callPostApi($url, $data, true);
  105. }
  106. /**
  107. * 模拟配送公司更新配送单状态
  108. * @param array $data
  109. * @return array
  110. * @throws \WeChat\Exceptions\InvalidResponseException
  111. * @throws \WeChat\Exceptions\LocalCacheException
  112. */
  113. public function mockUpdateOrder($data)
  114. {
  115. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/test_update_order?access_token=ACCESS_TOKEN';
  116. return $this->callPostApi($url, $data, true);
  117. }
  118. /**
  119. * 预下配送单接口
  120. * @param array $data
  121. * @return array
  122. * @throws \WeChat\Exceptions\InvalidResponseException
  123. * @throws \WeChat\Exceptions\LocalCacheException
  124. */
  125. public function preAddOrder($data)
  126. {
  127. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=ACCESS_TOKEN';
  128. return $this->callPostApi($url, $data, true);
  129. }
  130. /**
  131. * 预取消配送单接口
  132. * @param array $data
  133. * @return array
  134. * @throws \WeChat\Exceptions\InvalidResponseException
  135. * @throws \WeChat\Exceptions\LocalCacheException
  136. */
  137. public function preCancelOrder($data)
  138. {
  139. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/precancel?access_token=ACCESS_TOKEN';
  140. return $this->callPostApi($url, $data, true);
  141. }
  142. /**
  143. * 重新下单
  144. * @param array $data
  145. * @return array
  146. * @throws \WeChat\Exceptions\InvalidResponseException
  147. * @throws \WeChat\Exceptions\LocalCacheException
  148. */
  149. public function reOrder($data)
  150. {
  151. $url = 'https://api.weixin.qq.com/cgi-bin/express/local/business/order/readd?access_token=ACCESS_TOKEN';
  152. return $this->callPostApi($url, $data, true);
  153. }
  154. }