From a0c2eaaf53ac998034097dccd70b66cb54b4a6dd Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Thu, 17 Jul 2025 11:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/DishesLists.php | 2 +- app/admin/logic/DishesLogic.php | 6 +- app/admin/validate/DishesValidate.php | 172 +++++++++-------- .../validate/ProductCategoryValidate.php | 168 ++++++++-------- app/admin/validate/ProductUnitValidate.php | 168 ++++++++-------- app/admin/validate/ProductValidate.php | 178 +++++++++-------- .../validate/ProjectDishesProductValidate.php | 176 +++++++++-------- app/admin/validate/ProjectDishesValidate.php | 170 ++++++++-------- app/admin/validate/ProjectValidate.php | 182 ++++++++++-------- 9 files changed, 646 insertions(+), 576 deletions(-) diff --git a/app/admin/lists/DishesLists.php b/app/admin/lists/DishesLists.php index 52b1e35..5d456a3 100644 --- a/app/admin/lists/DishesLists.php +++ b/app/admin/lists/DishesLists.php @@ -48,7 +48,7 @@ class DishesLists extends BaseAdminDataLists implements ListsSearchInterface $dishesCategoryIds = DishesCategory::where('id', $this->params['dishes_category_id'])->whereOr('pid', $this->params['dishes_category_id'])->column('id'); $query->whereIn('dishes_category_id', $dishesCategoryIds); } - return $query->field(['id', 'name', 'dishes_category_id', 'create_time']) + return $query->field(['id', 'name', 'dishes_category_id', 'create_time', 'image', 'intro']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() diff --git a/app/admin/logic/DishesLogic.php b/app/admin/logic/DishesLogic.php index 17db1a3..dc48382 100644 --- a/app/admin/logic/DishesLogic.php +++ b/app/admin/logic/DishesLogic.php @@ -30,6 +30,8 @@ class DishesLogic extends BaseLogic try { Dishes::create([ 'name' => $params['name'], + 'image' => $params['image'], + 'intro' => $params['intro'], 'dishes_category_id' => $params['dishes_category_id'], ]); @@ -56,6 +58,8 @@ class DishesLogic extends BaseLogic try { Dishes::where('id', $params['id'])->update([ 'name' => $params['name'], + 'image' => $params['image'], + 'intro' => $params['intro'], 'dishes_category_id' => $params['dishes_category_id'], ]); @@ -93,4 +97,4 @@ class DishesLogic extends BaseLogic { return Dishes::findOrEmpty($params['id'])->toArray(); } -} \ No newline at end of file +} diff --git a/app/admin/validate/DishesValidate.php b/app/admin/validate/DishesValidate.php index 96d23d1..b000600 100644 --- a/app/admin/validate/DishesValidate.php +++ b/app/admin/validate/DishesValidate.php @@ -1,82 +1,90 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return DishesValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return DishesValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return DishesValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return DishesValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'name' => 'require', + 'dishes_category_id' => 'require', + 'image' => 'require', + 'intro' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '名称', + 'dishes_category_id' => '菜品分类id', + 'image' => '图片', + 'intro' => '简介', + ]; + + + /** + * @notes 添加场景 + * @return DishesValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return DishesValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneEdit() + { + return $this->only(['id', 'dishes_category_id', 'name', 'image', 'intro']); + } + + + /** + * @notes 删除场景 + * @return DishesValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return DishesValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProductCategoryValidate.php b/app/admin/validate/ProductCategoryValidate.php index 2af8f91..27eaa4d 100644 --- a/app/admin/validate/ProductCategoryValidate.php +++ b/app/admin/validate/ProductCategoryValidate.php @@ -1,82 +1,86 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProductCategoryValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProductCategoryValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProductCategoryValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProductCategoryValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'pid' => 'require', + 'name' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'pid' => '上级', + 'name' => '名称', + ]; + + + /** + * @notes 添加场景 + * @return ProductCategoryValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProductCategoryValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneEdit() + { + return $this->only(['id', 'pid', 'name']); + } + + + /** + * @notes 删除场景 + * @return ProductCategoryValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProductCategoryValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProductUnitValidate.php b/app/admin/validate/ProductUnitValidate.php index 6eaf384..8608684 100644 --- a/app/admin/validate/ProductUnitValidate.php +++ b/app/admin/validate/ProductUnitValidate.php @@ -1,82 +1,86 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProductUnitValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProductUnitValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProductUnitValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProductUnitValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'name' => 'require', + 'conversion_value' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '名称', + 'conversion_value' => '换算值', + ]; + + + /** + * @notes 添加场景 + * @return ProductUnitValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProductUnitValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProductUnitValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProductUnitValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProductValidate.php b/app/admin/validate/ProductValidate.php index 3e45825..cb6a364 100644 --- a/app/admin/validate/ProductValidate.php +++ b/app/admin/validate/ProductValidate.php @@ -1,82 +1,96 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProductValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProductValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProductValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProductValidate - * @author likeadmin - * @date 2025/07/11 11:41 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'category_id' => 'require', + 'unit_id' => 'require', + 'name' => 'require', + 'image' => 'require', + 'intro' => 'require', + 'conent' => 'require', + 'product_type' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'category_id' => '分类', + 'unit_id' => '单位', + 'name' => '名称', + 'image' => '图片', + 'intro' => '简介', + 'conent' => '内容', + 'product_type' => '商品类型', + ]; + + + /** + * @notes 添加场景 + * @return ProductValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProductValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneEdit() + { + return $this->only(['id', 'category_id', 'unit_id', 'name', 'image', 'intro', 'conent', 'product_type']); + } + + + /** + * @notes 删除场景 + * @return ProductValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProductValidate + * @author likeadmin + * @date 2025/07/11 11:41 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProjectDishesProductValidate.php b/app/admin/validate/ProjectDishesProductValidate.php index e64eebd..2fb1027 100644 --- a/app/admin/validate/ProjectDishesProductValidate.php +++ b/app/admin/validate/ProjectDishesProductValidate.php @@ -1,82 +1,94 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectDishesProductValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectDishesProductValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectDishesProductValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectDishesProductValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'project_id' => 'require', + 'dishes_id' => 'require', + 'product_id' => 'require', + 'unit_id' => 'require', + 'nums' => 'require', + 'consume_time' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目ID', + 'dishes_id' => '菜品ID', + 'product_id' => '商品ID', + 'unit_id' => '单位ID', + 'nums' => '数量', + 'consume_time' => '食用时间', + ]; + + + /** + * @notes 添加场景 + * @return ProjectDishesProductValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectDishesProductValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneEdit() + { + return $this->only(['id', 'project_id', 'dishes_id', 'product_id', 'unit_id', 'nums', 'consume_time']); + } + + + /** + * @notes 删除场景 + * @return ProjectDishesProductValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProjectDishesProductValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProjectDishesValidate.php b/app/admin/validate/ProjectDishesValidate.php index 4d675a6..3f1a45d 100644 --- a/app/admin/validate/ProjectDishesValidate.php +++ b/app/admin/validate/ProjectDishesValidate.php @@ -1,82 +1,88 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectDishesValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectDishesValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectDishesValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectDishesValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'project_id' => 'require', + 'dishes_id' => 'require', + 'consume_time' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目ID', + 'dishes_id' => '菜品ID', + 'consume_time' => '食用时间', + ]; + + + /** + * @notes 添加场景 + * @return ProjectDishesValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectDishesValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ProjectDishesValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDelete() + { + return $this->only(['id', 'project_id', 'dishes_id', 'consume_time']); + } + + + /** + * @notes 详情场景 + * @return ProjectDishesValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} diff --git a/app/admin/validate/ProjectValidate.php b/app/admin/validate/ProjectValidate.php index 254f108..cb9bef2 100644 --- a/app/admin/validate/ProjectValidate.php +++ b/app/admin/validate/ProjectValidate.php @@ -1,82 +1,100 @@ - 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - ]; - - - /** - * @notes 添加场景 - * @return ProjectValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneAdd() - { - return $this->remove('id', true); - } - - - /** - * @notes 编辑场景 - * @return ProjectValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneEdit() - { - return $this->only(['id']); - } - - - /** - * @notes 删除场景 - * @return ProjectValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return ProjectValidate - * @author likeadmin - * @date 2025/07/16 15:09 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file + 'require', + 'name' => 'require', + 'address' => 'require', + 'start_time' => 'require', + 'end_time' => 'require', + 'linkman' => 'require', + 'contacts_dept' => 'require', + 'contact_number' => 'require', + 'area_manager_id' => 'require', + 'project_status' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '名称', + 'address' => '地址', + 'start_time' => '开始时间', + 'end_time' => '结束时间', + 'linkman' => '联系人', + 'contacts_dept' => '联系部门', + 'contact_number' => '联系电话', + 'area_manager_id' => '区域经理', + 'project_status' => '项目状态', + ]; + + + /** + * @notes 添加场景 + * @return ProjectValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ProjectValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneEdit() + { + return $this->only(['id', 'name', 'address', 'start_time', 'end_time', 'linkman', 'contacts_dept', 'contact_number', 'area_manager_id', 'project_status']); + } + + + /** + * @notes 删除场景 + * @return ProjectValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ProjectValidate + * @author likeadmin + * @date 2025/07/16 15:09 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +}