diff --git a/app/Controller/Admin/System.php b/app/Controller/Admin/System.php index bb9a38c..3ac19a3 100644 --- a/app/Controller/Admin/System.php +++ b/app/Controller/Admin/System.php @@ -644,6 +644,7 @@ class System extends Base #[Auth(needAuth: false)] public function assetCategoryList() { + $param = Param::only(["type" => "image"]); $param['belong_id'] = $this->account()['belong_id']; $param['account_type'] = $this->account()['account_type']; return $this->success("资源分类列表", acModel::list($param)); @@ -655,7 +656,7 @@ class System extends Base { $request = $this->container->get(acRequest::class); $request->scene('add')->validateResolved(); - $data = Param::only(["category_name", "pid" => 0, "rank"]); + $data = Param::only(["category_name", "pid" => 0, "rank", "type" => "image"]); $data['belong_id'] = $this->account()['belong_id']; $data['account_type'] = $this->account()['account_type']; return $this->toAjax(acModel::add($data)); @@ -667,7 +668,7 @@ class System extends Base { $request = $this->container->get(acRequest::class); $request->scene('edit')->validateResolved(); - $data = Param::only(["category_id", "category_name", "pid" => 0, "rank"]); + $data = Param::only(["category_id", "category_name", "pid" => 0, "rank", "type" => "image"]); return $this->toAjax(acModel::edit($data)); } diff --git a/app/Model/AssetCategory.php b/app/Model/AssetCategory.php index c544df3..6699e5c 100644 --- a/app/Model/AssetCategory.php +++ b/app/Model/AssetCategory.php @@ -10,6 +10,7 @@ namespace App\Model; * @property int $account_type * @property int $belong_id * @property int $pid + * @property string $type * @property int $rank * @property string $create_time * @property string $update_time @@ -43,6 +44,9 @@ class AssetCategory extends Model if (isset($param['belong_id']) && $param['belong_id'] != '') { $model = $model->where('belong_id', $param['belong_id']); } + if (isset($param['type']) && $param['type'] != '') { + $model = $model->where('type', $param['type']); + } return $model ->select(["category_id", "category_name", "pid"]) ->get();