diff --git a/app/admin/controller/game/Channel.php b/app/admin/controller/game/Channel.php index 5b1f418..c049933 100644 --- a/app/admin/controller/game/Channel.php +++ b/app/admin/controller/game/Channel.php @@ -4,6 +4,7 @@ namespace app\admin\controller\game; use Throwable; use app\common\controller\Backend; +use app\common\library\GameRewardConfigTemplate; use support\think\Db; use support\Response; use Webman\Http\Request as WebmanRequest; @@ -229,6 +230,7 @@ class Channel extends Backend if ($this->isPositiveChannelId($newChannelId)) { try { $this->copyGameConfigFromChannelZero($newChannelId); + $this->copyRewardConfigFromTemplate($newChannelId); } catch (Throwable $e) { return $this->error(__('Game channel copy default config failed') . ': ' . $e->getMessage()); } @@ -595,10 +597,38 @@ class Channel extends Backend } /** - * 新建渠道后:将 channel_id=0 的全局默认游戏配置复制一份,channel_id 指向新渠道主键 + * 新建渠道后:game_reward_config 优先从 game_channel_id=0 的默认模板复制;若无则使用 resource JSON 模板 * * @param int|string $newChannelId 新建 game_channel.id */ + private function copyRewardConfigFromTemplate(int|string $newChannelId): void + { + $exists = Db::name('game_reward_config')->where('game_channel_id', $newChannelId)->count(); + if ($exists > 0) { + return; + } + $now = time(); + $tpl = Db::name('game_reward_config')->whereIn('game_channel_id', [0, '0'])->order('id', 'asc')->find(); + if ($tpl) { + Db::name('game_reward_config')->insert([ + 'game_channel_id' => $newChannelId, + 'tier_reward_form' => $tpl['tier_reward_form'], + 'bigwin_form' => $tpl['bigwin_form'], + 'create_time' => $now, + 'update_time' => $now, + ]); + return; + } + $cols = GameRewardConfigTemplate::getDefaultJsonColumns(); + Db::name('game_reward_config')->insert([ + 'game_channel_id' => $newChannelId, + 'tier_reward_form' => $cols['tier_reward_form'], + 'bigwin_form' => $cols['bigwin_form'], + 'create_time' => $now, + 'update_time' => $now, + ]); + } + private function copyGameConfigFromChannelZero(int|string $newChannelId): void { $exists = Db::name('game_config')->where('channel_id', $newChannelId)->count(); diff --git a/app/admin/controller/game/RewardConfig.php b/app/admin/controller/game/RewardConfig.php index 4f1b163..41974d4 100644 --- a/app/admin/controller/game/RewardConfig.php +++ b/app/admin/controller/game/RewardConfig.php @@ -1,183 +1,164 @@ model = new \app\common\model\GameRewardConfig(); - return null; - } - - /** - * 将可访问管理员 ID 转换为可访问渠道 ID - * - * @return list - */ - protected function getDataLimitAdminIds(): array - { - if (!$this->dataLimit || !$this->auth || $this->auth->isSuperAdmin()) { - return []; - } - $adminIds = parent::getDataLimitAdminIds(); - if ($adminIds === []) { - return []; - } - $channelIds = Db::name('game_channel')->where('admin_id', 'in', $adminIds)->column('id'); - if ($channelIds === []) { - return [-1]; - } - return array_values(array_unique($channelIds)); - } - - /** - * 新增:非超管仅可写入权限内渠道 - * @throws Throwable - */ - protected function _add(): Response - { - if ($this->request && $this->request->method() === 'POST' && !$this->auth->isSuperAdmin()) { - $allowedChannelIds = $this->getDataLimitAdminIds(); - $cid = $this->request->post('game_channel_id'); - if ($cid === null || $cid === '' || ($allowedChannelIds !== [] && !in_array($cid, $allowedChannelIds))) { - return $this->error(__('You have no permission')); - } - } - return parent::_add(); - } - - /** - * 编辑:非超管锁定渠道,不允许跨渠道改写 - * @throws Throwable - */ - protected function _edit(): Response - { - $pk = $this->model->getPk(); - $id = $this->request ? ($this->request->post($pk) ?? $this->request->get($pk)) : null; - $row = $this->model->find($id); - if (!$row) { - return $this->error(__('Record not found')); + $response = $this->initializeBackend($request); + if ($response !== null) { + return $response; } - $dataLimitAdminIds = $this->getDataLimitAdminIds(); - if ($dataLimitAdminIds && !in_array($row[$this->dataLimitField], $dataLimitAdminIds)) { - return $this->error(__('You have no permission')); + [$channelId, $err] = $this->resolveTargetChannelId($request, false); + if ($err !== null) { + return $err; } - if ($this->request && $this->request->method() === 'POST') { - $data = $this->request->post(); - if (!$data) { - return $this->error(__('Parameter %s can not be empty', [''])); - } - - $data = $this->applyInputFilter($data); - $data = $this->excludeFields($data); - - if (!$this->auth->isSuperAdmin()) { - $data[$this->dataLimitField] = $row[$this->dataLimitField]; - } - - $result = false; - $this->model->startTrans(); - try { - if ($this->modelValidate) { - $validate = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - if (class_exists($validate)) { - $validate = new $validate(); - if ($this->modelSceneValidate) { - $validate->scene('edit'); - } - $data[$pk] = $row[$pk]; - $validate->check($data); - } - } - $result = $row->save($data); - $this->model->commit(); - } catch (Throwable $e) { - $this->model->rollback(); - return $this->error($e->getMessage()); - } - if ($result !== false) { - return $this->success(__('Update successful')); - } - return $this->error(__('No rows updated')); + $row = GameRewardConfig::where('game_channel_id', $channelId)->find(); + if ($row) { + return $this->success('', [ + 'row' => $row->toArray(), + ]); } - return $this->success('', ['row' => $row]); - } - - /** - * 查看 - * @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']]) - ->alias($alias) - ->where($where) - ->order($order) - ->paginate($limit); + $defaults = GameRewardConfigTemplate::getDefaultJsonColumns(); return $this->success('', [ - 'list' => $res->items(), - 'total' => $res->total(), - 'remark' => get_route_remark(), + 'row' => [ + 'id' => null, + 'game_channel_id' => $channelId, + 'tier_reward_form' => $defaults['tier_reward_form'], + 'bigwin_form' => $defaults['bigwin_form'], + ], ]); } + public function save(WebmanRequest $request): Response + { + $response = $this->initializeBackend($request); + if ($response !== null) { + return $response; + } + + if ($request->method() !== 'POST') { + return $this->error(__('Parameter error')); + } + + $data = $request->post(); + if (!$data) { + return $this->error(__('Parameter %s can not be empty', [''])); + } + + [$channelId, $err] = $this->resolveTargetChannelId($request, true); + if ($err !== null) { + return $err; + } + + if (!$this->channelExists($channelId)) { + return $this->error(__('Record not found')); + } + + $tier = $data['tier_reward_form'] ?? null; + $big = $data['bigwin_form'] ?? null; + if (!is_string($tier) || !is_string($big)) { + return $this->error(__('Parameter error')); + } + + try { + $validate = new GameRewardConfigValidate(); + $validate->scene('channel_form')->check([ + 'tier_reward_form' => $tier, + 'bigwin_form' => $big, + ]); + } catch (Throwable $e) { + return $this->error($e->getMessage()); + } + + $existing = GameRewardConfig::where('game_channel_id', $channelId)->find(); + + try { + if ($existing) { + $existing->save([ + 'tier_reward_form' => $tier, + 'bigwin_form' => $big, + ]); + } else { + $m = new GameRewardConfig(); + $m->save([ + 'game_channel_id' => $channelId, + 'tier_reward_form' => $tier, + 'bigwin_form' => $big, + ]); + } + } catch (Throwable $e) { + return $this->error($e->getMessage()); + } + + return $this->success(__('Update successful')); + } + /** - * 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写 + * @return array{0: int, 1: Response|null} */ -} \ No newline at end of file + private function resolveTargetChannelId(WebmanRequest $request, bool $isPost): array + { + if ($this->auth->isSuperAdmin()) { + $raw = $isPost ? ($request->post('game_channel_id') ?? $request->get('game_channel_id')) : $request->get('game_channel_id'); + if ($raw === null || $raw === '') { + return [self::DEFAULT_TEMPLATE_CHANNEL_ID, null]; + } + if (!is_numeric($raw)) { + return [self::DEFAULT_TEMPLATE_CHANNEL_ID, $this->error(__('Parameter error'))]; + } + $cid = intval(strval($raw)); + if ($cid < 0) { + return [self::DEFAULT_TEMPLATE_CHANNEL_ID, $this->error(__('Parameter error'))]; + } + if ($cid === self::DEFAULT_TEMPLATE_CHANNEL_ID) { + return [self::DEFAULT_TEMPLATE_CHANNEL_ID, null]; + } + + return [$cid, null]; + } + + $ids = Db::name('game_channel')->where('admin_id', $this->auth->id)->order('id', 'asc')->column('id'); + if ($ids === []) { + return [self::DEFAULT_TEMPLATE_CHANNEL_ID, $this->error(__('Record not found'))]; + } + + return [intval(strval($ids[0])), null]; + } + + private function channelExists(int $channelId): bool + { + if ($channelId === self::DEFAULT_TEMPLATE_CHANNEL_ID) { + return $this->auth->isSuperAdmin(); + } + + if ($this->auth->isSuperAdmin()) { + return Db::name('game_channel')->where('id', $channelId)->count() > 0; + } + + return Db::name('game_channel')->where('id', $channelId)->where('admin_id', $this->auth->id)->count() > 0; + } +} diff --git a/app/common/library/GameRewardConfigTemplate.php b/app/common/library/GameRewardConfigTemplate.php new file mode 100644 index 0000000..f6db0e7 --- /dev/null +++ b/app/common/library/GameRewardConfigTemplate.php @@ -0,0 +1,55 @@ + $tierJson, + 'bigwin_form' => $bigJson, + ]; + return self::$cached; + } +} diff --git a/app/common/validate/GameRewardConfig.php b/app/common/validate/GameRewardConfig.php index aa16132..9a24194 100644 --- a/app/common/validate/GameRewardConfig.php +++ b/app/common/validate/GameRewardConfig.php @@ -34,6 +34,8 @@ class GameRewardConfig extends Validate protected $scene = [ 'add' => ['game_channel_id', 'tier_reward_form', 'bigwin_form'], 'edit' => ['game_channel_id', 'tier_reward_form', 'bigwin_form'], + /** 渠道表单页:渠道由后端固定,仅校验两份 JSON */ + 'channel_form' => ['tier_reward_form', 'bigwin_form'], ]; private function parseJsonArray(mixed $value, string $label): array|string diff --git a/database/mysql/webman-buildadmin-dafuweng.sql b/database/mysql/webman-buildadmin-dafuweng.sql index c347dd8..5f0961d 100644 --- a/database/mysql/webman-buildadmin-dafuweng.sql +++ b/database/mysql/webman-buildadmin-dafuweng.sql @@ -73,8 +73,8 @@ INSERT INTO `admin_group` VALUES (1, 0, '超级管理组', '*', 1, 1775022962, 1 INSERT INTO `admin_group` VALUES (2, 1, '一级管理员', '1,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,77,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,89', 1, 1775022962, 1775022962); INSERT INTO `admin_group` VALUES (3, 2, '二级管理员', '21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43', 1, 1775022962, 1775022962); INSERT INTO `admin_group` VALUES (4, 3, '三级管理员', '55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75', 1, 1775022962, 1775022962); -INSERT INTO `admin_group` VALUES (5, 0, '游戏测试1组', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,115,120,119,118,117,116,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92', 1, 1775815352, 1775026281); -INSERT INTO `admin_group` VALUES (6, 0, '游戏测试2组', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,115,120,119,118,117,116,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92', 1, 1775815346, 1775026316); +INSERT INTO `admin_group` VALUES (5, 0, '游戏测试1组', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92', 1, 1775815352, 1775026281); +INSERT INTO `admin_group` VALUES (6, 0, '游戏测试2组', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92', 1, 1775815346, 1775026316); INSERT INTO `admin_group` VALUES (7, 5, '游戏测试1组-主管', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,104,98,92,90,103,97,91', 1, 1775098629, 1775030867); INSERT INTO `admin_group` VALUES (8, 6, '游戏测试2组-主管', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,104,98,92,90,103,97,91', 1, 1775098640, 1775030892); INSERT INTO `admin_group` VALUES (9, 0, '游戏测试3组', '1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92', 1, 1775098646, 1775030906); @@ -357,8 +357,8 @@ INSERT INTO `admin_log` VALUES (234, 1, 'admin', '//localhost:8787/admin/game.Re INSERT INTO `admin_log` VALUES (235, 1, 'admin', '//localhost:8787/admin/game.RewardConfig/edit', '游戏奖励配置-编辑', '{\"id\":\"1\",\"game_channel_id\":\"1\",\"tier_reward_form\":\"[{\\\"grid_number\\\":\\\"5\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"6\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"7\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"8\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"9\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"10\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"11\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"12\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"13\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"14\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"15\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"16\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"17\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"18\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"19\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"20\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"21\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"22\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"23\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"24\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"25\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"26\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T1\\\"},{\\\"grid_number\\\":\\\"27\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T2\\\"},{\\\"grid_number\\\":\\\"28\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T3\\\"},{\\\"grid_number\\\":\\\"29\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T4\\\"},{\\\"grid_number\\\":\\\"30\\\",\\\"ui_text\\\":\\\"10\\\",\\\"real_ev\\\":\\\"10\\\",\\\"tier\\\":\\\"T5\\\"}]\",\"bigwin_form\":\"[{\\\"grid_number\\\":\\\"5\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"},{\\\"grid_number\\\":\\\"10\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"},{\\\"grid_number\\\":\\\"15\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"},{\\\"grid_number\\\":\\\"20\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"},{\\\"grid_number\\\":\\\"25\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"},{\\\"grid_number\\\":\\\"30\\\",\\\"ui_text\\\":\\\"100\\\",\\\"real_ev\\\":\\\"100\\\",\\\"tier\\\":\\\"BIGWIN\\\"}]\",\"create_time\":1775815266,\"update_time\":1775815266}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815296); INSERT INTO `admin_log` VALUES (236, 1, 'admin', '//localhost:8787/admin/Index/login', '登录', '{\"username\":\"admin\",\"password\":\"***\",\"keep\":false,\"captchaId\":\"01f6c821-abd5-4e71-ac62-ae455430e19b\",\"captchaInfo\":\"\"}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 1775815310); INSERT INTO `admin_log` VALUES (237, 3, 'admin2', '//localhost:8787/admin/Index/login', '登录', '{\"username\":\"admin2\",\"password\":\"***\",\"keep\":false,\"captchaId\":\"b162df33-89f1-4ecb-85e2-424281582b59\",\"captchaInfo\":\"\"}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 1775815322); -INSERT INTO `admin_log` VALUES (238, 1, 'admin', '//localhost:8787/admin/auth.Group/edit', '角色组管理-编辑', '{\"id\":6,\"pid\":0,\"name\":\"游戏测试2组\",\"rules\":[1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,115,120,119,118,117,116,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92],\"status\":1,\"update_time\":1775098619,\"create_time\":1775026316}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815346); -INSERT INTO `admin_log` VALUES (239, 1, 'admin', '//localhost:8787/admin/auth.Group/edit', '角色组管理-编辑', '{\"id\":5,\"pid\":0,\"name\":\"游戏测试1组\",\"rules\":[1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,115,120,119,118,117,116,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92],\"status\":1,\"update_time\":1775098598,\"create_time\":1775026281}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815352); +INSERT INTO `admin_log` VALUES (238, 1, 'admin', '//localhost:8787/admin/auth.Group/edit', '角色组管理-编辑', '{\"id\":6,\"pid\":0,\"name\":\"游戏测试2组\",\"rules\":[1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92],\"status\":1,\"update_time\":1775098619,\"create_time\":1775026316}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815346); +INSERT INTO `admin_log` VALUES (239, 1, 'admin', '//localhost:8787/admin/auth.Group/edit', '角色组管理-编辑', '{\"id\":5,\"pid\":0,\"name\":\"游戏测试1组\",\"rules\":[1,89,2,3,7,6,5,4,8,12,11,10,9,13,18,17,16,15,14,19,20,90,103,108,107,106,105,104,97,102,101,100,99,98,91,96,95,94,93,92],\"status\":1,\"update_time\":1775098598,\"create_time\":1775026281}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815352); INSERT INTO `admin_log` VALUES (240, 2, 'admin1', '//localhost:8787/admin/Index/login', '登录', '{\"username\":\"admin1\",\"password\":\"***\",\"keep\":false,\"captchaId\":\"a13e2e5d-5106-40a9-b98b-8bd6a1384d6b\",\"captchaInfo\":\"\"}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0', 1775815362); -- ---------------------------- @@ -385,7 +385,7 @@ CREATE TABLE `admin_rule` ( `create_time` bigint(16) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, INDEX `pid`(`pid` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 121 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单和权限规则表' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 109 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单和权限规则表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of admin_rule @@ -498,12 +498,6 @@ INSERT INTO `admin_rule` VALUES (105, 103, 'button', '添加', 'game/config/add' INSERT INTO `admin_rule` VALUES (106, 103, 'button', '编辑', 'game/config/edit', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775096581, 1775096581); INSERT INTO `admin_rule` VALUES (107, 103, 'button', '删除', 'game/config/del', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775096581, 1775096581); INSERT INTO `admin_rule` VALUES (108, 103, 'button', '快速排序', 'game/config/sortable', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775096581, 1775096581); -INSERT INTO `admin_rule` VALUES (115, 90, 'menu', '游戏奖励配置', 'game/rewardConfig', 'game/rewardConfig', '', 'tab', '', '/src/views/backend/game/rewardConfig/index.vue', 1, 'none', '', 0, 1, 1775809842, 1775809842); -INSERT INTO `admin_rule` VALUES (116, 115, 'button', '查看', 'game/rewardConfig/index', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775809842, 1775809842); -INSERT INTO `admin_rule` VALUES (117, 115, 'button', '添加', 'game/rewardConfig/add', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775809842, 1775809842); -INSERT INTO `admin_rule` VALUES (118, 115, 'button', '编辑', 'game/rewardConfig/edit', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775809842, 1775809842); -INSERT INTO `admin_rule` VALUES (119, 115, 'button', '删除', 'game/rewardConfig/del', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775809842, 1775809842); -INSERT INTO `admin_rule` VALUES (120, 115, 'button', '快速排序', 'game/rewardConfig/sortable', '', '', NULL, '', '', 0, 'none', '', 0, 1, 1775809842, 1775809842); -- ---------------------------- -- Table structure for area @@ -631,7 +625,7 @@ CREATE TABLE `crud_log` ( `connection` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '数据库连接配置标识', `create_time` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'CRUD记录表' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'CRUD记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of crud_log diff --git a/resource/game_reward_config_template.json b/resource/game_reward_config_template.json new file mode 100644 index 0000000..c96a207 --- /dev/null +++ b/resource/game_reward_config_template.json @@ -0,0 +1,38 @@ +{ + "tier_reward_form": [ + {"grid_number": 5, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 6, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 7, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 8, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 9, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 10, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 11, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 12, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 13, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 14, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 15, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 16, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 17, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 18, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 19, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 20, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 21, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 22, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 23, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 24, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 25, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 26, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 27, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 28, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 29, "ui_text": "", "real_ev": "", "tier": "T1"}, + {"grid_number": 30, "ui_text": "", "real_ev": "", "tier": "T1"} + ], + "bigwin_form": [ + {"grid_number": 5, "ui_text": "", "real_ev": "", "tier": "BIGWIN"}, + {"grid_number": 10, "ui_text": "", "real_ev": "", "tier": "BIGWIN"}, + {"grid_number": 15, "ui_text": "", "real_ev": "", "tier": "BIGWIN"}, + {"grid_number": 20, "ui_text": "", "real_ev": "", "tier": "BIGWIN"}, + {"grid_number": 25, "ui_text": "", "real_ev": "", "tier": "BIGWIN"}, + {"grid_number": 30, "ui_text": "", "real_ev": "", "tier": "BIGWIN"} + ] +} diff --git a/web/src/lang/autoload.ts b/web/src/lang/autoload.ts index af5d708..68e6934 100644 --- a/web/src/lang/autoload.ts +++ b/web/src/lang/autoload.ts @@ -11,4 +11,6 @@ export default { [adminBaseRoutePath + '/user/rule']: ['./backend/${lang}/auth/rule.ts'], [adminBaseRoutePath + '/user/scoreLog']: ['./backend/${lang}/user/moneyLog.ts'], [adminBaseRoutePath + '/crud/crud']: ['./backend/${lang}/crud/log.ts', './backend/${lang}/crud/state.ts'], + // /admin/game/rewardConfig 会加载 rewardConfig.ts;页面标题等仍在 rewardConfigForm.ts(game.rewardConfigForm) + [adminBaseRoutePath + '/game/rewardConfig']: ['./backend/${lang}/game/rewardConfigForm.ts'], } diff --git a/web/src/lang/backend/en/game/rewardConfigForm.ts b/web/src/lang/backend/en/game/rewardConfigForm.ts new file mode 100644 index 0000000..c3a95ec --- /dev/null +++ b/web/src/lang/backend/en/game/rewardConfigForm.ts @@ -0,0 +1,11 @@ +export default { + title: 'Game reward config', + intro: + 'Super admins can maintain the global default template (game_channel_id=0). New channels copy this reward config first; if no template row exists yet, the built-in JSON template is used. Channel admins can only edit their own channel.', + super_scope_label: 'Scope', + super_scope_template: 'Global default template', + super_scope_channel: 'Specific channel', + super_scope_hint: 'Pick a channel below, then click Refresh to load.', + btn_add: 'Save', + btn_reset: 'Reset', +} diff --git a/web/src/lang/backend/zh-cn/game/rewardConfigForm.ts b/web/src/lang/backend/zh-cn/game/rewardConfigForm.ts new file mode 100644 index 0000000..1f04760 --- /dev/null +++ b/web/src/lang/backend/zh-cn/game/rewardConfigForm.ts @@ -0,0 +1,11 @@ +export default { + title: '游戏奖励配置', + intro: + '超级管理员可维护「全渠道默认模板」(对应库中 game_channel_id=0)。新建渠道时,会优先复制该模板的档位奖励与超级大奖配置;若尚未保存过模板,则使用项目内置 JSON 模板。渠道管理员仅能编辑自己负责渠道的配置。', + super_scope_label: '维护范围', + super_scope_template: '全渠道默认模板', + super_scope_channel: '指定渠道', + super_scope_hint: '选择「指定渠道」后请在下拉框中选择具体渠道并点击刷新加载。', + btn_add: '新增', + btn_reset: '重置', +} diff --git a/web/src/views/backend/game/rewardConfig/BigwinFormCell.vue b/web/src/views/backend/game/rewardConfig/BigwinFormCell.vue deleted file mode 100644 index 02f9bae..0000000 --- a/web/src/views/backend/game/rewardConfig/BigwinFormCell.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/web/src/views/backend/game/rewardConfig/TierRewardFormCell.vue b/web/src/views/backend/game/rewardConfig/TierRewardFormCell.vue deleted file mode 100644 index 55b2acb..0000000 --- a/web/src/views/backend/game/rewardConfig/TierRewardFormCell.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/web/src/views/backend/game/rewardConfig/index.vue b/web/src/views/backend/game/rewardConfig/index.vue index a2c4135..17007c5 100644 --- a/web/src/views/backend/game/rewardConfig/index.vue +++ b/web/src/views/backend/game/rewardConfig/index.vue @@ -1,141 +1,439 @@ - + diff --git a/web/src/views/backend/game/rewardConfig/popupForm.vue b/web/src/views/backend/game/rewardConfig/popupForm.vue deleted file mode 100644 index 1fd8fd5..0000000 --- a/web/src/views/backend/game/rewardConfig/popupForm.vue +++ /dev/null @@ -1,264 +0,0 @@ - - - - -