Ver Fonte

Merge branch 'master' into dev

shish há 1 dia atrás
pai
commit
c7e7e13484

+ 1 - 1
app-ghs/controllers/ConsoleController.php

@@ -173,7 +173,7 @@ class ConsoleController extends BaseController
         //$notice[] = ['title' => '如果你发现一个问题很重要,一直没给你处理,在小群多反应几次,用反应次数强调重要性,目前批发店多反应问题多,都在排队。', 'action' => '', 'page' => ''];
         //$notice[] = ['title' => '新功能:客户端和后台使用跑腿的流程', 'action' => '', 'page' => '/admin/book/detail?id=use_pt'];
         //$notice[] = ['title' => '明年1月1号起,所有人介绍新批发店的分红政策,将会统一调整,请知悉', 'action' => '', 'page' => ''];
-        //$notice[] = ['title' => '急事请连续打二次电话 15280215347', 'action' => '', 'page' => ''];
+        //$notice[] = ['title' => '急事请连续打二次电话 15280215347', 'action' => '', 'page' => ''];
 
         $mainId = $this->mainId;
         $respond = StatSaleClass::profile($mainId);

+ 7 - 7
app-hd/controllers/GhsController.php

@@ -55,7 +55,7 @@ class GhsController extends BaseController
         $perKmPrice = $shCurrentConfig['perKmPrice'] ?? 0;//超出起步,每公里加收金额
         $changeRate = $shCurrentConfig['changeRate'] ?? 0;//负值时为降价百分比,正值时为涨价百分比
         if ($startKm <= 0 || $startPrice <= 0 || $perKmPrice <= 0) {
-            util::success(['sendCost' => 0, 'distanceKm' => 0,'distance'=>0]);
+            util::success(['sendCost' => 0, 'distanceKm' => 0, 'distance' => 0]);
         }
         //计算客户到店的距离,骑电动车
         $distanceRespond = mapUtil::calcShopDistanceByEleBike($custom, $ghs, 0);
@@ -64,7 +64,7 @@ class GhsController extends BaseController
         $distance = floatval($distance);
         $sendDistance = floatval($sendDistance);
         if ($sendDistance <= 0) {
-            util::success(['sendCost' => 0, 'distanceKm' => 0,'distance'=>0]);
+            util::success(['sendCost' => 0, 'distanceKm' => 0, 'distance' => 0]);
         }
         // 计算运费逻辑
         $sendCost = $startPrice;
@@ -79,7 +79,7 @@ class GhsController extends BaseController
             $sendCost = bcmul($sendCost, $rate, 2);
         }
         $sendCost = floatval($sendCost);
-        util::success(['sendCost' => $sendCost, 'distanceKm' => $sendDistance,'distance'=>$distance]);
+        util::success(['sendCost' => $sendCost, 'distanceKm' => $sendDistance, 'distance' => $distance]);
     }
 
     //提示花店有多个供货商
@@ -379,8 +379,8 @@ class GhsController extends BaseController
         /*****此区域部分可以考虑删除******/
 
         //是否使用新的配送方式,关键词 sh_method_area
-        $newShMethod = dict::getNewMethodShop();
-        $ghsInfo['useNewShMethod'] = in_array($ghsShopId, $newShMethod) ? 1 : 0;
+        $newStatus = dict::getNewMethod($ghsShopId);
+        $ghsInfo['useNewShMethod'] = $newStatus ? 1 : 0;
 
         util::success($ghsInfo);
     }
@@ -443,8 +443,8 @@ class GhsController extends BaseController
             $ghs['pfLevel'] = $ghsShop->pfLevel ?? 0;
 
             //是否使用新的配送方式,关键词 sh_method_area
-            $newShMethod = dict::getNewMethodShop();
-            $ghs['useNewShMethod'] = in_array($ghsShopId, $newShMethod) ? 1 : 0;
+            $newStatus = dict::getNewMethod($ghsShopId);
+            $ghs['useNewShMethod'] = $newStatus ? 1 : 0;
 
         } else {
             //没有开店也给显示供货商信息

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

@@ -621,8 +621,8 @@ class PurchaseController extends BaseController
             } else {
 
                 // xhShMethod 门店:下单前按配置写入不满最低消费时的附加包装费/运费,关键词 sh_method_area
-                $newShMethod = dict::getNewMethodShop();
-                if (in_array($ghsShopId, $newShMethod)) {
+                $newStatus = dict::getNewMethod($ghsShopId);
+                if ($newStatus) {
 
                     $shCurrentConfig = shMethodClass::getConfig($ghsShopId, $ghsMainId, $sendType);
                     $shCurrentName = $shCurrentConfig['name'] ?? '';
@@ -804,8 +804,8 @@ class PurchaseController extends BaseController
 
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
 
-            $newShMethod = dict::getNewMethodShop();
-            if (in_array($ghsShopId, $newShMethod)) {
+            $newStatus = dict::getNewMethod($ghsShopId);
+            if ($newStatus) {
                 // 使用 xhShMethod 配置校验配送限制,替代旧版门店硬编码规则,关键词 sh_method_area
                 $shMethodError = ShMethodClass::checkLimit(
                     $ghsShopId,

+ 9 - 2
common/components/dict.php

@@ -704,14 +704,21 @@ class dict
         return $respond;
     }
 
-    public static function getNewMethodShop()
+    public static function getNewMethod($shopId)
     {
         $newShop = !getenv('NEW_METHOD_SHOP') ? '' : getenv('NEW_METHOD_SHOP');
         if (empty($newShop)) {
             return [];
         }
         $newShop = trim($newShop);
-        return explode(',', $newShop);
+        $arr = explode(',', $newShop);
+        if (empty($arr)) {
+            return false;
+        }
+        if (in_array($shopId, $arr)) {
+            return true;
+        }
+        return false;
     }
 
 }