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

修复:getAll方法获取不到storeId

Yahoo 4 лет назад
Родитель
Сommit
9683681b54
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      app/common/model/h5/Setting.php
  2. 1 1
      app/common/model/store/Setting.php

+ 1 - 1
app/common/model/h5/Setting.php

@@ -86,8 +86,8 @@ class Setting extends BaseModel
      */
     public static function getAll(int $storeId = null): array
     {
-        is_null($storeId) && $storeId = static::$storeId;
         $model = new static;
+        is_null($storeId) && $storeId = static::$storeId;
         if (!$data = Cache::get("h5_setting_{$storeId}")) {
             // 获取全部设置
             $setting = $model->getList($storeId);

+ 1 - 1
app/common/model/store/Setting.php

@@ -92,8 +92,8 @@ class Setting extends BaseModel
      */
     public static function getAll(int $storeId = null): array
     {
-        is_null($storeId) && $storeId = static::$storeId;
         $model = new static;
+        is_null($storeId) && $storeId = static::$storeId;
         if (!$data = Cache::get("setting_{$storeId}")) {
             // 获取商城设置列表
             $setting = $model->getList($storeId);