shish 1 年之前
父節點
當前提交
d317ef9271
共有 2 個文件被更改,包括 84 次插入0 次删除
  1. 58 0
      app-ghs/controllers/ExpressController.php
  2. 26 0
      biz-ghs/express/classes/ExpressClass.php

+ 58 - 0
app-ghs/controllers/ExpressController.php

@@ -14,6 +14,64 @@ use Yii;
 class ExpressController extends BaseController
 {
 
+    public function actionTestUpdate()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $action = $get['action'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $fhWlNo = $order->fhWlNo ?? '';
+        if (empty($fhWlNo)) {
+            util::fail('没有找到物流单');
+        }
+
+        $orderSn = $order->orderSn;
+        $wayBillId = $order->fhWlNo;
+        $actionTime = time();
+        $actionTypeMap = [
+            0 => 100001,
+            1 => 100002,
+            2 => 100003,
+            3 => 200001,
+            4 => 300002,
+            5 => 300003,
+            6 => 300004,
+            7 => 400001,
+            8 => 400002,
+        ];
+        $actionType = $actionTypeMap[$action] ?? 100001;
+        $actionMsg = '编号' . rand(1111, 9999);
+
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+        }
+        $params = [
+            'deliveryId' => $deliveryId,
+            'bizId' => $bizId,
+            'orderSn' => $orderSn,
+            'wayBillId' => $wayBillId,
+            'actionType' => $actionType,
+            'actionMsg' => $actionMsg,
+            'actionTime' => $actionTime,
+        ];
+        ExpressClass::testUpdate($params, $order);
+    }
+
     public function actionCancelWayBill()
     {
         $get = Yii::$app->request->get();

+ 26 - 0
biz-ghs/express/classes/ExpressClass.php

@@ -17,6 +17,32 @@ class ExpressClass extends BaseClass
 
     public static $baseFile = '\bizGhs\express\models\DeliveryOrder';
 
+    public static function testUpdate($params, $order)
+    {
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+        $wayBillId = $params['wayBillId'];
+        $orderSn = $params['orderSn'];
+        $bizId = $params['bizId'];
+        $actionType = $params['actionType'];
+        $actionTime = $params['actionTime'];
+        $actionMsg = $params['actionMsg'];
+
+        $data = [
+            'deliveryId' => $deliveryId,
+            'waybill_id' => $wayBillId,
+            'order_id' => $orderSn,
+            'biz_id' => $bizId,
+            'action_time' => $actionTime,
+            'action_type' => $actionType,
+            'action_msg' => $actionMsg,
+        ];
+        $ret = expressUtil::testUpdateOrder($merchant, $data, $ptStyle);
+        print_r($ret);
+    }
+
     public static function cancel($params, $order)
     {
         $cgId = $order->purchaseId;