diff --git a/app/Controller/Admin/System.php b/app/Controller/Admin/System.php index 8fe57f6..3fa23f1 100644 --- a/app/Controller/Admin/System.php +++ b/app/Controller/Admin/System.php @@ -72,7 +72,7 @@ class System extends Base #[Auth(needAuth: false, auth: "menu:add")] public function menuAdd() { - $data = Param::only(['pid' => 0, 'title' => '', 'account_type' => 1, 'type' => 0, 'method', 'flag', 'name', + $data = Param::only(['parent_id' => 0, 'title' => '', 'account_type' => 1, 'type' => 0, 'method', 'flag', 'name', 'path', 'icon', 'rank', 'hidden', 'remark' ], $this->request->post()); $request = $this->container->get(mRequest::class); @@ -85,7 +85,7 @@ class System extends Base #[Auth(needAuth: false, auth: "menu:edit")] public function menuEdit() { - $data = Param::only(['pid' => 0, 'title' => '', 'account_type' => 1, 'type' => 0, 'method', 'flag', 'name', + $data = Param::only(['parent_id' => 0, 'title' => '', 'account_type' => 1, 'type' => 0, 'method', 'flag', 'name', 'path', 'icon', 'rank', 'hidden', 'remark', 'menu_id' => 0 ], $this->request->post()); $request = $this->container->get(mRequest::class); @@ -106,7 +106,7 @@ class System extends Base #[Auth(needAuth: false, auth: "menu:quick")] public function menuQuickAdd() { - $data = Param::only(['pid' => 0, 'title' => '', 'flag', 'name', 'path', 'icon', 'account_type' => 1], $this->request->post()); + $data = Param::only(['parent_id' => 0, 'title' => '', 'flag', 'name', 'path', 'icon', 'account_type' => 1], $this->request->post()); $request = $this->container->get(mRequest::class); $request->scene('quick')->validateResolved(); $res = mModel::quickAdd($data); @@ -134,7 +134,7 @@ class System extends Base { $request = $this->container->get(dRequest::class); $request->scene('add')->validateResolved(); - $data = Param::only(['dept_name' => '', 'pid' => 0, 'rank', 'status' => 1]); + $data = Param::only(['dept_name' => '', 'parent_id' => 0, 'rank', 'status' => 1]); $data['belong_id'] = $this->account()['belong_id']; $data['account_type'] = $this->account()['account_type']; $res = dModel::add($data); @@ -147,7 +147,7 @@ class System extends Base { $request = $this->container->get(dRequest::class); $request->scene('edit')->validateResolved(); - $data = Param::only(['dept_id' => '', 'dept_name' => '', 'pid' => 0, 'rank', 'status' => 1]); + $data = Param::only(['dept_id' => '', 'dept_name' => '', 'parent_id' => 0, 'rank', 'status' => 1]); $res = dModel::edit($data); return $res ? $this->success("操作成功") : $this->error("操作失败"); } @@ -482,7 +482,7 @@ class System extends Base { $request = $this->container->get(acRequest::class); $request->scene('add')->validateResolved(); - $data = Param::only(["category_name", "pid" => 0, "rank", "type" => "image"]); + $data = Param::only(["category_name", "parent_id" => 0, "rank", "type" => "image"]); $data['belong_id'] = $this->account()['belong_id']; $data['account_type'] = $this->account()['account_type']; return $this->toAjax(acModel::add($data)); @@ -494,7 +494,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", "type" => "image"]); + $data = Param::only(["category_id", "category_name", "parent_id" => 0, "rank", "type" => "image"]); return $this->toAjax(acModel::edit($data)); } diff --git a/app/Model/Account.php b/app/Model/Account.php index 85a0f47..37fbd11 100644 --- a/app/Model/Account.php +++ b/app/Model/Account.php @@ -78,7 +78,7 @@ class Account extends Model public static function getMenu(array $account) { // 总后台账号 - $field = ['m.title', 'm.path', 'm.pid', 'm.name', 'm.menu_id', 'm.icon', 'm.hidden', 'm.type']; + $field = ['m.title', 'm.path', 'm.parent_id', 'm.name', 'm.menu_id', 'm.icon', 'm.hidden', 'm.type']; // 获取角色 $roles = match ($account['account_type']) { 0 => ["ADMIN"], diff --git a/app/Model/AssetCategory.php b/app/Model/AssetCategory.php index 6699e5c..cdac98f 100644 --- a/app/Model/AssetCategory.php +++ b/app/Model/AssetCategory.php @@ -9,7 +9,7 @@ namespace App\Model; * @property string $category_name * @property int $account_type * @property int $belong_id - * @property int $pid + * @property int $parent_id * @property string $type * @property int $rank * @property string $create_time @@ -33,7 +33,7 @@ class AssetCategory extends Model /** * The attributes that should be cast to native types. */ - protected array $casts = ['category_id' => 'integer', 'account_type' => 'integer', 'belong_id' => 'integer', 'pid' => 'integer', 'rank' => 'integer']; + protected array $casts = ['category_id' => 'integer', 'account_type' => 'integer', 'belong_id' => 'integer', 'parent_id' => 'integer', 'rank' => 'integer']; public static function list(array $param) { @@ -48,7 +48,7 @@ class AssetCategory extends Model $model = $model->where('type', $param['type']); } return $model - ->select(["category_id", "category_name", "pid"]) + ->select(["category_id", "category_name", "parent_id"]) ->get(); } } diff --git a/app/Model/Dept.php b/app/Model/Dept.php index 6617308..f9416ee 100644 --- a/app/Model/Dept.php +++ b/app/Model/Dept.php @@ -6,7 +6,7 @@ namespace App\Model; /** * @property int $dept_id - * @property int $pid + * @property int $parent_id * @property int $belong_id * @property int $account_type * @property string $dept_name @@ -39,7 +39,7 @@ class Dept extends Model * * @var array */ - protected array $casts = ['dept_id' => 'integer', 'pid' => 'integer', 'belong_id' => 'integer', 'account_type' => 'integer', 'status' => 'integer', 'rank' => 'integer', 'del_flag' => 'integer']; + protected array $casts = ['dept_id' => 'integer', 'parent_id' => 'integer', 'belong_id' => 'integer', 'account_type' => 'integer', 'status' => 'integer', 'rank' => 'integer', 'del_flag' => 'integer']; public static function list(int $belong_id, int $account_type, string $dept_name) { @@ -49,7 +49,7 @@ class Dept extends Model $model = $model->where('dept_name', "like", "%$dept_name%"); } return $model->orderByDesc("rank") - ->select(["dept_id", "pid", "dept_name", "rank", "status", "create_time"]) + ->select(["dept_id", "parent_id", "dept_name", "rank", "status", "create_time"]) ->get()->toArray(); } @@ -59,17 +59,17 @@ class Dept extends Model ->where('account_type', $account_type) ->where("status", 1) ->orderByDesc("rank") - ->select(["dept_id", "pid", "dept_name"]) + ->select(["dept_id", "parent_id", "dept_name"]) ->get()->toArray(); } public static function getTop(int $dept_id, array &$depts) { - $info = self::select(["dept_name", "pid", "dept_id"])->find($dept_id); + $info = self::select(["dept_name", "parent_id", "dept_id"])->find($dept_id); if (!empty($info)) { $depts[] = $info; - if ($info['pid'] != 0) { - self::getTop($info['pid'], $depts); + if ($info['parent_id'] != 0) { + self::getTop($info['parent_id'], $depts); } } } diff --git a/app/Model/Menu.php b/app/Model/Menu.php index dbae785..c64862f 100644 --- a/app/Model/Menu.php +++ b/app/Model/Menu.php @@ -9,7 +9,7 @@ use Hyperf\DbConnection\Db; /** * @property int $menu_id - * @property int $pid + * @property int $parent_id * @property string $title * @property int $account_type * @property int $type @@ -42,7 +42,7 @@ class Menu extends Model /** * The attributes that should be cast to native types. */ - protected array $casts = ['menu_id' => 'integer', 'pid' => 'integer', 'account_type' => 'integer', 'type' => 'integer', 'rank' => 'integer', 'hidden' => 'integer']; + protected array $casts = ['menu_id' => 'integer', 'parent_id' => 'integer', 'account_type' => 'integer', 'type' => 'integer', 'rank' => 'integer', 'hidden' => 'integer']; /** * 根据账号类型获取权限(主账号) @@ -202,7 +202,7 @@ class Menu extends Model { return self::where('account_type', $account_type) ->orderByDesc("rank") - ->select(["menu_id", "title", "flag", "pid", "type", "method", "name", "path", "icon", "rank", "hidden", "account_type"]) + ->select(["menu_id", "title", "flag", "parent_id", "type", "method", "name", "path", "icon", "rank", "hidden", "account_type"]) ->groupBy(["menu_id"]) ->get() ->toArray(); @@ -212,32 +212,32 @@ class Menu extends Model { Db::beginTransaction(); // 1.菜单 - $data1 = ['pid' => $data['pid'], 'title' => $data['title'] . "管理", 'account_type' => $data['account_type'], 'type' => 0, 'name' => $data['name'], 'path' => $data['path'], 'icon' => $data['icon']]; - $pid = self::add($data1); + $data1 = ['parent_id' => $data['parent_id'], 'title' => $data['title'] . "管理", 'account_type' => $data['account_type'], 'type' => 0, 'name' => $data['name'], 'path' => $data['path'], 'icon' => $data['icon']]; + $parent_id = self::add($data1); // 2.添加按钮 - $data2 = ['pid' => $pid, 'title' => $data['title'] . '添加', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":add"]; - $pid2 = self::add($data2); + $data2 = ['parent_id' => $parent_id, 'title' => $data['title'] . '添加', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":add"]; + $parent_id2 = self::add($data2); // 3.添加接口 - $data3 = ['pid' => $pid2, 'title' => $data['title'] . '添加', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":add", 'method' => 'post']; - $pid3 = self::add($data3); + $data3 = ['parent_id' => $parent_id2, 'title' => $data['title'] . '添加', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":add", 'method' => 'post']; + $parent_id3 = self::add($data3); // 4.修改按钮 - $data2 = ['pid' => $pid, 'title' => $data['title'] . '修改', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":edit"]; - $pid2 = self::add($data2); + $data2 = ['parent_id' => $parent_id, 'title' => $data['title'] . '修改', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":edit"]; + $parent_id2 = self::add($data2); // 5.修改接口 - $data3 = ['pid' => $pid2, 'title' => $data['title'] . '修改', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":edit", 'method' => 'put']; - $pid3 = self::add($data3); + $data3 = ['parent_id' => $parent_id2, 'title' => $data['title'] . '修改', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":edit", 'method' => 'put']; + $parent_id3 = self::add($data3); // 6.删除按钮 - $data2 = ['pid' => $pid, 'title' => $data['title'] . '删除', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":del"]; - $pid2 = self::add($data2); + $data2 = ['parent_id' => $parent_id, 'title' => $data['title'] . '删除', 'account_type' => $data1['account_type'], 'type' => 1, 'flag' => $data['flag'] . ":del"]; + $parent_id2 = self::add($data2); // 7.删除接口 - $data3 = ['pid' => $pid2, 'title' => $data['title'] . '删除', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":del", 'method' => 'delete']; - $pid3 = self::add($data3); + $data3 = ['parent_id' => $parent_id2, 'title' => $data['title'] . '删除', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":del", 'method' => 'delete']; + $parent_id3 = self::add($data3); // 8.列表接口 - $data3 = ['pid' => $pid, 'title' => $data['title'] . '列表', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":list", 'method' => 'get']; - $pid3 = self::add($data3); + $data3 = ['parent_id' => $parent_id, 'title' => $data['title'] . '列表', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":list", 'method' => 'get']; + $parent_id3 = self::add($data3); // 9.选择接口 - $data3 = ['pid' => $pid, 'title' => $data['title'] . '选项', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":option", 'method' => 'get']; - $pid3 = self::add($data3); + $data3 = ['parent_id' => $parent_id, 'title' => $data['title'] . '选项', 'account_type' => $data1['account_type'], 'type' => 2, 'flag' => $data['flag'] . ":option", 'method' => 'get']; + $parent_id3 = self::add($data3); Db::commit(); return true; } diff --git a/app/Request/AssetCategory.php b/app/Request/AssetCategory.php index 811e15e..ed6b089 100644 --- a/app/Request/AssetCategory.php +++ b/app/Request/AssetCategory.php @@ -7,8 +7,8 @@ use Hyperf\Validation\Request\FormRequest; class AssetCategory extends FormRequest { protected array $scenes = [ - 'add' => ["category_name", "pid", "rank"], - 'edit' => ["category_name", "pid", "rank", "category_id"], + 'add' => ["category_name", "parent_id", "rank"], + 'edit' => ["category_name", "parent_id", "rank", "category_id"], ]; /** @@ -29,7 +29,7 @@ class AssetCategory extends FormRequest 'category_name' => 'required', 'account_type' => 'required', 'belong_id' => 'required', - 'pid' => 'required', + 'parent_id' => 'required', 'rank' => 'required', 'create_time' => 'required', 'update_time' => 'required', @@ -41,7 +41,7 @@ class AssetCategory extends FormRequest { return [ 'category_name.required' => '分类名称必传!', - 'pid.required' => '上级分类必传!', + 'parent_id.required' => '上级分类必传!', 'rank.required' => '排序必传!', ]; } diff --git a/app/Request/Dept.php b/app/Request/Dept.php index b38134f..d230fd3 100644 --- a/app/Request/Dept.php +++ b/app/Request/Dept.php @@ -10,8 +10,8 @@ use Hyperf\Validation\Request\FormRequest; class Dept extends FormRequest { protected array $scenes = [ - 'add' => ['pid', 'dept_name'], - 'edit' => ['dept_id', 'pid', 'dept_name'], + 'add' => ['parent_id', 'dept_name'], + 'edit' => ['dept_id', 'parent_id', 'dept_name'], ]; /** @@ -29,7 +29,7 @@ class Dept extends FormRequest { return [ 'dept_id' => 'required', - 'pid' => 'required', + 'parent_id' => 'required', 'dept_name' => 'required' ]; } @@ -38,7 +38,7 @@ class Dept extends FormRequest { return [ 'dept_id.required' => '部门ID必填!', - 'pid.required' => '上级ID必选!', + 'parent_id.required' => '上级ID必选!', 'dept_name.required' => '部门名称必填!' ]; } diff --git a/app/Request/Menu.php b/app/Request/Menu.php index c9e5a34..2090447 100644 --- a/app/Request/Menu.php +++ b/app/Request/Menu.php @@ -10,9 +10,9 @@ use Hyperf\Validation\Request\FormRequest; class Menu extends FormRequest { protected array $scenes = [ - 'add' => ['pid', 'title', 'type'], - 'edit' => ['pid', 'title', 'type','menu_id'], - 'quick' => ['pid', 'title', 'name', 'flag', 'path', 'icon'] + 'add' => ['parent_id', 'title', 'type'], + 'edit' => ['parent_id', 'title', 'type','menu_id'], + 'quick' => ['parent_id', 'title', 'name', 'flag', 'path', 'icon'] ]; /** @@ -30,7 +30,7 @@ class Menu extends FormRequest { return [ 'menu_id' => 'required', - 'pid' => 'required', + 'parent_id' => 'required', 'title' => 'required', 'type' => 'required', 'name' => 'required', @@ -44,7 +44,7 @@ class Menu extends FormRequest { return [ 'menu_id.required' => '菜单ID必填!', - 'pid.required' => '上级ID必选!', + 'parent_id.required' => '上级ID必选!', 'title.required' => '菜单名称必填!', 'type.required' => '菜单类型必填!' ];