[游戏管理]用户管理-优化表单样式

This commit is contained in:
2026-04-15 17:46:04 +08:00
parent c213b2d9e9
commit 56df105af6
8 changed files with 199 additions and 182 deletions

View File

@@ -1,6 +1,6 @@
<?php
namespace app\admin\controller\game;
namespace app\admin\controller\user;
use Throwable;
use app\common\controller\Backend;
@@ -14,9 +14,9 @@ use Webman\Http\Request as WebmanRequest;
class User extends Backend
{
/**
* GameUser模型对象
* User模型对象
* @var object|null
* @phpstan-var \app\common\model\GameUser|null
* @phpstan-var \app\common\model\User|null
*/
protected ?object $model = null;
@@ -28,7 +28,7 @@ class User extends Backend
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\GameUser();
$this->model = new \app\common\model\User();
return null;
}

View File

@@ -1,38 +0,0 @@
<?php
namespace app\common\model;
use support\think\Model;
/**
* GameUser
*/
class GameUser extends Model
{
// 表名
protected $name = 'game_user';
// 自动写入时间戳字段
protected $autoWriteTimestamp = true;
// 字段类型转换(金额 decimal(18,4) 用字符串避免浮点误差)
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'coin' => 'string',
'total_deposit_coin' => 'string',
'total_valid_bet_coin' => 'string',
'risk_flags' => 'integer',
'current_streak' => 'integer',
];
public function channel(): \think\model\relation\BelongsTo
{
return $this->belongsTo(\app\common\model\Channel::class, 'channel_id', 'id');
}
public function admin(): \think\model\relation\BelongsTo
{
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
}
}

View File

@@ -2,42 +2,34 @@
namespace app\common\model;
use app\common\model\traits\TimestampInteger;
use support\think\Model;
/**
* 会员公共模型
* 用户主表
*/
class User extends Model
{
use TimestampInteger;
protected $name = 'user';
protected string $table = 'user';
protected string $pk = 'id';
protected bool $autoWriteTimestamp = true;
protected $autoWriteTimestamp = true;
public function getAvatarAttr($value): string
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'coin' => 'string',
'total_deposit_coin' => 'string',
'total_valid_bet_coin' => 'string',
'risk_flags' => 'integer',
'current_streak' => 'integer',
];
public function channel(): \think\model\relation\BelongsTo
{
return full_url($value, false, config('buildadmin.default_avatar'));
return $this->belongsTo(Channel::class, 'channel_id', 'id');
}
public function setAvatarAttr($value): string
public function admin(): \think\model\relation\BelongsTo
{
return $value == full_url('', false, config('buildadmin.default_avatar')) ? '' : $value;
}
public function resetPassword($uid, $newPassword)
{
return $this->where(['id' => $uid])->update(['password' => hash_password($newPassword), 'salt' => '']);
}
public function getMoneyAttr($value): string
{
return bcdiv((string)$value, '100', 2);
}
public function setMoneyAttr($value): string
{
return bcmul((string)$value, '100', 2);
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
}
}

View File

@@ -1,31 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class GameUser extends Validate
{
protected $failException = true;
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}