Просмотр исходного кода

Merge branch 'zhongqi-ghsCallExpress' into dev

shish 11 месяцев назад
Родитель
Сommit
3dd671bc06

+ 0 - 1
app-ghs/controllers/IntraCityController.php

@@ -25,7 +25,6 @@ use Yii;
 
 /**
  * 同城配送控制器
- *
  * 提供同城配送相关的API接口
  */
 class IntraCityController extends BaseController

+ 17 - 2
app-hd/controllers/GhsController.php

@@ -246,7 +246,7 @@ class GhsController extends BaseController
         $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShop, $customId);
         //昆明批发,需要算打包费和运费
         $needAddPackFreight = 1;
-        if ($needAdd == false) {
+        if (!$needAdd) {
             $lackExpend = 0;
             //昆明批发,不需要算打包费和运费
             $needAddPackFreight = 0;
@@ -290,9 +290,24 @@ class GhsController extends BaseController
 
         // 弃用 buyNotice, 使用 xhShopExt 表里的 purchaseGuide
         // $info['buyNotice'] = $ghsShop->buyNotice ?? 0;
-        $shopExt = ShopExtClass::getByCondition(['shopId'=>$ghsShopId], false, false, 'purchaseGuide');
+        $shopExt = ShopExtClass::getByCondition(['shopId' => $ghsShopId], false, false, 'purchaseGuide');
         $info['buyNotice'] = $shopExt['purchaseGuide'] > 0 ? 1 : 0; //兼容原有设定:购买须知 0.没有 1.有
 
+        //判断是否开启同城配送功能
+        $hasMap = dict::getDict('hasMap');
+        if (getenv('YII_ENV') == 'production') {
+            $openIntraCityMainList = [50];
+        } else {
+            $openIntraCityMainList = [644];
+        }
+        //没有开启同城配送
+        $openIntraCity = 0;
+        if ($hasMap == 1 && in_array($info['mainId'], $openIntraCityMainList)) {
+            //有地址功能,并且叫跑腿功能开启
+            $openIntraCity = 1;
+        }
+        $info['openIntraCity'] = $openIntraCity;
+
         util::success($info);
     }
 

+ 2 - 2
app-hd/controllers/PurchaseController.php

@@ -1274,8 +1274,8 @@ class PurchaseController extends BaseController
         $get = Yii::$app->request->get();
 
         $shop = $this->shop;
-        $shopLat = isset($shop->lat) ? $shop->lat : '';
-        $shopLong = isset($shop->long) ? $shop->long : '';
+        $shopLat = $shop->lat ?? '';
+        $shopLong = $shop->long ?? '';
 
         if (empty($shopLat) || empty($shopLong)) {
             util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);

+ 11 - 10
biz-hd/purchase/classes/PurchaseClass.php

@@ -376,19 +376,23 @@ class PurchaseClass extends BaseClass
     }
 
     //计算距离和运费【另外还有个地方要同步修改,关键词calc_freight_distance】 ssh 20221003
-    public static function getDistanceFee($shop, $ghsShop, $weight)
+    public static function getDistanceFee($shop, $ghsShop, $weight, $mustHasFee = false)
     {
-        return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
 
-        $shopLat = isset($shop->lat) ? $shop->lat : '';
-        $shopLong = isset($shop->long) ? $shop->long : '';
+        //万丽花行 跑腿不算运费
+        if ($ghsShop->id == 12003) {
+            return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
+        }
+
+        $shopLat = $shop->lat ?? '';
+        $shopLong = $shop->long ?? '';
 
         if (empty($shopLat) || empty($shopLong)) {
             util::fail('请完善门店地址哦');
         }
 
-        $ghsShopLat = isset($ghsShop->lat) ? $ghsShop->lat : '';
-        $ghsShopLong = isset($ghsShop->long) ? $ghsShop->long : '';
+        $ghsShopLat = $ghsShop->lat ?? '';
+        $ghsShopLong = $ghsShop->long ?? '';
         if (empty($ghsShopLat) || empty($ghsShopLong)) {
             util::fail('商家地址有问题');
         }
@@ -452,10 +456,7 @@ class PurchaseClass extends BaseClass
 
         //noticeUtil::push("距离:{$distance} {$showDistance} 重量:{$weight} 费用:{$totalFee}", '15280215347');
 
-        //万丽花行 跑腿不算运费
-        if ($ghsShop->id == 12003) {
-            return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
-        }
+
         return ['distance' => $distance, 'showDistance' => $showDistance, 'fee' => $totalFee];
     }