浏览代码

修复:商品分类页报错

萤火科技 3 年之前
父节点
当前提交
2b27801d6a
共有 2 个文件被更改,包括 4 次插入 和 6 次删除
  1. 2 3
      app/api/controller/Category.php
  2. 2 3
      app/api/model/Category.php

+ 2 - 3
app/api/controller/Category.php

@@ -8,7 +8,7 @@
 // +----------------------------------------------------------------------
 // | Author: 萤火科技 <admin@yiovo.com>
 // +----------------------------------------------------------------------
-declare (strict_types = 1);
+declare (strict_types=1);
 
 namespace app\api\controller;
 
@@ -31,8 +31,7 @@ class Category extends Controller
     public function list()
     {
         $model = new CategoryModel;
-        $list = $model->getList($this->request->param());
+        $list = $model->getListPublic($this->request->param());
         return $this->renderSuccess(compact('list'));
     }
-
 }

+ 2 - 3
app/api/model/Category.php

@@ -8,7 +8,7 @@
 // +----------------------------------------------------------------------
 // | Author: 萤火科技 <admin@yiovo.com>
 // +----------------------------------------------------------------------
-declare (strict_types = 1);
+declare (strict_types=1);
 
 namespace app\api\model;
 
@@ -39,9 +39,8 @@ class Category extends CategoryModel
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function getList(array $param = [])
+    public function getListPublic(array $param = []): array
     {
         return parent::getList(array_merge($param, ['status' => 1]));
     }
-
 }