[游戏管理]游戏配置

This commit is contained in:
2026-04-15 14:21:27 +08:00
parent b6e5f09479
commit e2097450eb
6 changed files with 343 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace app\admin\controller\game;
use app\common\controller\Backend;
use app\common\library\game\ZiHuaDictionary as ZiHuaDictionaryLib;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 游戏配置game_config
*/
class Config extends Backend
{
protected ?object $model = null;
protected string|array $preExcludeFields = ['id', 'create_time', 'update_time'];
protected string|array $quickSearchField = ['id', 'config_key', 'remark'];
protected string|array $defaultSortField = ['id' => 'asc'];
protected string|array $orderGuarantee = ['id' => 'asc'];
protected bool $modelValidate = false;
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\GameConfig();
return null;
}
/**
* 列表:排除独立表单维护的 36 字花字典
*/
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '') {
$where[] = [$mainShort . '.config_key', '<>', ZiHuaDictionaryLib::CONFIG_KEY];
}
$res = $this->model
->field($this->indexField)
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace app\common\model;
use support\think\Model;
/**
* 游戏/平台动态参数KV
*/
class GameConfig extends Model
{
protected $name = 'game_config';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
];
}