diff --git a/app/admin/controller/game/Channel.php b/app/admin/controller/game/Channel.php new file mode 100644 index 0000000..f075f1f --- /dev/null +++ b/app/admin/controller/game/Channel.php @@ -0,0 +1,70 @@ +model = new \app\common\model\GameChannel(); + 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(['adminGroup' => ['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/GameChannel.php b/app/common/model/GameChannel.php new file mode 100644 index 0000000..f7e8632 --- /dev/null +++ b/app/common/model/GameChannel.php @@ -0,0 +1,39 @@ + 'integer', + 'update_time' => 'integer', + ]; + + + public function getprofitAmountAttr($value): ?float + { + return is_null($value) ? null : (float)$value; + } + + public function adminGroup(): \think\model\relation\BelongsTo + { + return $this->belongsTo(\app\admin\model\AdminGroup::class, 'admin_group_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/GameChannel.php b/app/common/validate/GameChannel.php new file mode 100644 index 0000000..2e14afb --- /dev/null +++ b/app/common/validate/GameChannel.php @@ -0,0 +1,31 @@ + [], + 'edit' => [], + ]; + +} diff --git a/web/src/lang/backend/en/game/channel.ts b/web/src/lang/backend/en/game/channel.ts new file mode 100644 index 0000000..35bea2f --- /dev/null +++ b/web/src/lang/backend/en/game/channel.ts @@ -0,0 +1,18 @@ +export default { + id: 'id', + code: 'code', + name: 'name', + user_count: 'user_count', + profit_amount: 'profit_amount', + status: 'status', + 'status 0': 'status 0', + 'status 1': 'status 1', + remark: 'remark', + admin_group_id: 'admin_group_id', + admingroup__name: 'name', + admin_id: 'admin_id', + admin__username: 'username', + create_time: 'create_time', + update_time: 'update_time', + 'quick Search Fields': 'id,code,name', +} diff --git a/web/src/lang/backend/zh-cn/game/channel.ts b/web/src/lang/backend/zh-cn/game/channel.ts new file mode 100644 index 0000000..f185326 --- /dev/null +++ b/web/src/lang/backend/zh-cn/game/channel.ts @@ -0,0 +1,18 @@ +export default { + id: 'ID', + code: '渠道标识', + name: '渠道名', + user_count: '用户数', + profit_amount: '利润', + status: '状态', + 'status 0': '禁用', + 'status 1': '启用', + remark: '备注', + admin_group_id: '管理角色组', + admingroup__name: '组名', + admin_id: '管理员', + admin__username: '用户名', + create_time: '创建时间', + update_time: '修改时间', + 'quick Search Fields': 'ID、渠道标识、渠道名', +} diff --git a/web/src/views/backend/game/channel/index.vue b/web/src/views/backend/game/channel/index.vue new file mode 100644 index 0000000..eeee7c7 --- /dev/null +++ b/web/src/views/backend/game/channel/index.vue @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/web/src/views/backend/game/channel/popupForm.vue b/web/src/views/backend/game/channel/popupForm.vue new file mode 100644 index 0000000..43a2e50 --- /dev/null +++ b/web/src/views/backend/game/channel/popupForm.vue @@ -0,0 +1,120 @@ + + + + + + + + {{ baTable.form.operate ? t(baTable.form.operate) : '' }} + + + + + + + + + + + + + + + + + {{ t('Cancel') }} + + {{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }} + + + + + + + + +