This commit is contained in:
zhang zhuo 2025-11-24 13:46:45 +08:00
parent 7082310c4a
commit e3a637f9b7
2 changed files with 7 additions and 2 deletions

View File

@ -644,6 +644,7 @@ class System extends Base
#[Auth(needAuth: false)] #[Auth(needAuth: false)]
public function assetCategoryList() public function assetCategoryList()
{ {
$param = Param::only(["type" => "image"]);
$param['belong_id'] = $this->account()['belong_id']; $param['belong_id'] = $this->account()['belong_id'];
$param['account_type'] = $this->account()['account_type']; $param['account_type'] = $this->account()['account_type'];
return $this->success("资源分类列表", acModel::list($param)); return $this->success("资源分类列表", acModel::list($param));
@ -655,7 +656,7 @@ class System extends Base
{ {
$request = $this->container->get(acRequest::class); $request = $this->container->get(acRequest::class);
$request->scene('add')->validateResolved(); $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['belong_id'] = $this->account()['belong_id'];
$data['account_type'] = $this->account()['account_type']; $data['account_type'] = $this->account()['account_type'];
return $this->toAjax(acModel::add($data)); return $this->toAjax(acModel::add($data));
@ -667,7 +668,7 @@ class System extends Base
{ {
$request = $this->container->get(acRequest::class); $request = $this->container->get(acRequest::class);
$request->scene('edit')->validateResolved(); $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)); return $this->toAjax(acModel::edit($data));
} }

View File

@ -10,6 +10,7 @@ namespace App\Model;
* @property int $account_type * @property int $account_type
* @property int $belong_id * @property int $belong_id
* @property int $pid * @property int $pid
* @property string $type
* @property int $rank * @property int $rank
* @property string $create_time * @property string $create_time
* @property string $update_time * @property string $update_time
@ -43,6 +44,9 @@ class AssetCategory extends Model
if (isset($param['belong_id']) && $param['belong_id'] != '') { if (isset($param['belong_id']) && $param['belong_id'] != '') {
$model = $model->where('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 return $model
->select(["category_id", "category_name", "pid"]) ->select(["category_id", "category_name", "pid"])
->get(); ->get();