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); } }