소스 검색

完善门店地址

shish 3 년 전
부모
커밋
db86359b27
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      app-hd/controllers/PurchaseController.php

+ 16 - 0
app-hd/controllers/PurchaseController.php

@@ -371,6 +371,15 @@ class PurchaseController extends BaseController
     public function actionFreight()
     {
         $get = Yii::$app->request->get();
+
+        $shop = $this->shop;
+        $shopLat = isset($shop->lat) ? $shop->lat : '';
+        $shopLong = isset($shop->long) ? $shop->long : '';
+
+        if (empty($shopLat) || empty($shopLong)) {
+            util::fail('请完善门店地址');
+        }
+
         $ghsId = $get['ghsId'] ?? 0;
         $ghs = GhsClass::getById($ghsId, true);
         if (empty($ghs)) {
@@ -381,6 +390,13 @@ class PurchaseController extends BaseController
         if (empty($ghsShop)) {
             util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
         }
+
+        $ghsShopLat = isset($ghsShop->lat) ? $ghsShop->lat : '';
+        $ghsShopLong = isset($ghsShop->long) ? $ghsShop->long : '';
+        if (empty($ghsShopLat) || empty($ghsShopLong)) {
+            util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
+        }
+
         $weight = $get['weight'] ?? 0;
         if (empty($weight)) {
             util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);