feat(admin): 从已有玩家升级代理、修复 i18n 与过期 .js 冲突
- 新建一级代理改为选择已有玩家;新建用户可选一级代理 - 操作日志/注单等扁平 key 翻译;清理 src 内误生成 .js,Vite 优先解析 .ts Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,10 @@ export interface PlayerCreateForm {
|
||||
email: string;
|
||||
initialDeposit: number;
|
||||
remark: string;
|
||||
/** 创建为一级代理(非玩家) */
|
||||
asTier1Agent: boolean;
|
||||
creditLimit: number;
|
||||
cashbackRate: number;
|
||||
}
|
||||
|
||||
export interface PlayerEditForm {
|
||||
@@ -63,6 +67,9 @@ export function emptyPlayerCreateForm(): PlayerCreateForm {
|
||||
email: '',
|
||||
initialDeposit: 0,
|
||||
remark: '',
|
||||
asTier1Agent: false,
|
||||
creditLimit: 50000,
|
||||
cashbackRate: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,6 +117,20 @@ export function buildCreatePlayerPayload(form: PlayerCreateForm) {
|
||||
if (!form.username.trim()) throw new FormValidationError('err.username_required');
|
||||
if (form.password.length < 8) throw new FormValidationError('err.password_min');
|
||||
if (form.password !== form.confirmPassword) throw new FormValidationError('err.password_mismatch');
|
||||
if (form.asTier1Agent) {
|
||||
if (form.parentId) throw new FormValidationError('err.agent_no_parent');
|
||||
if (form.initialDeposit > 0) throw new FormValidationError('err.agent_no_initial_deposit');
|
||||
if (form.creditLimit < 0) throw new FormValidationError('err.credit_negative');
|
||||
return {
|
||||
username: form.username.trim(),
|
||||
password: form.password,
|
||||
phone: form.phone.trim() || undefined,
|
||||
email: form.email.trim() || undefined,
|
||||
asTier1Agent: true,
|
||||
creditLimit: form.creditLimit,
|
||||
cashbackRate: form.cashbackRate,
|
||||
};
|
||||
}
|
||||
return {
|
||||
username: form.username.trim(),
|
||||
password: form.password,
|
||||
|
||||
Reference in New Issue
Block a user