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

+ 0 - 3
app-ghs/controllers/TestController.php

@@ -411,9 +411,6 @@ class TestController extends BaseController
 
     public function actionGet()
     {
-        ini_set('memory_limit', '2045M');
-        set_time_limit(0);
-
         GhsDeviceClass::updateByCondition(['adminId' => 4, 'status' => 1], ['status' => 0]);
         HdDeviceClass::updateByCondition(['adminId' => 4, 'status' => 1], ['status' => 0]);
 

+ 42 - 0
app-hd/controllers/ShMethodController.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace hd\controllers;
+
+use bizGhs\order\classes\ShMethodClass;
+use bizHd\ghs\classes\GhsClass;
+use Yii;
+use common\components\util;
+
+class ShMethodController extends BaseController
+{
+
+    /**
+     * 获取供货商所有的5种配送方式配置
+     * 如果数据库里没有,则取默认配置进行初始化
+     */
+    public function actionGetAllConfig()
+    {
+        $ghsId = Yii::$app->request->get('ghsId', 0);
+        $ghs = GhsClass::getById($ghsId);
+        if (empty($ghs)) {
+            util::fail('没有供货商信息');
+        }
+        if ($ghs['ownMainId'] != $this->mainId) {
+            util::fail('不是你的供货商');
+        }
+        $shopId = $ghs['shopId'] ?? 0;
+        $mainId = $ghs['mainId'] ?? 0;
+
+        if (!in_array($shopId, [36523, 0])) {
+            util::success([]);
+        }
+
+        try {
+            $configs = ShMethodClass::getAllConfigs($shopId, $mainId);
+            util::success(['method' => $configs]);
+        } catch (\Exception $e) {
+            util::fail($e->getMessage());
+        }
+    }
+
+}

+ 1 - 1
biz-ghs/order/classes/ShMethodClass.php

@@ -104,7 +104,7 @@ class ShMethodClass extends BaseClass
     public static function getAllConfigs($shopId, $mainId)
     {
         // 1. 一次性从数据库中查询当前商户的所有配送方式配置
-        $configsMap = self::getAllByCondition(['mainId' => $mainId], null, '*', 'style', true);
+        $configsMap = self::getAllByCondition(['mainId' => $mainId], 'sort asc', '*', 'style', true);
 
         // 2. 补齐缺失的配送方式,并做初始化入库
         for ($style = 0; $style <= 4; $style++) {