|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
namespace app\common\library\easywechatPlus;
|
|
|
use app\common\Service\Order\ShippingInfo\OrderShippingInfo;
|
|
|
-use app\commom\model\data\WechatExpress;
|
|
|
+use app\common\model\data\WechatExpress;
|
|
|
use app\common\exception\BusinessException;
|
|
|
use app\common\facade\HttpClient;
|
|
|
use think\Cache;
|
|
@@ -262,6 +262,70 @@ class WechatMiniProgramShop extends EasywechatPlus
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取微信delivery数据
|
|
|
+ *
|
|
|
+ * @param boolean $is_force
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function getOrderStatus()
|
|
|
+ {
|
|
|
+
|
|
|
+ $access_token = $this->getAccessToken();
|
|
|
+ $get_delivery_url = "https://api.weixin.qq.com/wxa/sec/order/get_order";
|
|
|
+
|
|
|
+ $result = HttpClient::request('post', $get_delivery_url, [
|
|
|
+ 'body' => '{}',
|
|
|
+ 'query' => ["access_token" => $access_token['access_token']],
|
|
|
+ 'headers' => ['Content-Type' => 'application/json']
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $result = $result->getBody()->getContents();
|
|
|
+ $result = json_decode($result, true);
|
|
|
+
|
|
|
+ if ($result['errcode'] != 0) {
|
|
|
+ throw new BusinessException('获取微信 delivery 列表失败: errcode:' . $result['errcode'] . '; errmsg:' . $result['errmsg']);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询订单发货状态
|
|
|
+ * 根据微信文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%89%E3%80%81%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E5%8F%91%E8%B4%A7%E7%8A%B6%E6%80%81
|
|
|
+ *
|
|
|
+ * @param string $transactionId 微信支付订单号
|
|
|
+ * @return array 查询结果
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ public function getOrderShippingStatus($transactionId = "")
|
|
|
+ {
|
|
|
+ $access_token = $this->getAccessToken();
|
|
|
+ $get_order_url = "https://api.weixin.qq.com/wxa/sec/order/get_order";
|
|
|
+
|
|
|
+ $requestData = [
|
|
|
+ 'transaction_id' => $transactionId
|
|
|
+ ];
|
|
|
+
|
|
|
+ $result = HttpClient::request('post', $get_order_url, [
|
|
|
+ 'body' => json_encode($requestData),
|
|
|
+ 'query' => ["access_token" => $access_token['access_token']],
|
|
|
+ 'headers' => ['Content-Type' => 'application/json']
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $result = $result->getBody()->getContents();
|
|
|
+ $result = json_decode($result, true);
|
|
|
+
|
|
|
+ if ($result['errcode'] != 0) {
|
|
|
+ throw new BusinessException('查询订单发货状态失败: errcode:' . $result['errcode'] . '; errmsg:' . $result['errmsg']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 方法转发到 easywechat
|