Compare commits
4 Commits
f8d5a5ffe9
...
master-gam
| Author | SHA1 | Date | |
|---|---|---|---|
| a12b6cf10f | |||
| c9d21d8216 | |||
| 6c94d03ddf | |||
| 938d0a60aa |
@@ -4,6 +4,7 @@ namespace app\admin\controller\game;
|
|||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
|
use app\common\library\GameRewardConfigTemplate;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
use Webman\Http\Request as WebmanRequest;
|
use Webman\Http\Request as WebmanRequest;
|
||||||
@@ -229,6 +230,7 @@ class Channel extends Backend
|
|||||||
if ($this->isPositiveChannelId($newChannelId)) {
|
if ($this->isPositiveChannelId($newChannelId)) {
|
||||||
try {
|
try {
|
||||||
$this->copyGameConfigFromChannelZero($newChannelId);
|
$this->copyGameConfigFromChannelZero($newChannelId);
|
||||||
|
$this->copyRewardConfigFromTemplate($newChannelId);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
return $this->error(__('Game channel copy default config failed') . ': ' . $e->getMessage());
|
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
|
* @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
|
private function copyGameConfigFromChannelZero(int|string $newChannelId): void
|
||||||
{
|
{
|
||||||
$exists = Db::name('game_config')->where('channel_id', $newChannelId)->count();
|
$exists = Db::name('game_config')->where('channel_id', $newChannelId)->count();
|
||||||
|
|||||||
@@ -1,183 +1,277 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace app\admin\controller\game;
|
namespace app\admin\controller\game;
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
|
use app\common\library\GameRewardConfigTemplate;
|
||||||
|
use app\common\library\GameRewardTierBoardGenerator;
|
||||||
|
use app\common\library\GameRewardWeightSeeder;
|
||||||
|
use app\common\model\GameRewardConfig;
|
||||||
|
use app\common\validate\GameRewardConfig as GameRewardConfigValidate;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
use Webman\Http\Request as WebmanRequest;
|
use Webman\Http\Request as WebmanRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 游戏奖励配置
|
* 游戏奖励配置(渠道表单页,路由 /admin/game/rewardConfig)
|
||||||
|
* 约定:game_channel_id = 0 为超管维护的「全渠道默认模板」,新建渠道时优先从此行复制到新渠道
|
||||||
*/
|
*/
|
||||||
class RewardConfig extends Backend
|
class RewardConfig extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/** 默认模板渠道主键(非真实渠道,仅存库一行) */
|
||||||
* GameRewardConfig模型对象
|
private const DEFAULT_TEMPLATE_CHANNEL_ID = 0;
|
||||||
* @var object|null
|
|
||||||
* @phpstan-var \app\common\model\GameRewardConfig|null
|
|
||||||
*/
|
|
||||||
protected ?object $model = null;
|
|
||||||
|
|
||||||
/**
|
public function index(WebmanRequest $request): Response
|
||||||
* 数据范围:非超管仅本人 + 下级管理员负责的渠道
|
|
||||||
*/
|
|
||||||
protected bool|string|int $dataLimit = 'parent';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表/删除按渠道字段限制(实际值为渠道 ID)
|
|
||||||
*/
|
|
||||||
protected string $dataLimitField = 'game_channel_id';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表无 admin_id,勿自动写入
|
|
||||||
*/
|
|
||||||
protected bool $dataLimitFieldAutoFill = false;
|
|
||||||
|
|
||||||
protected array|string $preExcludeFields = ['id', 'create_time', 'update_time'];
|
|
||||||
|
|
||||||
protected array $withJoinTable = ['gameChannel'];
|
|
||||||
|
|
||||||
protected string|array $quickSearchField = ['id'];
|
|
||||||
|
|
||||||
protected function initController(WebmanRequest $request): ?Response
|
|
||||||
{
|
{
|
||||||
$this->model = new \app\common\model\GameRewardConfig();
|
$response = $this->initializeBackend($request);
|
||||||
return null;
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
[$channelId, $err] = $this->resolveTargetChannelId($request, false);
|
||||||
* 将可访问管理员 ID 转换为可访问渠道 ID
|
if ($err !== null) {
|
||||||
*
|
return $err;
|
||||||
* @return list<int|string>
|
}
|
||||||
*/
|
|
||||||
protected function getDataLimitAdminIds(): array
|
$row = GameRewardConfig::where('game_channel_id', $channelId)->find();
|
||||||
|
if ($row) {
|
||||||
|
return $this->success('', [
|
||||||
|
'row' => $row->toArray(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaults = GameRewardConfigTemplate::getDefaultJsonColumns();
|
||||||
|
|
||||||
|
return $this->success('', [
|
||||||
|
'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
|
||||||
{
|
{
|
||||||
if (!$this->dataLimit || !$this->auth || $this->auth->isSuperAdmin()) {
|
$response = $this->initializeBackend($request);
|
||||||
return [];
|
if ($response !== null) {
|
||||||
}
|
return $response;
|
||||||
$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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if ($request->method() !== 'POST') {
|
||||||
* 新增:非超管仅可写入权限内渠道
|
return $this->error(__('Parameter error'));
|
||||||
* @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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
$data = $request->post();
|
||||||
* 编辑:非超管锁定渠道,不允许跨渠道改写
|
|
||||||
* @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'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$dataLimitAdminIds = $this->getDataLimitAdminIds();
|
|
||||||
if ($dataLimitAdminIds && !in_array($row[$this->dataLimitField], $dataLimitAdminIds)) {
|
|
||||||
return $this->error(__('You have no permission'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->request && $this->request->method() === 'POST') {
|
|
||||||
$data = $this->request->post();
|
|
||||||
if (!$data) {
|
if (!$data) {
|
||||||
return $this->error(__('Parameter %s can not be empty', ['']));
|
return $this->error(__('Parameter %s can not be empty', ['']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->applyInputFilter($data);
|
[$channelId, $err] = $this->resolveTargetChannelId($request, true);
|
||||||
$data = $this->excludeFields($data);
|
if ($err !== null) {
|
||||||
|
return $err;
|
||||||
if (!$this->auth->isSuperAdmin()) {
|
}
|
||||||
$data[$this->dataLimitField] = $row[$this->dataLimitField];
|
|
||||||
|
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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = false;
|
|
||||||
$this->model->startTrans();
|
|
||||||
try {
|
try {
|
||||||
if ($this->modelValidate) {
|
$validate = new GameRewardConfigValidate();
|
||||||
$validate = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
$validate->scene('channel_form')->check([
|
||||||
if (class_exists($validate)) {
|
'tier_reward_form' => $tier,
|
||||||
$validate = new $validate();
|
'bigwin_form' => $big,
|
||||||
if ($this->modelSceneValidate) {
|
]);
|
||||||
$validate->scene('edit');
|
|
||||||
}
|
|
||||||
$data[$pk] = $row[$pk];
|
|
||||||
$validate->check($data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$result = $row->save($data);
|
|
||||||
$this->model->commit();
|
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->model->rollback();
|
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
if ($result !== false) {
|
|
||||||
return $this->success(__('Update successful'));
|
|
||||||
}
|
|
||||||
return $this->error(__('No rows updated'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->success('', ['row' => $row]);
|
$existing = GameRewardConfig::where('game_channel_id', $channelId)->find();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
try {
|
||||||
* 查看
|
if ($existing) {
|
||||||
* @throws Throwable
|
$existing->save([
|
||||||
*/
|
'tier_reward_form' => $tier,
|
||||||
protected function _index(): Response
|
'bigwin_form' => $big,
|
||||||
{
|
]);
|
||||||
// 如果是 select 则转发到 select 方法,若未重写该方法,其实还是继续执行 index
|
} else {
|
||||||
if ($this->request && $this->request->get('select')) {
|
$m = new GameRewardConfig();
|
||||||
return $this->select($this->request);
|
$m->save([
|
||||||
}
|
'game_channel_id' => $channelId,
|
||||||
|
'tier_reward_form' => $tier,
|
||||||
/**
|
'bigwin_form' => $big,
|
||||||
* 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);
|
|
||||||
|
|
||||||
return $this->success('', [
|
|
||||||
'list' => $res->items(),
|
|
||||||
'total' => $res->total(),
|
|
||||||
'remark' => get_route_remark(),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success(__('Update successful'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写
|
* 按条数与结算标准生成 26 格档位奖励并保存(保留当前 bigwin_form)
|
||||||
*/
|
*/
|
||||||
|
public function generateTierBoard(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 || !is_array($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'));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$out = GameRewardTierBoardGenerator::generate($data);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$tier = $out['tier_reward_form'];
|
||||||
|
$existing = GameRewardConfig::where('game_channel_id', $channelId)->find();
|
||||||
|
if ($existing && is_string($existing->bigwin_form) && trim($existing->bigwin_form) !== '') {
|
||||||
|
$big = $existing->bigwin_form;
|
||||||
|
} else {
|
||||||
|
$defaults = GameRewardConfigTemplate::getDefaultJsonColumns();
|
||||||
|
$big = $defaults['bigwin_form'];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$validate = new GameRewardConfigValidate();
|
||||||
|
$validate->scene('channel_form')->check([
|
||||||
|
'tier_reward_form' => $tier,
|
||||||
|
'bigwin_form' => $big,
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
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'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前档位奖励 JSON 生成 game_reward_weight(先清空该渠道再写入 52 条)
|
||||||
|
*/
|
||||||
|
public function generateRewardWeight(WebmanRequest $request): Response
|
||||||
|
{
|
||||||
|
$response = $this->initializeBackend($request);
|
||||||
|
if ($response !== null) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->method() !== 'POST') {
|
||||||
|
return $this->error(__('Parameter error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
[$channelId, $err] = $this->resolveTargetChannelId($request, true);
|
||||||
|
if ($err !== null) {
|
||||||
|
return $err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->channelExists($channelId)) {
|
||||||
|
return $this->error(__('Record not found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = GameRewardConfig::where('game_channel_id', $channelId)->find();
|
||||||
|
if (!$row || !is_string($row->tier_reward_form) || trim($row->tier_reward_form) === '') {
|
||||||
|
return $this->error('请先保存档位奖励配置');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
GameRewardWeightSeeder::syncFromTierRewardForm($channelId, $row->tier_reward_form);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success(__('Update successful'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{0: int, 1: Response|null}
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
70
app/admin/controller/game/RewardWeight.php
Normal file
70
app/admin/controller/game/RewardWeight.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\game;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
use support\Response;
|
||||||
|
use Webman\Http\Request as WebmanRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏奖励权重配置
|
||||||
|
*/
|
||||||
|
class RewardWeight extends Backend
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* GameRewardWeight模型对象
|
||||||
|
* @var object|null
|
||||||
|
* @phpstan-var \app\common\model\GameRewardWeight|null
|
||||||
|
*/
|
||||||
|
protected ?object $model = null;
|
||||||
|
|
||||||
|
protected array|string $preExcludeFields = ['id', 'create_time', 'update_time'];
|
||||||
|
|
||||||
|
protected array $withJoinTable = ['gameChannel'];
|
||||||
|
|
||||||
|
protected string|array $quickSearchField = ['id'];
|
||||||
|
|
||||||
|
protected function initController(WebmanRequest $request): ?Response
|
||||||
|
{
|
||||||
|
$this->model = new \app\common\model\GameRewardWeight();
|
||||||
|
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']])
|
||||||
|
->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 中对应的方法至此进行重写
|
||||||
|
*/
|
||||||
|
}
|
||||||
55
app/common/library/GameRewardConfigTemplate.php
Normal file
55
app/common/library/GameRewardConfigTemplate.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\common\library;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏奖励配置:默认模板(与 resource/game_reward_config_template.json 一致)
|
||||||
|
*/
|
||||||
|
class GameRewardConfigTemplate
|
||||||
|
{
|
||||||
|
private static ?array $cached = null;
|
||||||
|
|
||||||
|
public static function templatePath(): string
|
||||||
|
{
|
||||||
|
return dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR . 'game_reward_config_template.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{tier_reward_form: string, bigwin_form: string}
|
||||||
|
*/
|
||||||
|
public static function getDefaultJsonColumns(): array
|
||||||
|
{
|
||||||
|
if (self::$cached !== null) {
|
||||||
|
return self::$cached;
|
||||||
|
}
|
||||||
|
$path = self::templatePath();
|
||||||
|
if (!is_file($path)) {
|
||||||
|
throw new \RuntimeException('game_reward_config_template.json missing: ' . $path);
|
||||||
|
}
|
||||||
|
$raw = file_get_contents($path);
|
||||||
|
if ($raw === false || trim($raw) === '') {
|
||||||
|
throw new \RuntimeException('game_reward_config_template.json read failed');
|
||||||
|
}
|
||||||
|
$decoded = json_decode($raw, true);
|
||||||
|
if (!is_array($decoded)) {
|
||||||
|
throw new \RuntimeException('game_reward_config_template.json invalid JSON');
|
||||||
|
}
|
||||||
|
$tier = $decoded['tier_reward_form'] ?? null;
|
||||||
|
$big = $decoded['bigwin_form'] ?? null;
|
||||||
|
if (!is_array($tier) || !is_array($big)) {
|
||||||
|
throw new \RuntimeException('game_reward_config_template.json missing tier_reward_form or bigwin_form');
|
||||||
|
}
|
||||||
|
$tierJson = json_encode($tier, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
$bigJson = json_encode($big, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
if (!is_string($tierJson) || !is_string($bigJson)) {
|
||||||
|
throw new \RuntimeException('game_reward_config_template encode failed');
|
||||||
|
}
|
||||||
|
self::$cached = [
|
||||||
|
'tier_reward_form' => $tierJson,
|
||||||
|
'bigwin_form' => $bigJson,
|
||||||
|
];
|
||||||
|
return self::$cached;
|
||||||
|
}
|
||||||
|
}
|
||||||
273
app/common/library/GameRewardTierBoardGenerator.php
Normal file
273
app/common/library/GameRewardTierBoardGenerator.php
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\common\library;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按「顺/逆时针摇点落格」条数约束生成 26 格档位盘面(写入 tier_reward_form JSON)
|
||||||
|
*/
|
||||||
|
final class GameRewardTierBoardGenerator
|
||||||
|
{
|
||||||
|
private const LEOPARD = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
|
private static function landingCw(int $d): int
|
||||||
|
{
|
||||||
|
$start = $d - 5;
|
||||||
|
|
||||||
|
return ($start + $d) % 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 图二:逆时针 end = start − D,若小于 0 则 26 + start − D */
|
||||||
|
private static function landingCcw(int $d): int
|
||||||
|
{
|
||||||
|
$start = $d - 5;
|
||||||
|
$x = $start - $d;
|
||||||
|
|
||||||
|
return $x >= 0 ? $x : 26 + $start - $d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 豹子点数:该次摇取顺、逆落点档位不能为 T4、T5
|
||||||
|
*
|
||||||
|
* @param list<string> $tier
|
||||||
|
*/
|
||||||
|
private static function leopardOk(array $tier): bool
|
||||||
|
{
|
||||||
|
foreach (self::LEOPARD as $d) {
|
||||||
|
foreach ([self::landingCw($d), self::landingCcw($d)] as $idx) {
|
||||||
|
$t = $tier[$idx];
|
||||||
|
if ($t === 'T4' || $t === 'T5') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $params
|
||||||
|
* @return array{tier_reward_form: string}
|
||||||
|
*/
|
||||||
|
public static function generate(array $params): array
|
||||||
|
{
|
||||||
|
$t1Cw = self::intParam($params, 't1_fixed_cw');
|
||||||
|
$t1Ccw = self::intParam($params, 't1_fixed_ccw');
|
||||||
|
$t2MinCw = self::intParam($params, 't2_min_cw');
|
||||||
|
$t2MinCcw = self::intParam($params, 't2_min_ccw');
|
||||||
|
$t4Cw = self::intParam($params, 't4_fixed_cw');
|
||||||
|
$t4Ccw = self::intParam($params, 't4_fixed_ccw');
|
||||||
|
$t5Cw = self::intParam($params, 't5_fixed_cw');
|
||||||
|
$t5Ccw = self::intParam($params, 't5_fixed_ccw');
|
||||||
|
|
||||||
|
$amt1 = self::numParam($params, 'amt_t1');
|
||||||
|
$amt2 = self::numParam($params, 'amt_t2');
|
||||||
|
$amt3 = self::numParam($params, 'amt_t3');
|
||||||
|
$amt4 = self::numParam($params, 'amt_t4');
|
||||||
|
|
||||||
|
$bestTier = null;
|
||||||
|
$bestScore = INF;
|
||||||
|
|
||||||
|
for ($attempt = 0; $attempt < 32; $attempt++) {
|
||||||
|
$tier = self::randomInitialTier($attempt);
|
||||||
|
$temp = 5.0;
|
||||||
|
for ($step = 0; $step < 8000; $step++) {
|
||||||
|
$score = self::score($tier, $t1Cw, $t1Ccw, $t2MinCw, $t2MinCcw, $t4Cw, $t4Ccw, $t5Cw, $t5Ccw);
|
||||||
|
if ($score < $bestScore) {
|
||||||
|
$bestScore = $score;
|
||||||
|
$bestTier = $tier;
|
||||||
|
}
|
||||||
|
$i = mt_rand(0, 25);
|
||||||
|
$j = mt_rand(0, 25);
|
||||||
|
if ($i === $j) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$oldI = $tier[$i];
|
||||||
|
$oldJ = $tier[$j];
|
||||||
|
$tier[$i] = $oldJ;
|
||||||
|
$tier[$j] = $oldI;
|
||||||
|
if (!self::leopardOk($tier)) {
|
||||||
|
$tier[$i] = $oldI;
|
||||||
|
$tier[$j] = $oldJ;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$newScore = self::score($tier, $t1Cw, $t1Ccw, $t2MinCw, $t2MinCcw, $t4Cw, $t4Ccw, $t5Cw, $t5Ccw);
|
||||||
|
$delta = $newScore - $score;
|
||||||
|
$u = mt_rand() / max(1, mt_getrandmax());
|
||||||
|
if ($delta < 0 || ($temp > 0.02 && exp(-$delta / $temp) > $u)) {
|
||||||
|
// keep
|
||||||
|
} else {
|
||||||
|
$tier[$i] = $oldI;
|
||||||
|
$tier[$j] = $oldJ;
|
||||||
|
}
|
||||||
|
$temp *= 0.999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bestTier === null || $bestScore > 45) {
|
||||||
|
throw new \RuntimeException('无法在豹子与条数约束下收敛盘面,请调整条数后重试');
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = self::buildJson($bestTier, $amt1, $amt2, $amt3, $amt4);
|
||||||
|
|
||||||
|
return ['tier_reward_form' => $json];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return list<string> */
|
||||||
|
private static function randomInitialTier(int $seedBias): array
|
||||||
|
{
|
||||||
|
mt_srand((int) (microtime(true) * 1000000) + $seedBias * 10007);
|
||||||
|
$tier = [];
|
||||||
|
for ($p = 0; $p < 26; $p++) {
|
||||||
|
$tier[$p] = ['T1', 'T2', 'T3'][mt_rand(0, 2)];
|
||||||
|
}
|
||||||
|
if (!self::leopardOk($tier)) {
|
||||||
|
for ($p = 0; $p < 26; $p++) {
|
||||||
|
$tier[$p] = 'T3';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $tier
|
||||||
|
*/
|
||||||
|
private static function score(
|
||||||
|
array $tier,
|
||||||
|
int $t1Cw,
|
||||||
|
int $t1Ccw,
|
||||||
|
int $t2MinCw,
|
||||||
|
int $t2MinCcw,
|
||||||
|
int $t4Cw,
|
||||||
|
int $t4Ccw,
|
||||||
|
int $t5Cw,
|
||||||
|
int $t5Ccw
|
||||||
|
): float {
|
||||||
|
if (!self::leopardOk($tier)) {
|
||||||
|
return 1e9;
|
||||||
|
}
|
||||||
|
$h = self::histogram($tier);
|
||||||
|
$s = 0.0;
|
||||||
|
$s += ($h['cw']['T1'] - $t1Cw) ** 2;
|
||||||
|
$s += ($h['ccw']['T1'] - $t1Ccw) ** 2;
|
||||||
|
$s += max(0, $t2MinCw - $h['cw']['T2']) ** 2 * 8;
|
||||||
|
$s += max(0, $t2MinCcw - $h['ccw']['T2']) ** 2 * 8;
|
||||||
|
$s += ($h['cw']['T4'] - $t4Cw) ** 2;
|
||||||
|
$s += ($h['ccw']['T4'] - $t4Ccw) ** 2;
|
||||||
|
$s += ($h['cw']['T5'] - $t5Cw) ** 2;
|
||||||
|
$s += ($h['ccw']['T5'] - $t5Ccw) ** 2;
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $tier
|
||||||
|
* @return array{cw: array<string, int>, ccw: array<string, int>}
|
||||||
|
*/
|
||||||
|
private static function histogram(array $tier): array
|
||||||
|
{
|
||||||
|
$cw = ['T1' => 0, 'T2' => 0, 'T3' => 0, 'T4' => 0, 'T5' => 0];
|
||||||
|
$ccw = ['T1' => 0, 'T2' => 0, 'T3' => 0, 'T4' => 0, 'T5' => 0];
|
||||||
|
for ($d = 5; $d <= 30; $d++) {
|
||||||
|
$cw[$tier[self::landingCw($d)]]++;
|
||||||
|
$ccw[$tier[self::landingCcw($d)]]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['cw' => $cw, 'ccw' => $ccw];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<string> $tier
|
||||||
|
*/
|
||||||
|
private static function remarkForTier(string $t, float $amt2): string
|
||||||
|
{
|
||||||
|
if ($t === 'T1') {
|
||||||
|
return '大奖';
|
||||||
|
}
|
||||||
|
if ($t === 'T2') {
|
||||||
|
return $amt2 < 100 ? '完美回本' : '小赚';
|
||||||
|
}
|
||||||
|
if ($t === 'T3') {
|
||||||
|
return '抽水';
|
||||||
|
}
|
||||||
|
if ($t === 'T4') {
|
||||||
|
return '惩罚';
|
||||||
|
}
|
||||||
|
if ($t === 'T5') {
|
||||||
|
return '再来一次';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function buildJson(array $tier, float $amt1, float $amt2, float $amt3, float $amt4): string
|
||||||
|
{
|
||||||
|
$rows = [];
|
||||||
|
for ($i = 0; $i < 26; $i++) {
|
||||||
|
$t = $tier[$i];
|
||||||
|
if ($t === 'T5') {
|
||||||
|
$ui = '再来一次';
|
||||||
|
$uiEn = 'Once again';
|
||||||
|
$ev = '0';
|
||||||
|
} else {
|
||||||
|
$a = match ($t) {
|
||||||
|
'T1' => $amt1,
|
||||||
|
'T2' => $amt2,
|
||||||
|
'T3' => $amt3,
|
||||||
|
'T4' => $amt4,
|
||||||
|
default => $amt3,
|
||||||
|
};
|
||||||
|
$ui = self::fmtMoney($a);
|
||||||
|
$uiEn = self::fmtMoney($a);
|
||||||
|
$ev = self::fmtMoney($a);
|
||||||
|
}
|
||||||
|
$rows[] = [
|
||||||
|
'grid_number' => strval(5 + $i),
|
||||||
|
'ui_text' => $ui,
|
||||||
|
'ui_text_en' => $uiEn,
|
||||||
|
'real_ev' => $ev,
|
||||||
|
'tier' => $t,
|
||||||
|
'remark' => self::remarkForTier($t, $amt2),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($rows, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function fmtMoney(float $v): string
|
||||||
|
{
|
||||||
|
if (abs($v - round($v)) < 0.000001) {
|
||||||
|
return strval((int) round($v));
|
||||||
|
}
|
||||||
|
|
||||||
|
return rtrim(rtrim(sprintf('%.4f', $v), '0'), '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function intParam(array $params, string $key): int
|
||||||
|
{
|
||||||
|
$v = $params[$key] ?? 0;
|
||||||
|
if (is_string($v) && trim($v) === '') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!is_numeric($v)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return intval(strval($v));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function numParam(array $params, string $key): float
|
||||||
|
{
|
||||||
|
$v = $params[$key] ?? 0;
|
||||||
|
if (is_string($v) && trim($v) === '') {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
if (!is_numeric($v)) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return floatval(strval($v));
|
||||||
|
}
|
||||||
|
}
|
||||||
172
app/common/library/GameRewardWeightSeeder.php
Normal file
172
app/common/library/GameRewardWeightSeeder.php
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\common\library;
|
||||||
|
|
||||||
|
use support\think\Db;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据档位奖励 JSON 生成 game_reward_weight 对照(先删后插)
|
||||||
|
*/
|
||||||
|
final class GameRewardWeightSeeder
|
||||||
|
{
|
||||||
|
private const LEOPARD = [5, 10, 15, 20, 25, 30];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public static function syncFromTierRewardForm(int $gameChannelId, string $tierRewardFormJson): void
|
||||||
|
{
|
||||||
|
$decoded = json_decode($tierRewardFormJson, true);
|
||||||
|
if (!is_array($decoded) || count($decoded) !== 26) {
|
||||||
|
throw new \RuntimeException('档位奖励表单必须为 26 条且为合法 JSON');
|
||||||
|
}
|
||||||
|
|
||||||
|
$byGrid = [];
|
||||||
|
foreach ($decoded as $idx => $row) {
|
||||||
|
if (!is_array($row)) {
|
||||||
|
throw new \RuntimeException('档位奖励表单第' . strval($idx + 1) . '条格式错误');
|
||||||
|
}
|
||||||
|
$g = $row['grid_number'] ?? null;
|
||||||
|
if (!is_numeric($g)) {
|
||||||
|
throw new \RuntimeException('档位奖励表单第' . strval($idx + 1) . '条点数无效');
|
||||||
|
}
|
||||||
|
$gi = intval(strval($g));
|
||||||
|
if ($gi < 5 || $gi > 30) {
|
||||||
|
throw new \RuntimeException('档位奖励表单点数须在 5~30');
|
||||||
|
}
|
||||||
|
$byGrid[$gi] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cells = [];
|
||||||
|
for ($i = 0; $i < 26; $i++) {
|
||||||
|
$g = 5 + $i;
|
||||||
|
if (!isset($byGrid[$g])) {
|
||||||
|
throw new \RuntimeException('档位奖励表单缺少点数 ' . strval($g));
|
||||||
|
}
|
||||||
|
$cells[$i] = self::normalizeCell($byGrid[$g], $i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::assertLeopardOk($cells);
|
||||||
|
|
||||||
|
$batch = [];
|
||||||
|
for ($d = 5; $d <= 30; $d++) {
|
||||||
|
$start = $d - 5;
|
||||||
|
$endCw = ($start + $d) % 26;
|
||||||
|
$x = $start - $d;
|
||||||
|
$endCcw = $x >= 0 ? $x : 26 + $start - $d;
|
||||||
|
$batch[] = self::buildInsertRow($gameChannelId, 0, $d, $start, $endCw, $cells[$endCw]);
|
||||||
|
$batch[] = self::buildInsertRow($gameChannelId, 1, $d, $start, $endCcw, $cells[$endCcw]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = time();
|
||||||
|
foreach ($batch as $k => $_) {
|
||||||
|
$batch[$k]['create_time'] = $now;
|
||||||
|
$batch[$k]['update_time'] = $now;
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
Db::name('game_reward_weight')->where('game_channel_id', $gameChannelId)->delete();
|
||||||
|
Db::name('game_reward_weight')->insertAll($batch);
|
||||||
|
Db::commit();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$msg = $e->getMessage();
|
||||||
|
if (str_contains($msg, 'game_reward_weight') || str_contains($msg, "doesn't exist")) {
|
||||||
|
throw new \RuntimeException('写入失败:请确认已创建数据表 game_reward_weight 并已执行迁移。' . $msg);
|
||||||
|
}
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<array{ui_text: string, real_ev: float, tier: string, remark: string}> $cells
|
||||||
|
*/
|
||||||
|
private static function assertLeopardOk(array $cells): void
|
||||||
|
{
|
||||||
|
foreach (self::LEOPARD as $d) {
|
||||||
|
$start = $d - 5;
|
||||||
|
$endCw = ($start + $d) % 26;
|
||||||
|
$x = $start - $d;
|
||||||
|
$endCcw = $x >= 0 ? $x : 26 + $start - $d;
|
||||||
|
foreach ([$endCw, $endCcw] as $idx) {
|
||||||
|
$t = $cells[$idx]['tier'];
|
||||||
|
if ($t === 'T4' || $t === 'T5') {
|
||||||
|
throw new \RuntimeException(
|
||||||
|
'豹子点数 ' . strval($d) . ' 的落点不能为 T4/T5,请先在档位表中调整后再生成权重对照'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $row
|
||||||
|
* @return array{ui_text: string, real_ev: float, tier: string, remark: string}
|
||||||
|
*/
|
||||||
|
private static function normalizeCell(array $row, int $rowNo): array
|
||||||
|
{
|
||||||
|
$ui = $row['ui_text'] ?? null;
|
||||||
|
$ev = $row['real_ev'] ?? null;
|
||||||
|
$tier = $row['tier'] ?? null;
|
||||||
|
if (!is_string($ui) || trim($ui) === '') {
|
||||||
|
throw new \RuntimeException('档位奖励表单第' . strval($rowNo) . '条显示文本不能为空');
|
||||||
|
}
|
||||||
|
if ($ev === null || $ev === '' || !is_numeric($ev)) {
|
||||||
|
throw new \RuntimeException('档位奖励表单第' . strval($rowNo) . '条实际中奖无效');
|
||||||
|
}
|
||||||
|
if (!is_string($tier) || !in_array($tier, ['T1', 'T2', 'T3', 'T4', 'T5'], true)) {
|
||||||
|
throw new \RuntimeException('档位奖励表单第' . strval($rowNo) . '条档位无效');
|
||||||
|
}
|
||||||
|
$remark = $row['remark'] ?? '';
|
||||||
|
$remarkStr = is_string($remark) ? $remark : '';
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ui_text' => $ui,
|
||||||
|
'real_ev' => floatval(strval($ev)),
|
||||||
|
'tier' => $tier,
|
||||||
|
'remark' => $remarkStr,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{ui_text: string, real_ev: float, tier: string, remark: string} $cell
|
||||||
|
* @return array<string, int|float|string>
|
||||||
|
*/
|
||||||
|
private static function buildInsertRow(
|
||||||
|
int $gameChannelId,
|
||||||
|
int $direction,
|
||||||
|
int $gridNumber,
|
||||||
|
int $startIndex,
|
||||||
|
int $endIndex,
|
||||||
|
array $cell
|
||||||
|
): array {
|
||||||
|
return [
|
||||||
|
'game_channel_id' => $gameChannelId,
|
||||||
|
'direction' => $direction,
|
||||||
|
'grid_number' => $gridNumber,
|
||||||
|
'start_index' => $startIndex,
|
||||||
|
'end_index' => $endIndex,
|
||||||
|
'ui_text' => $cell['ui_text'],
|
||||||
|
'real_ev' => $cell['real_ev'],
|
||||||
|
'tier' => $cell['tier'],
|
||||||
|
'type' => self::tierToType($cell['tier']),
|
||||||
|
'remark' => $cell['remark'],
|
||||||
|
'weight' => 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function tierToType(string $tier): int
|
||||||
|
{
|
||||||
|
return match ($tier) {
|
||||||
|
'T1' => 3,
|
||||||
|
'T2' => 2,
|
||||||
|
'T3' => -1,
|
||||||
|
'T4' => -2,
|
||||||
|
'T5' => 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,12 +11,15 @@ use Exception;
|
|||||||
*/
|
*/
|
||||||
class TokenExpirationException extends Exception
|
class TokenExpirationException extends Exception
|
||||||
{
|
{
|
||||||
|
protected array $data = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $message = '',
|
string $message = '',
|
||||||
protected int $code = 409,
|
int $code = 409,
|
||||||
protected array $data = [],
|
array $data = [],
|
||||||
?\Throwable $previous = null
|
?\Throwable $previous = null
|
||||||
) {
|
) {
|
||||||
|
$this->data = $data;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
29
app/common/model/GameRewardWeight.php
Normal file
29
app/common/model/GameRewardWeight.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\think\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GameRewardWeight
|
||||||
|
*/
|
||||||
|
class GameRewardWeight extends Model
|
||||||
|
{
|
||||||
|
// 表名
|
||||||
|
protected $name = 'game_reward_weight';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = true;
|
||||||
|
|
||||||
|
// 字段类型转换
|
||||||
|
protected $type = [
|
||||||
|
'create_time' => 'integer',
|
||||||
|
'update_time' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function gameChannel(): \think\model\relation\BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\app\common\model\GameChannel::class, 'game_channel_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,8 @@ class GameRewardConfig extends Validate
|
|||||||
protected $scene = [
|
protected $scene = [
|
||||||
'add' => ['game_channel_id', 'tier_reward_form', 'bigwin_form'],
|
'add' => ['game_channel_id', 'tier_reward_form', 'bigwin_form'],
|
||||||
'edit' => ['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
|
private function parseJsonArray(mixed $value, string $label): array|string
|
||||||
|
|||||||
31
app/common/validate/GameRewardWeight.php
Normal file
31
app/common/validate/GameRewardWeight.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class GameRewardWeight extends Validate
|
||||||
|
{
|
||||||
|
protected $failException = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证规则
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
protected $message = [
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证场景
|
||||||
|
*/
|
||||||
|
protected $scene = [
|
||||||
|
'add' => [],
|
||||||
|
'edit' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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 (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 (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 (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 (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,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 (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 (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 (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);
|
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 (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 (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 (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 (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,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 (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);
|
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 '创建时间',
|
`create_time` bigint(16) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
INDEX `pid`(`pid` ASC) 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
|
-- 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 (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 (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 (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
|
-- 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 '数据库连接配置标识',
|
`connection` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '数据库连接配置标识',
|
||||||
`create_time` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
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
|
-- Records of crud_log
|
||||||
|
|||||||
38
resource/game_reward_config_template.json
Normal file
38
resource/game_reward_config_template.json
Normal file
@@ -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"}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -11,4 +11,6 @@ export default {
|
|||||||
[adminBaseRoutePath + '/user/rule']: ['./backend/${lang}/auth/rule.ts'],
|
[adminBaseRoutePath + '/user/rule']: ['./backend/${lang}/auth/rule.ts'],
|
||||||
[adminBaseRoutePath + '/user/scoreLog']: ['./backend/${lang}/user/moneyLog.ts'],
|
[adminBaseRoutePath + '/user/scoreLog']: ['./backend/${lang}/user/moneyLog.ts'],
|
||||||
[adminBaseRoutePath + '/crud/crud']: ['./backend/${lang}/crud/log.ts', './backend/${lang}/crud/state.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'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export default {
|
|||||||
update_time: 'update_time',
|
update_time: 'update_time',
|
||||||
grid_number: 'grid_number',
|
grid_number: 'grid_number',
|
||||||
ui_text: 'ui_text',
|
ui_text: 'ui_text',
|
||||||
|
ui_text_en: 'ui_text (EN)',
|
||||||
|
remark: 'remark',
|
||||||
real_ev: 'real_ev',
|
real_ev: 'real_ev',
|
||||||
tier: 'tier',
|
tier: 'tier',
|
||||||
tier_t1: 'T1',
|
tier_t1: 'T1',
|
||||||
@@ -16,7 +18,8 @@ export default {
|
|||||||
tier_t4: 'T4',
|
tier_t4: 'T4',
|
||||||
tier_t5: 'T5',
|
tier_t5: 'T5',
|
||||||
tier_bigwin: 'BIGWIN',
|
tier_bigwin: 'BIGWIN',
|
||||||
tier_reward_form_help: 'Fixed 26 rows (5-30), no add/delete. Editable: ui_text, real_ev, tier.',
|
tier_reward_form_help:
|
||||||
|
'Fixed 26 rows (5-30), no add/delete. Editable: ui_text, ui_text_en, real_ev, tier, remark.',
|
||||||
bigwin_form_help: 'Fixed 6 rows (5,10,15,20,25,30), no add/delete. Editable: ui_text, real_ev.',
|
bigwin_form_help: 'Fixed 6 rows (5,10,15,20,25,30), no add/delete. Editable: ui_text, real_ev.',
|
||||||
'quick Search Fields': 'id',
|
'quick Search Fields': 'id',
|
||||||
}
|
}
|
||||||
|
|||||||
46
web/src/lang/backend/en/game/rewardConfigForm.ts
Normal file
46
web/src/lang/backend/en/game/rewardConfigForm.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
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',
|
||||||
|
btn_gen_tier: 'Generate tier board',
|
||||||
|
btn_gen_weight: 'Generate reward weight table',
|
||||||
|
gen_tier_title: 'Generate reward index by rules',
|
||||||
|
gen_tier_rule:
|
||||||
|
'[Same logic as reward comparison]\n' +
|
||||||
|
'• 26 cells id 0–25; grid_number 5–30 unique.\n' +
|
||||||
|
'• Roll D: start_index = id where grid_number=D; CW end=(start+D)%26; CCW end=start−D, if <0 then +26.\n' +
|
||||||
|
'• Comparison rows use D as dice points; tier/settlement/copy from landing cell.\n\n' +
|
||||||
|
'[Leopard rolls]\n' +
|
||||||
|
'For D in 5,10,15,20,25,30, CW/CCW landing tier cannot be T4/T5.\n\n' +
|
||||||
|
'[Settlement vs tier]\n' +
|
||||||
|
'<0→T4; 0–100→T3; 100–200→T2; >200→T1; T5 amount 0. Below you set per-tier amounts; T1–T4 zh/en display text = amount string; T5 fixed.\n\n' +
|
||||||
|
'[Inputs]\n' +
|
||||||
|
'Counts: T1/T4/T5 fixed per direction; T2 minimum per direction.',
|
||||||
|
gen_tier_footer_hint: 'T2 is a lower bound; if generation fails, relax counts. You can still edit the table after.',
|
||||||
|
gen_tier_cancel: 'Cancel',
|
||||||
|
gen_tier_submit: 'Generate and save',
|
||||||
|
gen_t1_label: 'T1 grand prize',
|
||||||
|
gen_t1_fixed: 'Fixed count (CW/CCW)',
|
||||||
|
gen_t2_label: 'T2 small profit / break-even',
|
||||||
|
gen_t2_min: 'Minimum count',
|
||||||
|
gen_t3_label: 'T3 commission',
|
||||||
|
gen_t3_amt_only: 'Settlement amount',
|
||||||
|
gen_t4_label: 'T4 penalty',
|
||||||
|
gen_t4_fixed: 'Fixed count (CW/CCW)',
|
||||||
|
gen_t5_label: 'T5 try again',
|
||||||
|
gen_t5_fixed: 'Fixed count (CW/CCW)',
|
||||||
|
gen_settlement: 'Settlement amount',
|
||||||
|
gen_dir_cw: 'Clockwise',
|
||||||
|
gen_dir_ccw: 'Counter-clockwise',
|
||||||
|
gen_weight_confirm_title: 'Create reward comparison',
|
||||||
|
gen_weight_confirm_body:
|
||||||
|
'Rules: start_index = id of the cell whose grid_number equals roll D; CW end_index=(start_index+D)%26; CCW end_index = start_index−D if ≥0 else 26+start_index−D. Existing rows for this channel in game_reward_weight will be deleted, then 52 rows created (D=5..30 × two directions). Tier, settlement, display text and remark come from the landing cell in the tier table. Continue?',
|
||||||
|
gen_weight_confirm_ok: 'Confirm',
|
||||||
|
gen_weight_need_channel: 'Select a channel and refresh before generating weights.',
|
||||||
|
}
|
||||||
26
web/src/lang/backend/en/game/rewardWeight.ts
Normal file
26
web/src/lang/backend/en/game/rewardWeight.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
game_channel_id: 'game_channel_id',
|
||||||
|
gamechannel__name: 'name',
|
||||||
|
direction: 'direction',
|
||||||
|
'direction 0': 'direction 0',
|
||||||
|
'direction 1': 'direction 1',
|
||||||
|
grid_number: 'grid_number',
|
||||||
|
start_index: 'start_index',
|
||||||
|
end_index: 'end_index',
|
||||||
|
ui_text: 'ui_text',
|
||||||
|
real_ev: 'real_ev',
|
||||||
|
tier: 'tier',
|
||||||
|
type: 'type',
|
||||||
|
'type -2': 'type -2',
|
||||||
|
'type -1': 'type -1',
|
||||||
|
'type 0': 'type 0',
|
||||||
|
'type 1': 'type 1',
|
||||||
|
'type 2': 'type 2',
|
||||||
|
'type 3': 'type 3',
|
||||||
|
remark: 'remark',
|
||||||
|
weight: 'weight',
|
||||||
|
create_time: 'create_time',
|
||||||
|
update_time: 'update_time',
|
||||||
|
'quick Search Fields': 'id',
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@ export default {
|
|||||||
update_time: '更新时间',
|
update_time: '更新时间',
|
||||||
grid_number: '色子点数',
|
grid_number: '色子点数',
|
||||||
ui_text: '显示文本',
|
ui_text: '显示文本',
|
||||||
|
ui_text_en: '显示文本(en)',
|
||||||
|
remark: '备注',
|
||||||
real_ev: '实际中奖',
|
real_ev: '实际中奖',
|
||||||
tier: '档位',
|
tier: '档位',
|
||||||
tier_t1: 'T1',
|
tier_t1: 'T1',
|
||||||
@@ -16,7 +18,8 @@ export default {
|
|||||||
tier_t4: 'T4',
|
tier_t4: 'T4',
|
||||||
tier_t5: 'T5',
|
tier_t5: 'T5',
|
||||||
tier_bigwin: 'BIGWIN',
|
tier_bigwin: 'BIGWIN',
|
||||||
tier_reward_form_help: '固定 26 条(点数 5-30),不可新增或删除,仅可修改显示文本、实际中奖、档位',
|
tier_reward_form_help:
|
||||||
|
'固定 26 条(点数 5-30),不可新增或删除;可修改显示文本、英文显示、实际中奖、档位与备注(生成器会预填英文与备注)',
|
||||||
bigwin_form_help: '固定 6 条(点数 5、10、15、20、25、30),不可新增或删除,仅可修改显示文本、实际中奖',
|
bigwin_form_help: '固定 6 条(点数 5、10、15、20、25、30),不可新增或删除,仅可修改显示文本、实际中奖',
|
||||||
'quick Search Fields': 'ID',
|
'quick Search Fields': 'ID',
|
||||||
}
|
}
|
||||||
|
|||||||
48
web/src/lang/backend/zh-cn/game/rewardConfigForm.ts
Normal file
48
web/src/lang/backend/zh-cn/game/rewardConfigForm.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
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: '重置',
|
||||||
|
btn_gen_tier: '生成游戏奖励配置',
|
||||||
|
btn_gen_weight: '生成游戏奖励权重配置',
|
||||||
|
gen_tier_title: '按规则生成奖励索引',
|
||||||
|
gen_tier_rule:
|
||||||
|
'【生成逻辑(与创建奖励对照一致)】\n' +
|
||||||
|
'• 盘面 26 格按 id 升序为位置 0~25;每条配置的 grid_number 为 5~30 且不重复。\n' +
|
||||||
|
'• 摇取点数 D(5~30):起点为「grid_number=D」所在格位的 id(start_index),顺时针落点 = (起点 + D) mod 26,逆时针落点 = 起点 − D(若小于 0 则 +26)。\n' +
|
||||||
|
'• 对照表每条记录的「色子点数」列为 D;档位、真实结算、显示文案取自落点格位对应 id 的配置。\n\n' +
|
||||||
|
'【豹子摇取点数】\n' +
|
||||||
|
'摇取点数为 5、10、15、20、25、30 时,其顺/逆时针落点档位不能为 T4、T5。\n\n' +
|
||||||
|
'【结算金额与档位】\n' +
|
||||||
|
'结算金额 < 0 → T4;0 < 结算金额 < 100 → T3;100 < 结算金额 < 200 → T2;200 < 结算金额 → T1;T5 结算金额=0。\n' +
|
||||||
|
'下方填写各档位统一结算金额标准;T1~T4 的中/英文显示文本将等于该金额字符串;T5 固定「再来一次」/「Once again」。\n\n' +
|
||||||
|
'【本弹窗输入】\n' +
|
||||||
|
'条数:T1/T4/T5 为顺时针与逆时针各自的固定条数;T2 为顺时针与逆时针各自「不少于」的条数。生成后仍可在主表中微调。',
|
||||||
|
gen_tier_footer_hint:
|
||||||
|
'T1/T4/T5 为精确条数,T2 为下限;生成失败时请放宽条数或稍后再试。生成后可在上方表格中继续修改。',
|
||||||
|
gen_tier_cancel: '取消',
|
||||||
|
gen_tier_submit: '生成并保存',
|
||||||
|
gen_t1_label: 'T1 大奖',
|
||||||
|
gen_t1_fixed: '固定条数(顺/逆)',
|
||||||
|
gen_t2_label: 'T2 小赚/回本',
|
||||||
|
gen_t2_min: '最少条数',
|
||||||
|
gen_t3_label: 'T3 抽水',
|
||||||
|
gen_t3_amt_only: '结算金额',
|
||||||
|
gen_t4_label: 'T4 惩罚',
|
||||||
|
gen_t4_fixed: '固定条数(顺/逆)',
|
||||||
|
gen_t5_label: 'T5 再来一次',
|
||||||
|
gen_t5_fixed: '固定条数(顺/逆)',
|
||||||
|
gen_settlement: '结算金额',
|
||||||
|
gen_dir_cw: '顺时针',
|
||||||
|
gen_dir_ccw: '逆时针',
|
||||||
|
gen_weight_confirm_title: '创建奖励对照',
|
||||||
|
gen_weight_confirm_body:
|
||||||
|
'按规则创建奖励对照:起始索引 start_index 为奖励配置中 grid_number 与摇取点数 D 相同的那一格的 id;顺时针 end_index=(start_index+摇取点数)%26;逆时针 end_index=start_index−摇取点数,若≥0 则取该值,否则 26+start_index−摇取点数。将先清空该渠道 game_reward_weight 表中现有数据,再为 5~30 共 26 个点数、顺/逆时针各生成一条(共 52 条)。档位、真实结算、显示文案、备注取自落点格位在档位表中的配置。是否继续?',
|
||||||
|
gen_weight_confirm_ok: '确定创建',
|
||||||
|
gen_weight_need_channel: '请先选择具体渠道并刷新后再生成权重对照。',
|
||||||
|
}
|
||||||
26
web/src/lang/backend/zh-cn/game/rewardWeight.ts
Normal file
26
web/src/lang/backend/zh-cn/game/rewardWeight.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
game_channel_id: '渠道',
|
||||||
|
gamechannel__name: '渠道名',
|
||||||
|
direction: '方向',
|
||||||
|
'direction 0': '顺时针',
|
||||||
|
'direction 1': '逆时针',
|
||||||
|
grid_number: '点数',
|
||||||
|
start_index: '起始索引',
|
||||||
|
end_index: '结束索引',
|
||||||
|
ui_text: '显示文本',
|
||||||
|
real_ev: '实际中奖金额',
|
||||||
|
tier: '档位',
|
||||||
|
type: '奖励类型',
|
||||||
|
'type -2': '唯一惩罚',
|
||||||
|
'type -1': '抽水',
|
||||||
|
'type 0': '回本',
|
||||||
|
'type 1': '再来一次',
|
||||||
|
'type 2': '小赚',
|
||||||
|
'type 3': '大奖格',
|
||||||
|
remark: '备注',
|
||||||
|
weight: '权重',
|
||||||
|
create_time: '创建时间',
|
||||||
|
update_time: '修改时间',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form-cell">
|
|
||||||
<div v-if="rows.length === 0" class="empty">-</div>
|
|
||||||
<div v-for="(row, idx) in rows" :key="idx" class="row">
|
|
||||||
<el-tag size="small" effect="light">{{ row.grid_number }}</el-tag>
|
|
||||||
<el-tag size="small" type="danger" effect="light">{{ row.tier }}</el-tag>
|
|
||||||
<span>{{ row.ui_text }}</span>
|
|
||||||
<span>{{ row.real_ev }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps<{ row?: { bigwin_form?: unknown } }>()
|
|
||||||
|
|
||||||
type FormRow = { grid_number: string; ui_text: string; real_ev: string; tier: string }
|
|
||||||
|
|
||||||
const rows = computed<FormRow[]>(() => {
|
|
||||||
const raw = props.row?.bigwin_form
|
|
||||||
if (typeof raw !== 'string' || raw.trim() === '') return []
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(raw) as unknown
|
|
||||||
if (!Array.isArray(parsed)) return []
|
|
||||||
const out: FormRow[] = []
|
|
||||||
for (const item of parsed) {
|
|
||||||
if (item === null || typeof item !== 'object' || Array.isArray(item)) continue
|
|
||||||
const obj = item as Record<string, unknown>
|
|
||||||
out.push({
|
|
||||||
grid_number: String(obj.grid_number ?? ''),
|
|
||||||
ui_text: String(obj.ui_text ?? ''),
|
|
||||||
real_ev: String(obj.real_ev ?? ''),
|
|
||||||
tier: String(obj.tier ?? ''),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
} catch {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.form-cell {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
.row {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.empty {
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form-cell">
|
|
||||||
<div v-if="rows.length === 0" class="empty">-</div>
|
|
||||||
<div v-for="(row, idx) in rows" :key="idx" class="row">
|
|
||||||
<el-tag size="small" effect="light">{{ row.grid_number }}</el-tag>
|
|
||||||
<el-tag size="small" type="info" effect="light">{{ row.tier }}</el-tag>
|
|
||||||
<span>{{ row.ui_text }}</span>
|
|
||||||
<span>{{ row.real_ev }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
const props = defineProps<{ row?: { tier_reward_form?: unknown } }>()
|
|
||||||
|
|
||||||
type FormRow = { grid_number: string; ui_text: string; real_ev: string; tier: string }
|
|
||||||
|
|
||||||
const rows = computed<FormRow[]>(() => {
|
|
||||||
const raw = props.row?.tier_reward_form
|
|
||||||
if (typeof raw !== 'string' || raw.trim() === '') return []
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(raw) as unknown
|
|
||||||
if (!Array.isArray(parsed)) return []
|
|
||||||
const out: FormRow[] = []
|
|
||||||
for (const item of parsed) {
|
|
||||||
if (item === null || typeof item !== 'object' || Array.isArray(item)) continue
|
|
||||||
const obj = item as Record<string, unknown>
|
|
||||||
out.push({
|
|
||||||
grid_number: String(obj.grid_number ?? ''),
|
|
||||||
ui_text: String(obj.ui_text ?? ''),
|
|
||||||
real_ev: String(obj.real_ev ?? ''),
|
|
||||||
tier: String(obj.tier ?? ''),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
} catch {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.form-cell {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
.row {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.empty {
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,141 +1,892 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main ba-table-box">
|
<div class="default-main ba-table-box">
|
||||||
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
<el-card shadow="never" class="reward-form-card" v-loading="pageLoading">
|
||||||
|
<template #header>
|
||||||
|
<span class="card-title">{{ t('game.rewardConfigForm.title') }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 表格顶部菜单 -->
|
<el-alert
|
||||||
<!-- 自定义按钮请使用插槽,甚至公共搜索也可以使用具名插槽渲染,参见文档 -->
|
v-if="showTemplateIntro"
|
||||||
<TableHeader
|
class="intro-alert"
|
||||||
:buttons="headerButtons"
|
type="info"
|
||||||
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.rewardConfig.quick Search Fields') })"
|
:closable="false"
|
||||||
></TableHeader>
|
show-icon
|
||||||
|
>
|
||||||
|
<template #title>{{ t('game.rewardConfigForm.intro') }}</template>
|
||||||
|
</el-alert>
|
||||||
|
|
||||||
<!-- 表格 -->
|
<el-form
|
||||||
<!-- 表格列有多种自定义渲染方式,比如自定义组件、具名插槽等,参见文档 -->
|
ref="formRef"
|
||||||
<!-- 要使用 el-table 组件原有的属性,直接加在 Table 标签上即可 -->
|
class="reward-form-body"
|
||||||
<Table ref="tableRef"></Table>
|
@submit.prevent=""
|
||||||
|
:model="formModel"
|
||||||
|
:label-position="config.layout.shrink ? 'top' : 'right'"
|
||||||
|
:label-width="formLabelWidth + 'px'"
|
||||||
|
:rules="rules"
|
||||||
|
>
|
||||||
|
<template v-if="isSuperAdmin">
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.super_scope_label')">
|
||||||
|
<el-radio-group v-model="superEditScope" @change="onSuperScopeChange">
|
||||||
|
<el-radio-button value="template">{{ t('game.rewardConfigForm.super_scope_template') }}</el-radio-button>
|
||||||
|
<el-radio-button value="channel">{{ t('game.rewardConfigForm.super_scope_channel') }}</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-alert
|
||||||
|
v-if="superEditScope === 'channel'"
|
||||||
|
class="scope-hint"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
:title="t('game.rewardConfigForm.super_scope_hint')"
|
||||||
|
/>
|
||||||
|
<div v-if="superEditScope === 'channel'" class="channel-bar">
|
||||||
|
<div class="channel-picker">
|
||||||
|
<FormItem
|
||||||
|
:label="t('game.rewardConfig.game_channel_id')"
|
||||||
|
type="remoteSelect"
|
||||||
|
v-model="formModel.game_channel_id"
|
||||||
|
prop="game_channel_id"
|
||||||
|
:input-attr="channelRemoteAttr"
|
||||||
|
:placeholder="t('Please select field', { field: t('game.rewardConfig.game_channel_id') })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" @click="loadData" :disabled="!formModel.game_channel_id">{{ t('Refresh') }}</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 表单 -->
|
<template v-if="showInner">
|
||||||
<PopupForm />
|
<el-form-item :label="t('game.rewardConfig.tier_reward_form')" prop="tier_reward_form">
|
||||||
|
<div class="block-editor tier-editor">
|
||||||
|
<div class="line line-head">
|
||||||
|
<span>{{ t('game.rewardConfig.grid_number') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.ui_text') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.ui_text_en') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.real_ev') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.tier') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.remark') }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="(row, idx) in tierRows" :key="'tier-' + idx" class="line">
|
||||||
|
<el-input v-model="row.grid_number" disabled />
|
||||||
|
<el-input
|
||||||
|
v-model="row.ui_text"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.ui_text') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="row.ui_text_en"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.ui_text_en') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="row.real_ev"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.real_ev') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
<el-select v-model="row.tier" style="width: 100px" @change="syncPayload">
|
||||||
|
<el-option :label="t('game.rewardConfig.tier_t1')" value="T1" />
|
||||||
|
<el-option :label="t('game.rewardConfig.tier_t2')" value="T2" />
|
||||||
|
<el-option :label="t('game.rewardConfig.tier_t3')" value="T3" />
|
||||||
|
<el-option :label="t('game.rewardConfig.tier_t4')" value="T4" />
|
||||||
|
<el-option :label="t('game.rewardConfig.tier_t5')" value="T5" />
|
||||||
|
</el-select>
|
||||||
|
<el-input
|
||||||
|
v-model="row.remark"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.remark') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="form-help">{{ t('game.rewardConfig.tier_reward_form_help') }}</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item :label="t('game.rewardConfig.bigwin_form')" prop="bigwin_form">
|
||||||
|
<div class="block-editor bigwin-editor">
|
||||||
|
<div class="line line-head">
|
||||||
|
<span>{{ t('game.rewardConfig.grid_number') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.ui_text') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.real_ev') }}</span>
|
||||||
|
<span>{{ t('game.rewardConfig.tier') }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="(row, idx) in bigwinRows" :key="'bigwin-' + idx" class="line">
|
||||||
|
<el-input v-model="row.grid_number" disabled />
|
||||||
|
<el-input
|
||||||
|
v-model="row.ui_text"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.ui_text') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="row.real_ev"
|
||||||
|
:placeholder="t('Please input field', { field: t('game.rewardConfig.real_ev') })"
|
||||||
|
@input="syncPayload"
|
||||||
|
/>
|
||||||
|
<el-input v-model="row.tier" disabled style="width: 120px" />
|
||||||
|
</div>
|
||||||
|
<div class="form-help">{{ t('game.rewardConfig.bigwin_form_help') }}</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" :loading="submitLoading" @click="onSubmit">{{ t('game.rewardConfigForm.btn_add') }}</el-button>
|
||||||
|
<el-button @click="onReset">{{ t('game.rewardConfigForm.btn_reset') }}</el-button>
|
||||||
|
<el-button v-auth="'generateTierBoard'" @click="openGenTierDialog">{{ t('game.rewardConfigForm.btn_gen_tier') }}</el-button>
|
||||||
|
<el-button v-auth="'generateRewardWeight'" :loading="genWeightSubmitting" @click="onGenWeightClick">{{
|
||||||
|
t('game.rewardConfigForm.btn_gen_weight')
|
||||||
|
}}</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
v-model="genTierDialogVisible"
|
||||||
|
class="gen-tier-dialog"
|
||||||
|
:title="t('game.rewardConfigForm.gen_tier_title')"
|
||||||
|
:width="genTierDialogWidth"
|
||||||
|
:fullscreen="genTierDialogFullscreen"
|
||||||
|
:align-center="!genTierDialogFullscreen"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-scrollbar :max-height="genTierScrollMaxHeight" class="gen-tier-scroll">
|
||||||
|
<div class="gen-rule">{{ t('game.rewardConfigForm.gen_tier_rule') }}</div>
|
||||||
|
<el-form
|
||||||
|
:model="genTierForm"
|
||||||
|
class="gen-tier-form"
|
||||||
|
:label-position="genTierFormLabelPosition"
|
||||||
|
:label-width="genTierFormLabelWidth"
|
||||||
|
>
|
||||||
|
<div class="gen-tier-block">
|
||||||
|
<div class="gen-tier-block-title">{{ t('game.rewardConfigForm.gen_t1_label') }}</div>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t1_fixed') + '(' + t('game.rewardConfigForm.gen_dir_cw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t1_fixed_cw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t1_fixed') + '(' + t('game.rewardConfigForm.gen_dir_ccw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t1_fixed_ccw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_settlement')">
|
||||||
|
<el-input-number v-model="genTierForm.amt_t1" :min="0" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="gen-tier-block">
|
||||||
|
<div class="gen-tier-block-title">{{ t('game.rewardConfigForm.gen_t2_label') }}</div>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t2_min') + '(' + t('game.rewardConfigForm.gen_dir_cw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t2_min_cw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t2_min') + '(' + t('game.rewardConfigForm.gen_dir_ccw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t2_min_ccw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_settlement')">
|
||||||
|
<el-input-number v-model="genTierForm.amt_t2" :min="0" :precision="2" :step="0.1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="gen-tier-block">
|
||||||
|
<div class="gen-tier-block-title">{{ t('game.rewardConfigForm.gen_t3_label') }}</div>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t3_amt_only')">
|
||||||
|
<el-input-number v-model="genTierForm.amt_t3" :min="0" :precision="2" :step="0.1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="gen-tier-block">
|
||||||
|
<div class="gen-tier-block-title">{{ t('game.rewardConfigForm.gen_t4_label') }}</div>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t4_fixed') + '(' + t('game.rewardConfigForm.gen_dir_cw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t4_fixed_cw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t4_fixed') + '(' + t('game.rewardConfigForm.gen_dir_ccw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t4_fixed_ccw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_settlement')">
|
||||||
|
<el-input-number v-model="genTierForm.amt_t4" :precision="2" :step="0.1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="gen-tier-block">
|
||||||
|
<div class="gen-tier-block-title">{{ t('game.rewardConfigForm.gen_t5_label') }}</div>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t5_fixed') + '(' + t('game.rewardConfigForm.gen_dir_cw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t5_fixed_cw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_t5_fixed') + '(' + t('game.rewardConfigForm.gen_dir_ccw') + ')'">
|
||||||
|
<el-input-number v-model="genTierForm.t5_fixed_ccw" :min="0" :max="26" :step="1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="t('game.rewardConfigForm.gen_settlement')">
|
||||||
|
<el-input-number :model-value="0" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<div class="gen-tier-footer-hint">{{ t('game.rewardConfigForm.gen_tier_footer_hint') }}</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
<template #footer>
|
||||||
|
<div class="gen-tier-dialog-footer">
|
||||||
|
<el-button @click="genTierDialogVisible = false">{{ t('game.rewardConfigForm.gen_tier_cancel') }}</el-button>
|
||||||
|
<el-button v-auth="'generateTierBoard'" type="primary" :loading="genTierSubmitting" @click="onGenTierSubmit">{{
|
||||||
|
t('game.rewardConfigForm.gen_tier_submit')
|
||||||
|
}}</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, provide, useTemplateRef } from 'vue'
|
import type { FormInstance, FormItemRule } from 'element-plus'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { useWindowSize } from '@vueuse/core'
|
||||||
|
import { computed, onMounted, reactive, ref, useTemplateRef, watch } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import PopupForm from './popupForm.vue'
|
import FormItem from '/@/components/formItem/index.vue'
|
||||||
import TierRewardFormCell from './TierRewardFormCell.vue'
|
import { useConfig } from '/@/stores/config'
|
||||||
import BigwinFormCell from './BigwinFormCell.vue'
|
|
||||||
import { baTableApi } from '/@/api/common'
|
|
||||||
import { defaultOptButtons } from '/@/components/table'
|
|
||||||
import TableHeader from '/@/components/table/header/index.vue'
|
|
||||||
import Table from '/@/components/table/index.vue'
|
|
||||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||||
import baTableClass from '/@/utils/baTable'
|
import createAxios from '/@/utils/axios'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'game/rewardConfig',
|
name: 'game/rewardConfig',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { t } = useI18n()
|
type RewardRow = {
|
||||||
const tableRef = useTemplateRef('tableRef')
|
grid_number: string
|
||||||
const adminInfo = useAdminInfo()
|
ui_text: string
|
||||||
const isSuperAdmin = computed(() => adminInfo.super === true)
|
ui_text_en: string
|
||||||
const optButtons: OptButton[] = defaultOptButtons(['edit'])
|
real_ev: string
|
||||||
const superHeaderButtons: HeaderOptButton[] = ['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']
|
tier: string
|
||||||
const channelHeaderButtons: HeaderOptButton[] = ['refresh']
|
remark: string
|
||||||
const tierRewardFormColumn: TableColumn = {
|
|
||||||
label: t('game.rewardConfig.tier_reward_form'),
|
|
||||||
prop: 'tier_reward_form',
|
|
||||||
align: 'center',
|
|
||||||
minWidth: 360,
|
|
||||||
operatorPlaceholder: t('Fuzzy query'),
|
|
||||||
sortable: false,
|
|
||||||
operator: 'LIKE',
|
|
||||||
comSearchRender: 'string',
|
|
||||||
render: 'customRender',
|
|
||||||
customRender: TierRewardFormCell,
|
|
||||||
}
|
}
|
||||||
const bigwinFormColumn: TableColumn = {
|
|
||||||
label: t('game.rewardConfig.bigwin_form'),
|
|
||||||
prop: 'bigwin_form',
|
|
||||||
align: 'center',
|
|
||||||
minWidth: 360,
|
|
||||||
operatorPlaceholder: t('Fuzzy query'),
|
|
||||||
sortable: false,
|
|
||||||
operator: 'LIKE',
|
|
||||||
comSearchRender: 'string',
|
|
||||||
render: 'customRender',
|
|
||||||
customRender: BigwinFormCell,
|
|
||||||
}
|
|
||||||
const headerButtons = computed(() => {
|
|
||||||
if (isSuperAdmin.value) {
|
|
||||||
return superHeaderButtons
|
|
||||||
}
|
|
||||||
return channelHeaderButtons
|
|
||||||
})
|
|
||||||
const columns: TableColumn[] = [
|
|
||||||
{ type: 'selection', align: 'center', operator: false },
|
|
||||||
{ label: t('game.rewardConfig.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
|
||||||
{
|
|
||||||
label: t('game.rewardConfig.gamechannel__name'),
|
|
||||||
prop: 'gameChannel.name',
|
|
||||||
align: 'center',
|
|
||||||
operatorPlaceholder: t('Fuzzy query'),
|
|
||||||
render: 'tags',
|
|
||||||
operator: 'LIKE',
|
|
||||||
comSearchRender: 'string',
|
|
||||||
},
|
|
||||||
...(isSuperAdmin.value ? [] : [tierRewardFormColumn, bigwinFormColumn]),
|
|
||||||
{
|
|
||||||
label: t('game.rewardConfig.create_time'),
|
|
||||||
prop: 'create_time',
|
|
||||||
align: 'center',
|
|
||||||
render: 'datetime',
|
|
||||||
operator: 'RANGE',
|
|
||||||
comSearchRender: 'datetime',
|
|
||||||
sortable: 'custom',
|
|
||||||
width: 160,
|
|
||||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('game.rewardConfig.update_time'),
|
|
||||||
prop: 'update_time',
|
|
||||||
align: 'center',
|
|
||||||
render: 'datetime',
|
|
||||||
operator: 'RANGE',
|
|
||||||
comSearchRender: 'datetime',
|
|
||||||
sortable: 'custom',
|
|
||||||
width: 160,
|
|
||||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
|
||||||
},
|
|
||||||
{ label: t('Operate'), align: 'center', width: 100, render: 'buttons', buttons: optButtons, operator: false },
|
|
||||||
]
|
|
||||||
|
|
||||||
/**
|
const { t } = useI18n()
|
||||||
* baTable 内包含了表格的所有数据且数据具备响应性,然后通过 provide 注入给了后代组件
|
const config = useConfig()
|
||||||
*/
|
const adminInfo = useAdminInfo()
|
||||||
const baTable = new baTableClass(
|
const { width: windowWidth } = useWindowSize()
|
||||||
new baTableApi('/admin/game.RewardConfig/'),
|
|
||||||
{
|
/** 生成弹窗:窄屏全屏/宽百分比,宽屏固定最大宽度 */
|
||||||
pk: 'id',
|
const genTierDialogFullscreen = computed(() => windowWidth.value <= 520)
|
||||||
column: columns,
|
const genTierDialogWidth = computed(() => {
|
||||||
dblClickNotEditColumn: [undefined],
|
if (windowWidth.value <= 520) {
|
||||||
},
|
return '100%'
|
||||||
{
|
|
||||||
defaultItems: {},
|
|
||||||
}
|
}
|
||||||
|
if (windowWidth.value <= 768) {
|
||||||
|
return '92%'
|
||||||
|
}
|
||||||
|
return '720px'
|
||||||
|
})
|
||||||
|
|
||||||
|
const genTierFormLabelPosition = computed(() => (windowWidth.value < 640 ? 'top' : 'right'))
|
||||||
|
const genTierFormLabelWidth = computed(() => (windowWidth.value < 640 ? 'auto' : '150px'))
|
||||||
|
|
||||||
|
const genTierScrollMaxHeight = computed(() => (genTierDialogFullscreen.value ? 'calc(100vh - 140px)' : 'min(70vh, 640px)'))
|
||||||
|
const formRef = useTemplateRef<FormInstance>('formRef')
|
||||||
|
|
||||||
|
const TIER_GRIDS = Array.from({ length: 26 }, (_v, i) => String(i + 5))
|
||||||
|
const BIGWIN_GRIDS = ['5', '10', '15', '20', '25', '30']
|
||||||
|
|
||||||
|
const isSuperAdmin = computed(() => adminInfo.super === true)
|
||||||
|
const formLabelWidth = computed(() => (config.layout.shrink ? 100 : 140))
|
||||||
|
const channelRemoteAttr = { pk: 'game_channel.id', field: 'name', remoteUrl: '/admin/game.Channel/index' }
|
||||||
|
|
||||||
|
const pageLoading = ref(false)
|
||||||
|
const submitLoading = ref(false)
|
||||||
|
const genTierDialogVisible = ref(false)
|
||||||
|
const genTierSubmitting = ref(false)
|
||||||
|
const genWeightSubmitting = ref(false)
|
||||||
|
const channelChangeSilent = ref(false)
|
||||||
|
const lastAutoLoadChannelId = ref<number | null>(null)
|
||||||
|
|
||||||
|
const genTierForm = reactive({
|
||||||
|
t1_fixed_cw: 3,
|
||||||
|
t1_fixed_ccw: 3,
|
||||||
|
t2_min_cw: 5,
|
||||||
|
t2_min_ccw: 5,
|
||||||
|
t4_fixed_cw: 1,
|
||||||
|
t4_fixed_ccw: 1,
|
||||||
|
t5_fixed_cw: 1,
|
||||||
|
t5_fixed_ccw: 1,
|
||||||
|
amt_t1: 3,
|
||||||
|
amt_t2: 1.5,
|
||||||
|
amt_t3: 0.5,
|
||||||
|
amt_t4: -0.4,
|
||||||
|
})
|
||||||
|
/** 超管:template = game_channel_id 0 默认模板;channel = 编辑指定渠道 */
|
||||||
|
const superEditScope = ref<'template' | 'channel'>('template')
|
||||||
|
/** 仅超管维护「全渠道默认模板」(game_channel_id=0、未绑定具体渠道)时展示顶部说明;渠道管理员或超管选「指定渠道」时不展示 */
|
||||||
|
const showTemplateIntro = computed(() => isSuperAdmin.value && superEditScope.value === 'template')
|
||||||
|
|
||||||
|
const formModel = reactive({
|
||||||
|
id: null as number | string | null,
|
||||||
|
game_channel_id: 0 as number | string,
|
||||||
|
tier_reward_form: '',
|
||||||
|
bigwin_form: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const tierRows = ref<RewardRow[]>(
|
||||||
|
TIER_GRIDS.map((g) => ({ grid_number: g, ui_text: '', ui_text_en: '', real_ev: '', tier: 'T1', remark: '' }))
|
||||||
|
)
|
||||||
|
const bigwinRows = ref<RewardRow[]>(
|
||||||
|
BIGWIN_GRIDS.map((g) => ({ grid_number: g, ui_text: '', ui_text_en: '', real_ev: '', tier: 'BIGWIN', remark: '' }))
|
||||||
)
|
)
|
||||||
|
|
||||||
provide('baTable', baTable)
|
const showInner = computed(() => {
|
||||||
|
if (!isSuperAdmin.value) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (superEditScope.value === 'template') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return !!formModel.game_channel_id
|
||||||
|
})
|
||||||
|
|
||||||
|
function parseRows(raw: unknown): RewardRow[] {
|
||||||
|
if (typeof raw !== 'string' || raw.trim() === '') return []
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(raw) as unknown
|
||||||
|
if (!Array.isArray(parsed)) return []
|
||||||
|
const out: RewardRow[] = []
|
||||||
|
for (const item of parsed) {
|
||||||
|
if (item === null || typeof item !== 'object' || Array.isArray(item)) continue
|
||||||
|
const obj = item as Record<string, unknown>
|
||||||
|
out.push({
|
||||||
|
grid_number: String(obj.grid_number ?? ''),
|
||||||
|
ui_text: String(obj.ui_text ?? ''),
|
||||||
|
ui_text_en: String(obj.ui_text_en ?? ''),
|
||||||
|
real_ev: String(obj.real_ev ?? ''),
|
||||||
|
tier: String(obj.tier ?? ''),
|
||||||
|
remark: String(obj.remark ?? ''),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toTierRows(raw: unknown): RewardRow[] {
|
||||||
|
const parsed = parseRows(raw)
|
||||||
|
const map = new Map<string, RewardRow>()
|
||||||
|
for (const r of parsed) map.set(r.grid_number, r)
|
||||||
|
return TIER_GRIDS.map((g) => {
|
||||||
|
const row = map.get(g)
|
||||||
|
return {
|
||||||
|
grid_number: g,
|
||||||
|
ui_text: row?.ui_text ?? '',
|
||||||
|
ui_text_en: row?.ui_text_en ?? '',
|
||||||
|
real_ev: row?.real_ev ?? '',
|
||||||
|
tier: row?.tier && row.tier !== 'BIGWIN' ? row.tier : 'T1',
|
||||||
|
remark: row?.remark ?? '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function toBigwinRows(raw: unknown): RewardRow[] {
|
||||||
|
const parsed = parseRows(raw)
|
||||||
|
const map = new Map<string, RewardRow>()
|
||||||
|
for (const r of parsed) map.set(r.grid_number, r)
|
||||||
|
return BIGWIN_GRIDS.map((g) => {
|
||||||
|
const row = map.get(g)
|
||||||
|
return {
|
||||||
|
grid_number: g,
|
||||||
|
ui_text: row?.ui_text ?? '',
|
||||||
|
ui_text_en: row?.ui_text_en ?? '',
|
||||||
|
real_ev: row?.real_ev ?? '',
|
||||||
|
tier: 'BIGWIN',
|
||||||
|
remark: row?.remark ?? '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncPayload() {
|
||||||
|
formModel.tier_reward_form = JSON.stringify(tierRows.value)
|
||||||
|
formModel.bigwin_form = JSON.stringify(bigwinRows.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyRowToForm(row: Record<string, unknown>) {
|
||||||
|
channelChangeSilent.value = true
|
||||||
|
formModel.id = (row.id as number | string | null | undefined) ?? null
|
||||||
|
formModel.game_channel_id = (row.game_channel_id as number | string) ?? 0
|
||||||
|
tierRows.value = toTierRows(row.tier_reward_form)
|
||||||
|
bigwinRows.value = toBigwinRows(row.bigwin_form)
|
||||||
|
syncPayload()
|
||||||
|
channelChangeSilent.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateForms(): string | undefined {
|
||||||
|
if (tierRows.value.length !== 26 || bigwinRows.value.length !== 6) {
|
||||||
|
return t('Parameter error')
|
||||||
|
}
|
||||||
|
for (let i = 0; i < tierRows.value.length; i++) {
|
||||||
|
const row = tierRows.value[i]
|
||||||
|
if (row.grid_number !== TIER_GRIDS[i]) return t('Parameter error')
|
||||||
|
if (row.ui_text.trim() === '' || row.real_ev.trim() === '') return t('Please input field', { field: t('game.rewardConfig.ui_text') })
|
||||||
|
if (!Number.isFinite(Number(row.real_ev))) return t('game.rewardConfig.real_ev')
|
||||||
|
if (!['T1', 'T2', 'T3', 'T4', 'T5'].includes(row.tier)) return t('Parameter error')
|
||||||
|
}
|
||||||
|
for (let i = 0; i < bigwinRows.value.length; i++) {
|
||||||
|
const row = bigwinRows.value[i]
|
||||||
|
if (row.grid_number !== BIGWIN_GRIDS[i]) return t('Parameter error')
|
||||||
|
if (row.tier !== 'BIGWIN') return t('Parameter error')
|
||||||
|
if (row.ui_text.trim() === '' || row.real_ev.trim() === '') return t('Please input field', { field: t('game.rewardConfig.ui_text') })
|
||||||
|
if (!Number.isFinite(Number(row.real_ev))) return t('game.rewardConfig.real_ev')
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||||
|
game_channel_id: [
|
||||||
|
{
|
||||||
|
validator: (_rule, _val, callback) => {
|
||||||
|
if (!isSuperAdmin.value || superEditScope.value !== 'channel') {
|
||||||
|
callback()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!_val && _val !== 0) {
|
||||||
|
callback(new Error(t('Please select field', { field: t('game.rewardConfig.game_channel_id') })))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (_val === 0 || _val === '0') {
|
||||||
|
callback(new Error(t('Please select field', { field: t('game.rewardConfig.game_channel_id') })))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
},
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
tier_reward_form: [
|
||||||
|
{
|
||||||
|
validator: (_rule, _val, callback) => {
|
||||||
|
const err = validateForms()
|
||||||
|
if (err) return callback(new Error(err))
|
||||||
|
callback()
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
bigwin_form: [
|
||||||
|
{
|
||||||
|
validator: (_rule, _val, callback) => {
|
||||||
|
const err = validateForms()
|
||||||
|
if (err) return callback(new Error(err))
|
||||||
|
callback()
|
||||||
|
},
|
||||||
|
trigger: ['blur', 'change'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
function resolveRequestChannelId(): number | null {
|
||||||
|
if (!isSuperAdmin.value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (superEditScope.value === 'template') {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
const v = formModel.game_channel_id
|
||||||
|
if (!v && v !== 0) return null
|
||||||
|
const n = Number(v)
|
||||||
|
if (!Number.isFinite(n) || n <= 0) return null
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadData() {
|
||||||
|
if (isSuperAdmin.value && superEditScope.value === 'channel' && !formModel.game_channel_id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pageLoading.value = true
|
||||||
|
try {
|
||||||
|
const params: Record<string, number> = {}
|
||||||
|
const cid = resolveRequestChannelId()
|
||||||
|
if (cid !== null) {
|
||||||
|
params.game_channel_id = cid
|
||||||
|
}
|
||||||
|
const res = await createAxios<{ row?: Record<string, unknown> }>(
|
||||||
|
{
|
||||||
|
url: '/admin/game.RewardConfig/index',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{ showErrorMessage: true, loading: false }
|
||||||
|
)
|
||||||
|
const row = res.data?.row
|
||||||
|
if (row && typeof row === 'object' && !Array.isArray(row)) {
|
||||||
|
applyRowToForm(row as Record<string, unknown>)
|
||||||
|
}
|
||||||
|
} catch (error: unknown) {
|
||||||
|
const err = error as { code?: string; message?: string }
|
||||||
|
if (err.code === 'ERR_CANCELED' || String(err.message ?? '').toLowerCase().includes('canceled')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
pageLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSuperScopeChange(val: string | number | boolean | undefined) {
|
||||||
|
if (val === 'template') {
|
||||||
|
formModel.game_channel_id = 0
|
||||||
|
loadData()
|
||||||
|
} else {
|
||||||
|
formModel.game_channel_id = ''
|
||||||
|
lastAutoLoadChannelId.value = null
|
||||||
|
formRef.value?.clearValidate(['game_channel_id'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSubmit() {
|
||||||
|
const form = formRef.value
|
||||||
|
if (!form) return
|
||||||
|
syncPayload()
|
||||||
|
await form.validate(async (valid) => {
|
||||||
|
if (!valid) return
|
||||||
|
submitLoading.value = true
|
||||||
|
try {
|
||||||
|
const body: Record<string, string | number> = {
|
||||||
|
tier_reward_form: formModel.tier_reward_form,
|
||||||
|
bigwin_form: formModel.bigwin_form,
|
||||||
|
}
|
||||||
|
const cid = resolveRequestChannelId()
|
||||||
|
if (cid !== null) {
|
||||||
|
body.game_channel_id = cid
|
||||||
|
}
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/game.RewardConfig/save',
|
||||||
|
method: 'post',
|
||||||
|
data: body,
|
||||||
|
},
|
||||||
|
{ showSuccessMessage: true, loading: false }
|
||||||
|
)
|
||||||
|
await loadData()
|
||||||
|
} finally {
|
||||||
|
submitLoading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onReset() {
|
||||||
|
formRef.value?.clearValidate()
|
||||||
|
await loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function openGenTierDialog() {
|
||||||
|
genTierDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onGenTierSubmit() {
|
||||||
|
genTierSubmitting.value = true
|
||||||
|
try {
|
||||||
|
const body: Record<string, string | number> = {
|
||||||
|
t1_fixed_cw: genTierForm.t1_fixed_cw,
|
||||||
|
t1_fixed_ccw: genTierForm.t1_fixed_ccw,
|
||||||
|
t2_min_cw: genTierForm.t2_min_cw,
|
||||||
|
t2_min_ccw: genTierForm.t2_min_ccw,
|
||||||
|
t4_fixed_cw: genTierForm.t4_fixed_cw,
|
||||||
|
t4_fixed_ccw: genTierForm.t4_fixed_ccw,
|
||||||
|
t5_fixed_cw: genTierForm.t5_fixed_cw,
|
||||||
|
t5_fixed_ccw: genTierForm.t5_fixed_ccw,
|
||||||
|
amt_t1: genTierForm.amt_t1,
|
||||||
|
amt_t2: genTierForm.amt_t2,
|
||||||
|
amt_t3: genTierForm.amt_t3,
|
||||||
|
amt_t4: genTierForm.amt_t4,
|
||||||
|
}
|
||||||
|
const cid = resolveRequestChannelId()
|
||||||
|
if (cid !== null) {
|
||||||
|
body.game_channel_id = cid
|
||||||
|
}
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/game.RewardConfig/generateTierBoard',
|
||||||
|
method: 'post',
|
||||||
|
data: body,
|
||||||
|
},
|
||||||
|
{ showSuccessMessage: true, loading: false }
|
||||||
|
)
|
||||||
|
genTierDialogVisible.value = false
|
||||||
|
await loadData()
|
||||||
|
} finally {
|
||||||
|
genTierSubmitting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onGenWeightClick() {
|
||||||
|
if (isSuperAdmin.value && superEditScope.value === 'channel' && !formModel.game_channel_id) {
|
||||||
|
ElMessage.warning(t('game.rewardConfigForm.gen_weight_need_channel'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
t('game.rewardConfigForm.gen_weight_confirm_body'),
|
||||||
|
t('game.rewardConfigForm.gen_weight_confirm_title'),
|
||||||
|
{
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: t('game.rewardConfigForm.gen_weight_confirm_ok'),
|
||||||
|
cancelButtonText: t('Cancel'),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
genWeightSubmitting.value = true
|
||||||
|
try {
|
||||||
|
const body: Record<string, number> = {}
|
||||||
|
const cid = resolveRequestChannelId()
|
||||||
|
if (cid !== null) {
|
||||||
|
body.game_channel_id = cid
|
||||||
|
}
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/game.RewardConfig/generateRewardWeight',
|
||||||
|
method: 'post',
|
||||||
|
data: body,
|
||||||
|
},
|
||||||
|
{ showSuccessMessage: true, loading: false }
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
genWeightSubmitting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
baTable.table.ref = tableRef.value
|
if (isSuperAdmin.value) {
|
||||||
baTable.mount()
|
superEditScope.value = 'template'
|
||||||
baTable.getData()?.then(() => {
|
formModel.game_channel_id = 0
|
||||||
baTable.initSort()
|
loadData()
|
||||||
baTable.dragSort()
|
} else {
|
||||||
})
|
loadData()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => formModel.game_channel_id,
|
||||||
|
(val, oldVal) => {
|
||||||
|
if (!isSuperAdmin.value || superEditScope.value !== 'channel') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (channelChangeSilent.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const nextCid = Number(val)
|
||||||
|
const prevCid = Number(oldVal)
|
||||||
|
if (Number.isFinite(nextCid) && Number.isFinite(prevCid) && nextCid === prevCid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!Number.isFinite(nextCid) || nextCid <= 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (lastAutoLoadChannelId.value === nextCid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
lastAutoLoadChannelId.value = nextCid
|
||||||
|
void loadData()
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss">
|
||||||
|
.reward-form-card {
|
||||||
|
max-width: 1280px;
|
||||||
|
}
|
||||||
|
.card-title {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.intro-alert {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.scope-hint {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.channel-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.channel-picker {
|
||||||
|
flex: 1 1 360px;
|
||||||
|
min-width: 320px;
|
||||||
|
max-width: 520px;
|
||||||
|
}
|
||||||
|
.channel-picker :deep(.el-form-item) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.channel-picker :deep(.el-select) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.reward-form-body {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.block-editor {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.tier-editor .line {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 64px minmax(88px, 1fr) minmax(88px, 1fr) minmax(88px, 1fr) minmax(96px, 110px) minmax(124px, 1fr);
|
||||||
|
column-gap: 10px;
|
||||||
|
row-gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.bigwin-editor .line {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 110px 1fr 1fr 120px;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.line-head {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.form-help {
|
||||||
|
margin-top: 6px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.reward-form-card :deep(.el-card__body) {
|
||||||
|
padding: 12px 10px;
|
||||||
|
}
|
||||||
|
.reward-form-body :deep(.el-form-item) {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.channel-picker {
|
||||||
|
min-width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.channel-bar {
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.channel-bar > .el-button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 移动端主配置表:保持列宽,允许左右滚动,避免被压扁 */
|
||||||
|
.tier-editor,
|
||||||
|
.bigwin-editor {
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
.tier-editor .line {
|
||||||
|
min-width: 820px;
|
||||||
|
grid-template-columns: 48px 80px 80px 80px 100px 130px;
|
||||||
|
column-gap: 10px;
|
||||||
|
row-gap: 8px;
|
||||||
|
}
|
||||||
|
.bigwin-editor .line {
|
||||||
|
min-width: 560px;
|
||||||
|
grid-template-columns: 48px 80px 80px 100px;
|
||||||
|
}
|
||||||
|
.line-head {
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reward-form-body :deep(.el-form-item:last-child .el-form-item__content) {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.reward-form-body :deep(.el-form-item:last-child .el-button) {
|
||||||
|
flex: 1 1 calc(50% - 8px);
|
||||||
|
min-width: 128px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- 弹窗 append-to-body 后不在当前组件 DOM 内,scoped 样式无法作用,单独写全局选择器 -->
|
||||||
|
<style lang="scss">
|
||||||
|
.gen-tier-dialog.el-dialog {
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 100vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .el-dialog__header {
|
||||||
|
padding: 12px 14px;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .el-dialog__body {
|
||||||
|
padding: 8px 12px 12px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .el-dialog__footer {
|
||||||
|
padding: 10px 12px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-scroll {
|
||||||
|
padding-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-rule {
|
||||||
|
white-space: pre-line;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
max-width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: var(--el-fill-color-light);
|
||||||
|
padding: 12px 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.55;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-block {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-block:last-of-type {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-block-title {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-form .el-form-item {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-form.el-form--label-top .el-form-item__label {
|
||||||
|
line-height: 1.4;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
height: auto;
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-form .el-input-number {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-footer-hint {
|
||||||
|
margin-top: 4px;
|
||||||
|
padding: 0 2px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gen-tier-dialog .gen-tier-dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 639px) {
|
||||||
|
.gen-tier-dialog .gen-tier-form .el-input-number {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,264 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog
|
|
||||||
class="ba-operate-dialog"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
:model-value="['Add', 'Edit'].includes(baTable.form.operate!)"
|
|
||||||
@close="baTable.toggleForm"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">
|
|
||||||
{{ baTable.form.operate ? t(baTable.form.operate) : '' }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
|
|
||||||
<div
|
|
||||||
class="ba-operate-form"
|
|
||||||
:class="'ba-' + baTable.form.operate + '-form'"
|
|
||||||
:style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
v-if="!baTable.form.loading"
|
|
||||||
ref="formRef"
|
|
||||||
@submit.prevent=""
|
|
||||||
:model="baTable.form.items"
|
|
||||||
:label-position="config.layout.shrink ? 'top' : 'right'"
|
|
||||||
:label-width="baTable.form.labelWidth + 'px'"
|
|
||||||
:rules="rules"
|
|
||||||
>
|
|
||||||
<FormItem
|
|
||||||
:label="t('game.rewardConfig.game_channel_id')"
|
|
||||||
type="remoteSelect"
|
|
||||||
v-model="baTable.form.items!.game_channel_id"
|
|
||||||
prop="game_channel_id"
|
|
||||||
:input-attr="{ ...channelRemoteAttr, disabled: channelFieldDisabled }"
|
|
||||||
:placeholder="t('Please select field', { field: t('game.rewardConfig.game_channel_id') })"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<el-form-item :label="t('game.rewardConfig.tier_reward_form')" prop="tier_reward_form">
|
|
||||||
<div class="block-editor">
|
|
||||||
<div class="line line-head">
|
|
||||||
<span>{{ t('game.rewardConfig.grid_number') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.ui_text') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.real_ev') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.tier') }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-for="(row, idx) in tierRows" :key="'tier-' + idx" class="line">
|
|
||||||
<el-input v-model="row.grid_number" disabled />
|
|
||||||
<el-input
|
|
||||||
v-model="row.ui_text"
|
|
||||||
:placeholder="t('Please input field', { field: t('game.rewardConfig.ui_text') })"
|
|
||||||
@input="syncPayload"
|
|
||||||
/>
|
|
||||||
<el-input
|
|
||||||
v-model="row.real_ev"
|
|
||||||
:placeholder="t('Please input field', { field: t('game.rewardConfig.real_ev') })"
|
|
||||||
@input="syncPayload"
|
|
||||||
/>
|
|
||||||
<el-select v-model="row.tier" style="width: 120px" @change="syncPayload">
|
|
||||||
<el-option :label="t('game.rewardConfig.tier_t1')" value="T1" />
|
|
||||||
<el-option :label="t('game.rewardConfig.tier_t2')" value="T2" />
|
|
||||||
<el-option :label="t('game.rewardConfig.tier_t3')" value="T3" />
|
|
||||||
<el-option :label="t('game.rewardConfig.tier_t4')" value="T4" />
|
|
||||||
<el-option :label="t('game.rewardConfig.tier_t5')" value="T5" />
|
|
||||||
</el-select>
|
|
||||||
</div>
|
|
||||||
<div class="form-help">{{ t('game.rewardConfig.tier_reward_form_help') }}</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item :label="t('game.rewardConfig.bigwin_form')" prop="bigwin_form">
|
|
||||||
<div class="block-editor">
|
|
||||||
<div class="line line-head">
|
|
||||||
<span>{{ t('game.rewardConfig.grid_number') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.ui_text') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.real_ev') }}</span>
|
|
||||||
<span>{{ t('game.rewardConfig.tier') }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-for="(row, idx) in bigwinRows" :key="'bigwin-' + idx" class="line">
|
|
||||||
<el-input v-model="row.grid_number" disabled />
|
|
||||||
<el-input
|
|
||||||
v-model="row.ui_text"
|
|
||||||
:placeholder="t('Please input field', { field: t('game.rewardConfig.ui_text') })"
|
|
||||||
@input="syncPayload"
|
|
||||||
/>
|
|
||||||
<el-input
|
|
||||||
v-model="row.real_ev"
|
|
||||||
:placeholder="t('Please input field', { field: t('game.rewardConfig.real_ev') })"
|
|
||||||
@input="syncPayload"
|
|
||||||
/>
|
|
||||||
<el-input v-model="row.tier" disabled style="width: 120px" />
|
|
||||||
</div>
|
|
||||||
<div class="form-help">{{ t('game.rewardConfig.bigwin_form_help') }}</div>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-scrollbar>
|
|
||||||
<template #footer>
|
|
||||||
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
|
|
||||||
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
|
|
||||||
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">
|
|
||||||
{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import type { FormItemRule } from 'element-plus'
|
|
||||||
import { computed, inject, reactive, ref, useTemplateRef, watch } from 'vue'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import FormItem from '/@/components/formItem/index.vue'
|
|
||||||
import { useConfig } from '/@/stores/config'
|
|
||||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
|
||||||
import type baTableClass from '/@/utils/baTable'
|
|
||||||
import { buildValidatorData } from '/@/utils/validate'
|
|
||||||
|
|
||||||
type RewardRow = { grid_number: string; ui_text: string; real_ev: string; tier: string }
|
|
||||||
|
|
||||||
const config = useConfig()
|
|
||||||
const formRef = useTemplateRef('formRef')
|
|
||||||
const baTable = inject('baTable') as baTableClass
|
|
||||||
const adminInfo = useAdminInfo()
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const TIER_GRIDS = Array.from({ length: 26 }, (_v, i) => String(i + 5))
|
|
||||||
const BIGWIN_GRIDS = ['5', '10', '15', '20', '25', '30']
|
|
||||||
|
|
||||||
const channelRemoteAttr = { pk: 'game_channel.id', field: 'name', remoteUrl: '/admin/game.Channel/index' }
|
|
||||||
const isSuperAdmin = computed(() => adminInfo.super === true)
|
|
||||||
const channelFieldDisabled = computed(() => !isSuperAdmin.value && baTable.form.operate === 'Edit')
|
|
||||||
|
|
||||||
const tierRows = ref<RewardRow[]>(TIER_GRIDS.map((g) => ({ grid_number: g, ui_text: '', real_ev: '', tier: 'T1' })))
|
|
||||||
const bigwinRows = ref<RewardRow[]>(BIGWIN_GRIDS.map((g) => ({ grid_number: g, ui_text: '', real_ev: '', tier: 'BIGWIN' })))
|
|
||||||
|
|
||||||
function parseRows(raw: unknown): RewardRow[] {
|
|
||||||
if (typeof raw !== 'string' || raw.trim() === '') return []
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(raw) as unknown
|
|
||||||
if (!Array.isArray(parsed)) return []
|
|
||||||
const out: RewardRow[] = []
|
|
||||||
for (const item of parsed) {
|
|
||||||
if (item === null || typeof item !== 'object' || Array.isArray(item)) continue
|
|
||||||
const obj = item as Record<string, unknown>
|
|
||||||
out.push({
|
|
||||||
grid_number: String(obj.grid_number ?? ''),
|
|
||||||
ui_text: String(obj.ui_text ?? ''),
|
|
||||||
real_ev: String(obj.real_ev ?? ''),
|
|
||||||
tier: String(obj.tier ?? ''),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
} catch {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toTierRows(raw: unknown): RewardRow[] {
|
|
||||||
const parsed = parseRows(raw)
|
|
||||||
const map = new Map<string, RewardRow>()
|
|
||||||
for (const r of parsed) map.set(r.grid_number, r)
|
|
||||||
return TIER_GRIDS.map((g) => {
|
|
||||||
const row = map.get(g)
|
|
||||||
return { grid_number: g, ui_text: row?.ui_text ?? '', real_ev: row?.real_ev ?? '', tier: row?.tier && row.tier !== 'BIGWIN' ? row.tier : 'T1' }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function toBigwinRows(raw: unknown): RewardRow[] {
|
|
||||||
const parsed = parseRows(raw)
|
|
||||||
const map = new Map<string, RewardRow>()
|
|
||||||
for (const r of parsed) map.set(r.grid_number, r)
|
|
||||||
return BIGWIN_GRIDS.map((g) => {
|
|
||||||
const row = map.get(g)
|
|
||||||
return { grid_number: g, ui_text: row?.ui_text ?? '', real_ev: row?.real_ev ?? '', tier: 'BIGWIN' }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncPayload() {
|
|
||||||
const items = baTable.form.items
|
|
||||||
if (!items) return
|
|
||||||
items.tier_reward_form = JSON.stringify(tierRows.value)
|
|
||||||
items.bigwin_form = JSON.stringify(bigwinRows.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateForms(): string | undefined {
|
|
||||||
if (tierRows.value.length !== 26 || bigwinRows.value.length !== 6) {
|
|
||||||
return t('Parameter error')
|
|
||||||
}
|
|
||||||
for (let i = 0; i < tierRows.value.length; i++) {
|
|
||||||
const row = tierRows.value[i]
|
|
||||||
if (row.grid_number !== TIER_GRIDS[i]) return t('Parameter error')
|
|
||||||
if (row.ui_text.trim() === '' || row.real_ev.trim() === '') return t('Please input field', { field: t('game.rewardConfig.ui_text') })
|
|
||||||
if (!Number.isFinite(Number(row.real_ev))) return t('game.rewardConfig.real_ev')
|
|
||||||
if (!['T1', 'T2', 'T3', 'T4', 'T5'].includes(row.tier)) return t('Parameter error')
|
|
||||||
}
|
|
||||||
for (let i = 0; i < bigwinRows.value.length; i++) {
|
|
||||||
const row = bigwinRows.value[i]
|
|
||||||
if (row.grid_number !== BIGWIN_GRIDS[i]) return t('Parameter error')
|
|
||||||
if (row.tier !== 'BIGWIN') return t('Parameter error')
|
|
||||||
if (row.ui_text.trim() === '' || row.real_ev.trim() === '') return t('Please input field', { field: t('game.rewardConfig.ui_text') })
|
|
||||||
if (!Number.isFinite(Number(row.real_ev))) return t('game.rewardConfig.real_ev')
|
|
||||||
}
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => baTable.form.loading,
|
|
||||||
(loading) => {
|
|
||||||
if (loading === false) {
|
|
||||||
tierRows.value = toTierRows(baTable.form.items?.tier_reward_form)
|
|
||||||
bigwinRows.value = toBigwinRows(baTable.form.items?.bigwin_form)
|
|
||||||
syncPayload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
|
||||||
game_channel_id: [buildValidatorData({ name: 'required', title: t('game.rewardConfig.game_channel_id') })],
|
|
||||||
tier_reward_form: [
|
|
||||||
{
|
|
||||||
validator: (_rule, _val, callback) => {
|
|
||||||
const err = validateForms()
|
|
||||||
if (err) return callback(new Error(err))
|
|
||||||
callback()
|
|
||||||
},
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bigwin_form: [
|
|
||||||
{
|
|
||||||
validator: (_rule, _val, callback) => {
|
|
||||||
const err = validateForms()
|
|
||||||
if (err) return callback(new Error(err))
|
|
||||||
callback()
|
|
||||||
},
|
|
||||||
trigger: ['blur', 'change'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.block-editor {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.line {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 110px 1fr 1fr 120px;
|
|
||||||
gap: 8px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.line-head {
|
|
||||||
margin-bottom: 6px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
.form-help {
|
|
||||||
margin-top: 6px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
149
web/src/views/backend/game/rewardWeight/index.vue
Normal file
149
web/src/views/backend/game/rewardWeight/index.vue
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<!-- 表格顶部菜单 -->
|
||||||
|
<!-- 自定义按钮请使用插槽,甚至公共搜索也可以使用具名插槽渲染,参见文档 -->
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.rewardWeight.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<!-- 表格列有多种自定义渲染方式,比如自定义组件、具名插槽等,参见文档 -->
|
||||||
|
<!-- 要使用 el-table 组件原有的属性,直接加在 Table 标签上即可 -->
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
|
||||||
|
<!-- 表单 -->
|
||||||
|
<PopupForm />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import PopupForm from './popupForm.vue'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import { defaultOptButtons } from '/@/components/table'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'game/rewardWeight',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete'])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* baTable 内包含了表格的所有数据且数据具备响应性,然后通过 provide 注入给了后代组件
|
||||||
|
*/
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/game.RewardWeight/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('game.rewardWeight.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.gamechannel__name'),
|
||||||
|
prop: 'gameChannel.name',
|
||||||
|
align: 'center',
|
||||||
|
operatorPlaceholder: t('Fuzzy query'),
|
||||||
|
render: 'tags',
|
||||||
|
operator: 'LIKE',
|
||||||
|
comSearchRender: 'string',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.direction'),
|
||||||
|
prop: 'direction',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: { '0': t('game.rewardWeight.direction 0'), '1': t('game.rewardWeight.direction 1') },
|
||||||
|
},
|
||||||
|
{ label: t('game.rewardWeight.grid_number'), prop: 'grid_number', align: 'center', sortable: false, operator: 'RANGE' },
|
||||||
|
{ label: t('game.rewardWeight.start_index'), prop: 'start_index', align: 'center', sortable: false, operator: 'RANGE' },
|
||||||
|
{ label: t('game.rewardWeight.end_index'), prop: 'end_index', align: 'center', sortable: false, operator: 'RANGE' },
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.ui_text'),
|
||||||
|
prop: 'ui_text',
|
||||||
|
align: 'center',
|
||||||
|
operatorPlaceholder: t('Fuzzy query'),
|
||||||
|
sortable: false,
|
||||||
|
operator: 'LIKE',
|
||||||
|
},
|
||||||
|
{ label: t('game.rewardWeight.real_ev'), prop: 'real_ev', align: 'center', sortable: false, operator: 'RANGE' },
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.tier'),
|
||||||
|
prop: 'tier',
|
||||||
|
align: 'center',
|
||||||
|
operatorPlaceholder: t('Fuzzy query'),
|
||||||
|
sortable: false,
|
||||||
|
operator: 'LIKE',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.type'),
|
||||||
|
prop: 'type',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
'-2': t('game.rewardWeight.type -2'),
|
||||||
|
'-1': t('game.rewardWeight.type -1'),
|
||||||
|
'0': t('game.rewardWeight.type 0'),
|
||||||
|
'1': t('game.rewardWeight.type 1'),
|
||||||
|
'2': t('game.rewardWeight.type 2'),
|
||||||
|
'3': t('game.rewardWeight.type 3'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: t('game.rewardWeight.remark'), prop: 'remark', align: 'center', operatorPlaceholder: t('Fuzzy query'), operator: 'LIKE' },
|
||||||
|
{ label: t('game.rewardWeight.weight'), prop: 'weight', align: 'center', sortable: false, operator: 'RANGE' },
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.create_time'),
|
||||||
|
prop: 'create_time',
|
||||||
|
align: 'center',
|
||||||
|
render: 'datetime',
|
||||||
|
operator: 'RANGE',
|
||||||
|
comSearchRender: 'datetime',
|
||||||
|
sortable: 'custom',
|
||||||
|
width: 160,
|
||||||
|
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('game.rewardWeight.update_time'),
|
||||||
|
prop: 'update_time',
|
||||||
|
align: 'center',
|
||||||
|
render: 'datetime',
|
||||||
|
operator: 'RANGE',
|
||||||
|
comSearchRender: 'datetime',
|
||||||
|
sortable: 'custom',
|
||||||
|
width: 160,
|
||||||
|
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||||
|
},
|
||||||
|
{ label: t('Operate'), align: 'center', width: 100, render: 'buttons', buttons: optButtons, operator: false },
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: { direction: '0', type: '0' },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
87
web/src/views/backend/game/rewardWeight/popupForm.vue
Normal file
87
web/src/views/backend/game/rewardWeight/popupForm.vue
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 对话框表单 -->
|
||||||
|
<!-- 建议使用 Prettier 格式化代码 -->
|
||||||
|
<!-- el-form 内可以混用 el-form-item、FormItem、ba-input 等输入组件 -->
|
||||||
|
<el-dialog
|
||||||
|
class="ba-operate-dialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:model-value="['Add', 'Edit'].includes(baTable.form.operate!)"
|
||||||
|
@close="baTable.toggleForm"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">
|
||||||
|
{{ baTable.form.operate ? t(baTable.form.operate) : '' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
|
||||||
|
<div
|
||||||
|
class="ba-operate-form"
|
||||||
|
:class="'ba-' + baTable.form.operate + '-form'"
|
||||||
|
:style="config.layout.shrink ? '':'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
v-if="!baTable.form.loading"
|
||||||
|
ref="formRef"
|
||||||
|
@submit.prevent=""
|
||||||
|
@keyup.enter="baTable.onSubmit(formRef)"
|
||||||
|
:model="baTable.form.items"
|
||||||
|
:label-position="config.layout.shrink ? 'top' : 'right'"
|
||||||
|
:label-width="baTable.form.labelWidth + 'px'"
|
||||||
|
:rules="rules"
|
||||||
|
>
|
||||||
|
<FormItem :label="t('game.rewardWeight.game_channel_id')" type="remoteSelect" v-model="baTable.form.items!.game_channel_id" prop="game_channel_id" :input-attr="{ pk: 'game_channel.id', field: 'name', remoteUrl: '/admin/game.Channel/index' }" :placeholder="t('Please select field', { field: t('game.rewardWeight.game_channel_id') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.direction')" type="radio" v-model="baTable.form.items!.direction" prop="direction" :input-attr="{ content: { '0': t('game.rewardWeight.direction 0'), '1': t('game.rewardWeight.direction 1') } }" :placeholder="t('Please select field', { field: t('game.rewardWeight.direction') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.grid_number')" type="number" v-model="baTable.form.items!.grid_number" prop="grid_number" :input-attr="{ step: 1 }" :placeholder="t('Please input field', { field: t('game.rewardWeight.grid_number') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.start_index')" type="number" v-model="baTable.form.items!.start_index" prop="start_index" :input-attr="{ step: 1 }" :placeholder="t('Please input field', { field: t('game.rewardWeight.start_index') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.end_index')" type="number" v-model="baTable.form.items!.end_index" prop="end_index" :input-attr="{ step: 1 }" :placeholder="t('Please input field', { field: t('game.rewardWeight.end_index') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.ui_text')" type="string" v-model="baTable.form.items!.ui_text" prop="ui_text" :placeholder="t('Please input field', { field: t('game.rewardWeight.ui_text') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.real_ev')" type="number" v-model="baTable.form.items!.real_ev" prop="real_ev" :input-attr="{ step: 1 }" :placeholder="t('Please input field', { field: t('game.rewardWeight.real_ev') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.tier')" type="string" v-model="baTable.form.items!.tier" prop="tier" :placeholder="t('Please input field', { field: t('game.rewardWeight.tier') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.type')" type="select" v-model="baTable.form.items!.type" prop="type" :input-attr="{ content: { '-2': t('game.rewardWeight.type -2'), '-1': t('game.rewardWeight.type -1'), '0': t('game.rewardWeight.type 0'), '1': t('game.rewardWeight.type 1'), '2': t('game.rewardWeight.type 2'), '3': t('game.rewardWeight.type 3') } }" :placeholder="t('Please select field', { field: t('game.rewardWeight.type') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.remark')" type="textarea" v-model="baTable.form.items!.remark" prop="remark" :input-attr="{ rows: 3 }" @keyup.enter.stop="" @keyup.ctrl.enter="baTable.onSubmit(formRef)" :placeholder="t('Please input field', { field: t('game.rewardWeight.remark') })" />
|
||||||
|
<FormItem :label="t('game.rewardWeight.weight')" type="number" v-model="baTable.form.items!.weight" prop="weight" :input-attr="{ step: 1 }" :placeholder="t('Please input field', { field: t('game.rewardWeight.weight') })" />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
<template #footer>
|
||||||
|
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
|
||||||
|
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
|
||||||
|
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">
|
||||||
|
{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { FormItemRule } from 'element-plus'
|
||||||
|
import { inject, reactive, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import FormItem from '/@/components/formItem/index.vue'
|
||||||
|
import { useConfig } from '/@/stores/config'
|
||||||
|
import type baTableClass from '/@/utils/baTable'
|
||||||
|
import { buildValidatorData } from '/@/utils/validate'
|
||||||
|
|
||||||
|
const config = useConfig()
|
||||||
|
const formRef = useTemplateRef('formRef')
|
||||||
|
const baTable = inject('baTable') as baTableClass
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||||
|
direction: [buildValidatorData({ name: 'required', title: t('game.rewardWeight.direction') })],
|
||||||
|
grid_number: [buildValidatorData({ name: 'integer', title: t('game.rewardWeight.grid_number') }), buildValidatorData({ name: 'required', title: t('game.rewardWeight.grid_number') })],
|
||||||
|
start_index: [buildValidatorData({ name: 'integer', title: t('game.rewardWeight.start_index') }), buildValidatorData({ name: 'required', title: t('game.rewardWeight.start_index') })],
|
||||||
|
end_index: [buildValidatorData({ name: 'integer', title: t('game.rewardWeight.end_index') }), buildValidatorData({ name: 'required', title: t('game.rewardWeight.end_index') })],
|
||||||
|
ui_text: [buildValidatorData({ name: 'required', title: t('game.rewardWeight.ui_text') })],
|
||||||
|
real_ev: [buildValidatorData({ name: 'number', title: t('game.rewardWeight.real_ev') }), buildValidatorData({ name: 'required', title: t('game.rewardWeight.real_ev') })],
|
||||||
|
tier: [buildValidatorData({ name: 'required', title: t('game.rewardWeight.tier') })],
|
||||||
|
type: [buildValidatorData({ name: 'required', title: t('game.rewardWeight.type') })],
|
||||||
|
weight: [buildValidatorData({ name: 'integer', title: t('game.rewardWeight.weight') })],
|
||||||
|
create_time: [buildValidatorData({ name: 'date', title: t('game.rewardWeight.create_time') })],
|
||||||
|
update_time: [buildValidatorData({ name: 'date', title: t('game.rewardWeight.update_time') })],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
Reference in New Issue
Block a user