zhangdehua 1 anno fa
parent
commit
f2c1591715

+ 1 - 1
app/api/controller/Test.php

@@ -61,7 +61,7 @@ class Test extends Controller
 
 
     public function tj(){
-        $list = WxOrderLogistics::getDeliveryList();
+        $list = WxOrderLogistics::isTradeManaged();
         return $this->renderSuccess(compact('list'));
         dd('a');
         //

+ 1 - 0
app/console/service/WxDelivery.php

@@ -64,6 +64,7 @@ class WxDelivery extends BaseService
         // 遍历整理数据
         foreach ($orderGoodses as $orderGoods) {
             $res = WxOrderLogistics::getOrderStatusByTransId($orders[$orderGoods['order_id']]['transaction_id']);
+            dd($res);
             if ($res['code'] == 10060020){
                 $a = WxOrderLogistics::orderDeliveryByTransId($orders[$orderGoods['order_id']]['transaction_id'],
                     $expressIndexById[$orderGoods['express_id']]['wx_delivery_id'],$orderGoods['express_no'],$orderGoods['goods_name'],$userToOpenId[$orderGoods['user_id']],'',$orderAddressIndexByOrderId[$orderGoods['order_id']]);

+ 2 - 0
app/store/model/OrderGoods.php

@@ -320,6 +320,8 @@ class OrderGoods extends OrderGoodsModel
     //获取需要微信发货的订单商品,wx_delivery_status=10未微信发货,20已微信发货
     public function getNeedToWxDelivery()
     {
+        //todo
+        return $this->where(['order_goods_id'=>92])->select()->toArray();
         return $this->where(['delivery_status' => DeliveryStatusEnum::DELIVERED, 'receipt_status' => ReceiptStatusEnum::NOT_RECEIVED,'wx_delivery_status' => 10])->limit(50)->select()->toArray();
     }
 

+ 10 - 1
app/store/service/wxApi/WxOrderLogistics.php

@@ -144,7 +144,7 @@ class WxOrderLogistics extends BaseService
         $accessToken = $weixinToken['access_token'];
         $url = "https://api.weixin.qq.com/wxa/sec/order/get_order?access_token=".$accessToken;
 
-        $params['access_token'] = $accessToken;
+        //$params['access_token'] = $accessToken;
 
         $params['transaction_id'] = $transId;
 
@@ -185,4 +185,13 @@ class WxOrderLogistics extends BaseService
         $ret = curl_post($url, '{}');
         return json_decode($ret);
     }
+
+    public static function isTradeManaged(){
+        $weixinToken = MpWxService::weixinTokenCache();
+        $accessToken = $weixinToken['access_token'];
+        $url = 'https://api.weixin.qq.com/wxa/sec/order/is_trade_managed?access_token='.$accessToken;
+        $params = ['appid'=>'wx1f365a1958760912'];
+        $ret = curl_post($url, json_encode($params));
+        return json_decode($ret);
+    }
 }