request->get(); $id = $get['id'] ?? 0; $cg = PurchaseClass::getById($id, true); if (empty($cg)) { util::fail('没有找到订单'); } if ($cg->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, $cg); util::success($respond); } //计算客户距离和运费 ssh 2020.5.14 public function actionGetUserDistance() { //经度 $lng = Yii::$app->request->get('lng', ''); //纬度 $lat = Yii::$app->request->get('lat', ''); if (empty($lng) || empty($lat)) { util::fail('经度或纬度不能为空'); } $shopId = ShopService::getDefaultShopId($this->sj); $respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->sjExtend); util::success($respond); } // 获取字典中的 hasMap public function actionGetHasMap() { $shop = $this->shop; util::success(['hasMap' => dict::getDict('hasMap'), 'shop' => $shop]); } // 配送详情 public function actionDetail() { $get = Yii::$app->request->get(); $orderId = $get['orderId'] ?? 0; $order = OrderClass::getById($orderId, false, 'id, mainId, sendStatus'); if ($order['mainId'] != $this->mainId) { util::fail('不是你的订单'); } $express = ExpressOrderClass::getByCondition(['orderId' => $orderId, 'status' => 1], true); if (empty($express)) { util::fail('没有找到配送信息呢'); } util::success($express); } }