From 1e8ea9c886fabf65bd71e1c91ba597c6e84dd975 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Tue, 3 Mar 2026 11:49:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=89=B2=E5=AD=90=E6=B8=B8=E6=88=8F]=E5=A5=96?= =?UTF-8?q?=E6=B1=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/dice/api/lottery_config/index.ts | 65 +++++++ .../dice/lottery_config/index/index.vue | 133 +++++++++++++++ .../index/modules/edit-dialog.vue | 161 ++++++++++++++++++ .../index/modules/table-search.vue | 72 ++++++++ .../DiceLotteryConfigController.php | 122 +++++++++++++ .../lottery_config/DiceLotteryConfigLogic.php | 27 +++ .../lottery_config/DiceLotteryConfig.php | 53 ++++++ .../DiceLotteryConfigValidate.php | 54 ++++++ 8 files changed, 687 insertions(+) create mode 100644 saiadmin-artd/src/views/plugin/dice/api/lottery_config/index.ts create mode 100644 saiadmin-artd/src/views/plugin/dice/lottery_config/index/index.vue create mode 100644 saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/edit-dialog.vue create mode 100644 saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/table-search.vue create mode 100644 server/app/dice/controller/lottery_config/DiceLotteryConfigController.php create mode 100644 server/app/dice/logic/lottery_config/DiceLotteryConfigLogic.php create mode 100644 server/app/dice/model/lottery_config/DiceLotteryConfig.php create mode 100644 server/app/dice/validate/lottery_config/DiceLotteryConfigValidate.php diff --git a/saiadmin-artd/src/views/plugin/dice/api/lottery_config/index.ts b/saiadmin-artd/src/views/plugin/dice/api/lottery_config/index.ts new file mode 100644 index 0000000..aeb9984 --- /dev/null +++ b/saiadmin-artd/src/views/plugin/dice/api/lottery_config/index.ts @@ -0,0 +1,65 @@ +import request from '@/utils/http' + +/** + * 色子奖池配置 API接口 + */ +export default { + /** + * 获取数据列表 + * @param params 搜索参数 + * @returns 数据列表 + */ + list(params: Record) { + return request.get({ + url: '/dice/lottery_config/DiceLotteryConfig/index', + params + }) + }, + + /** + * 读取数据 + * @param id 数据ID + * @returns 数据详情 + */ + read(id: number | string) { + return request.get({ + url: '/dice/lottery_config/DiceLotteryConfig/read?id=' + id + }) + }, + + /** + * 创建数据 + * @param params 数据参数 + * @returns 执行结果 + */ + save(params: Record) { + return request.post({ + url: '/dice/lottery_config/DiceLotteryConfig/save', + data: params + }) + }, + + /** + * 更新数据 + * @param params 数据参数 + * @returns 执行结果 + */ + update(params: Record) { + return request.put({ + url: '/dice/lottery_config/DiceLotteryConfig/update', + data: params + }) + }, + + /** + * 删除数据 + * @param id 数据ID + * @returns 执行结果 + */ + delete(params: Record) { + return request.del({ + url: '/dice/lottery_config/DiceLotteryConfig/destroy', + data: params + }) + } +} diff --git a/saiadmin-artd/src/views/plugin/dice/lottery_config/index/index.vue b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/index.vue new file mode 100644 index 0000000..95a0401 --- /dev/null +++ b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/index.vue @@ -0,0 +1,133 @@ + + + diff --git a/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/edit-dialog.vue b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/edit-dialog.vue new file mode 100644 index 0000000..9c3e483 --- /dev/null +++ b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/edit-dialog.vue @@ -0,0 +1,161 @@ + + + diff --git a/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/table-search.vue b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/table-search.vue new file mode 100644 index 0000000..1cf75e9 --- /dev/null +++ b/saiadmin-artd/src/views/plugin/dice/lottery_config/index/modules/table-search.vue @@ -0,0 +1,72 @@ + + + diff --git a/server/app/dice/controller/lottery_config/DiceLotteryConfigController.php b/server/app/dice/controller/lottery_config/DiceLotteryConfigController.php new file mode 100644 index 0000000..bf8fbe3 --- /dev/null +++ b/server/app/dice/controller/lottery_config/DiceLotteryConfigController.php @@ -0,0 +1,122 @@ +logic = new DiceLotteryConfigLogic(); + $this->validate = new DiceLotteryConfigValidate; + parent::__construct(); + } + + /** + * 数据列表 + * @param Request $request + * @return Response + */ + #[Permission('色子奖池配置列表', 'dice:lottery_config:index:index')] + public function index(Request $request): Response + { + $where = $request->more([ + ['name', ''], + ['type', ''], + ]); + $query = $this->logic->search($where); + $data = $this->logic->getList($query); + return $this->success($data); + } + + /** + * 读取数据 + * @param Request $request + * @return Response + */ + #[Permission('色子奖池配置读取', 'dice:lottery_config:index:read')] + public function read(Request $request): Response + { + $id = $request->input('id', ''); + $model = $this->logic->read($id); + if ($model) { + $data = is_array($model) ? $model : $model->toArray(); + return $this->success($data); + } else { + return $this->fail('未查找到信息'); + } + } + + /** + * 保存数据 + * @param Request $request + * @return Response + */ + #[Permission('色子奖池配置添加', 'dice:lottery_config:index:save')] + public function save(Request $request): Response + { + $data = $request->post(); + $this->validate('save', $data); + $result = $this->logic->add($data); + if ($result) { + return $this->success('添加成功'); + } else { + return $this->fail('添加失败'); + } + } + + /** + * 更新数据 + * @param Request $request + * @return Response + */ + #[Permission('色子奖池配置修改', 'dice:lottery_config:index:update')] + public function update(Request $request): Response + { + $data = $request->post(); + $this->validate('update', $data); + $result = $this->logic->edit($data['id'], $data); + if ($result) { + return $this->success('修改成功'); + } else { + return $this->fail('修改失败'); + } + } + + /** + * 删除数据 + * @param Request $request + * @return Response + */ + #[Permission('色子奖池配置删除', 'dice:lottery_config:index:destroy')] + public function destroy(Request $request): Response + { + $ids = $request->post('ids', ''); + if (empty($ids)) { + return $this->fail('请选择要删除的数据'); + } + $result = $this->logic->destroy($ids); + if ($result) { + return $this->success('删除成功'); + } else { + return $this->fail('删除失败'); + } + } + +} diff --git a/server/app/dice/logic/lottery_config/DiceLotteryConfigLogic.php b/server/app/dice/logic/lottery_config/DiceLotteryConfigLogic.php new file mode 100644 index 0000000..fa23682 --- /dev/null +++ b/server/app/dice/logic/lottery_config/DiceLotteryConfigLogic.php @@ -0,0 +1,27 @@ +model = new DiceLotteryConfig(); + } + +} diff --git a/server/app/dice/model/lottery_config/DiceLotteryConfig.php b/server/app/dice/model/lottery_config/DiceLotteryConfig.php new file mode 100644 index 0000000..f6283c1 --- /dev/null +++ b/server/app/dice/model/lottery_config/DiceLotteryConfig.php @@ -0,0 +1,53 @@ +where('name', 'like', '%'.$value.'%'); + } + +} diff --git a/server/app/dice/validate/lottery_config/DiceLotteryConfigValidate.php b/server/app/dice/validate/lottery_config/DiceLotteryConfigValidate.php new file mode 100644 index 0000000..31ac022 --- /dev/null +++ b/server/app/dice/validate/lottery_config/DiceLotteryConfigValidate.php @@ -0,0 +1,54 @@ + 'require', + 'weight' => 'require', + 'remark' => 'require', + 'type' => 'require', + ]; + + /** + * 定义错误信息 + */ + protected $message = [ + 'name' => '名称必须填写', + 'weight' => '权重必须填写', + 'remark' => '备注必须填写', + 'type' => '奖池类型必须填写', + ]; + + /** + * 定义场景 + */ + protected $scene = [ + 'save' => [ + 'name', + 'weight', + 'remark', + 'type', + ], + 'update' => [ + 'name', + 'weight', + 'remark', + 'type', + ], + ]; + +}