shish 1 年間 前
コミット
4af22b6164

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

@@ -14,6 +14,37 @@ use Yii;
 class ExpressController extends BaseController
 {
 
+    //获取采购单物流运单的轨迹 ssh 20250705
+    public function actionGetCgExpressTrack()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $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,
+        ];
+        $respond = ExpressClass::getTrack($params, $order);
+        util::success($respond);
+    }
+
     public function actionTestUpdate()
     {
         $get = Yii::$app->request->get();

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

@@ -17,6 +17,22 @@ class ExpressClass extends BaseClass
 
     public static $baseFile = '\bizGhs\express\models\DeliveryOrder';
 
+    public static function getTrack($params, $order)
+    {
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+
+        $wayBillId = $order->fhWlNo;
+
+        $data = [
+            'delivery_id' => $deliveryId,
+            'waybill_id' => $wayBillId,
+        ];
+        return expressUtil::getPath($merchant, $data, $ptStyle);
+    }
+
     public static function testUpdate($params, $order)
     {
         $merchant = WxOpenClass::getGhsWxInfo();