From 1d350ddb683572e76586577e35b4968b9bfe0f0d Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Wed, 1 Apr 2026 15:51:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F-=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/game/User.php | 70 +++++++++ app/common/model/GameUser.php | 39 +++++ app/common/validate/GameUser.php | 31 ++++ web/src/lang/backend/en/game/user.ts | 19 +++ web/src/lang/backend/zh-cn/game/user.ts | 19 +++ web/src/views/backend/game/user/index.vue | 141 ++++++++++++++++++ web/src/views/backend/game/user/popupForm.vue | 138 +++++++++++++++++ 7 files changed, 457 insertions(+) create mode 100644 app/admin/controller/game/User.php create mode 100644 app/common/model/GameUser.php create mode 100644 app/common/validate/GameUser.php create mode 100644 web/src/lang/backend/en/game/user.ts create mode 100644 web/src/lang/backend/zh-cn/game/user.ts create mode 100644 web/src/views/backend/game/user/index.vue create mode 100644 web/src/views/backend/game/user/popupForm.vue diff --git a/app/admin/controller/game/User.php b/app/admin/controller/game/User.php new file mode 100644 index 0000000..6c21763 --- /dev/null +++ b/app/admin/controller/game/User.php @@ -0,0 +1,70 @@ +model = new \app\common\model\GameUser(); + return null; + } + + /** + * 查看 + * @throws Throwable + */ + protected function _index(): Response + { + // 如果是 select 则转发到 select 方法,若未重写该方法,其实还是继续执行 index + if ($this->request && $this->request->get('select')) { + return $this->select($this->request); + } + + /** + * 1. withJoin 不可使用 alias 方法设置表别名,别名将自动使用关联模型名称(小写下划线命名规则) + * 2. 以下的别名设置了主表别名,同时便于拼接查询参数等 + * 3. paginate 数据集可使用链式操作 each(function($item, $key) {}) 遍历处理 + */ + list($where, $alias, $limit, $order) = $this->queryBuilder(); + $res = $this->model + ->withJoin($this->withJoinTable, $this->withJoinType) + ->with($this->withJoinTable) + ->visible(['gameChannel' => ['name'], 'admin' => ['username']]) + ->alias($alias) + ->where($where) + ->order($order) + ->paginate($limit); + + return $this->success('', [ + 'list' => $res->items(), + 'total' => $res->total(), + 'remark' => get_route_remark(), + ]); + } + + /** + * 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写 + */ +} \ No newline at end of file diff --git a/app/common/model/GameUser.php b/app/common/model/GameUser.php new file mode 100644 index 0000000..6345d64 --- /dev/null +++ b/app/common/model/GameUser.php @@ -0,0 +1,39 @@ + 'integer', + 'update_time' => 'integer', + ]; + + + public function getcoinAttr($value): ?float + { + return is_null($value) ? null : (float)$value; + } + + public function gameChannel(): \think\model\relation\BelongsTo + { + return $this->belongsTo(\app\common\model\GameChannel::class, 'game_channel_id', 'id'); + } + + public function admin(): \think\model\relation\BelongsTo + { + return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id'); + } +} \ No newline at end of file diff --git a/app/common/validate/GameUser.php b/app/common/validate/GameUser.php new file mode 100644 index 0000000..b85e1f4 --- /dev/null +++ b/app/common/validate/GameUser.php @@ -0,0 +1,31 @@ + [], + 'edit' => [], + ]; + +} diff --git a/web/src/lang/backend/en/game/user.ts b/web/src/lang/backend/en/game/user.ts new file mode 100644 index 0000000..7a211d5 --- /dev/null +++ b/web/src/lang/backend/en/game/user.ts @@ -0,0 +1,19 @@ +export default { + id: 'id', + username: 'username', + password: 'password', + uuid: 'uuid', + phone: 'phone', + remark: 'remark', + coin: 'coin', + status: 'status', + 'status 0': 'status 0', + 'status 1': 'status 1', + game_channel_id: 'game_channel_id', + gamechannel__name: 'name', + admin_id: 'admin_id', + admin__username: 'username', + create_time: 'create_time', + update_time: 'update_time', + 'quick Search Fields': 'id,username,phone', +} diff --git a/web/src/lang/backend/zh-cn/game/user.ts b/web/src/lang/backend/zh-cn/game/user.ts new file mode 100644 index 0000000..5d876ea --- /dev/null +++ b/web/src/lang/backend/zh-cn/game/user.ts @@ -0,0 +1,19 @@ +export default { + id: 'ID', + username: '用户名', + password: '密码', + uuid: '用户唯一标识', + phone: '手机号', + remark: '备注', + coin: '平台币', + status: '状态', + 'status 0': '禁用', + 'status 1': '启用', + game_channel_id: '所属渠道', + gamechannel__name: '渠道名', + admin_id: '所属管理员', + admin__username: '用户名', + create_time: '创建时间', + update_time: '修改时间', + 'quick Search Fields': 'ID、用户名、手机号', +} diff --git a/web/src/views/backend/game/user/index.vue b/web/src/views/backend/game/user/index.vue new file mode 100644 index 0000000..8f86a00 --- /dev/null +++ b/web/src/views/backend/game/user/index.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/web/src/views/backend/game/user/popupForm.vue b/web/src/views/backend/game/user/popupForm.vue new file mode 100644 index 0000000..1bf626e --- /dev/null +++ b/web/src/views/backend/game/user/popupForm.vue @@ -0,0 +1,138 @@ + + + + +