修复(半自动履约): 稳定任务排序并拆分虎牙角色UID
This commit is contained in:
@@ -107,16 +107,7 @@ export async function listAdminSemiAutoTasks(input: Record<string, unknown> = {}
|
||||
const result = await query<TaskRow>(
|
||||
`${TASK_SELECT}
|
||||
WHERE ${where}
|
||||
ORDER BY
|
||||
CASE task.execution_status
|
||||
WHEN 'waiting_operator' THEN 0
|
||||
WHEN 'waiting_customer' THEN 1
|
||||
WHEN 'processing' THEN 2
|
||||
WHEN 'failed' THEN 3
|
||||
ELSE 4
|
||||
END,
|
||||
task.updated_at DESC,
|
||||
task.id DESC
|
||||
ORDER BY task.created_at DESC, task.id DESC
|
||||
LIMIT $${listParams.length - 1} OFFSET $${listParams.length}`,
|
||||
listParams,
|
||||
)
|
||||
@@ -539,6 +530,9 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
const pendingBindGameRoleToken = String(
|
||||
input.pendingBindGameRoleToken ?? input.pending_bind_game_role_token ?? '',
|
||||
).trim()
|
||||
const pendingPlatformGameRoleUid = String(
|
||||
input.pendingPlatformGameRoleUid ?? input.pending_platform_game_role_uid ?? '',
|
||||
).trim()
|
||||
const pendingBindGameChannel = String(
|
||||
input.pendingBindGameChannel ?? input.pending_bind_game_channel ?? '',
|
||||
).trim()
|
||||
@@ -566,6 +560,12 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
errorCode: 'semi_auto_snapshot_platform_role_uid_invalid',
|
||||
})
|
||||
}
|
||||
if (pendingPlatformGameRoleUid && !/^\d+$/.test(pendingPlatformGameRoleUid)) {
|
||||
throw createHttpError('待确认平台游戏角色 UID 格式无效', {
|
||||
statusCode: 400,
|
||||
errorCode: 'semi_auto_snapshot_pending_platform_role_uid_invalid',
|
||||
})
|
||||
}
|
||||
const effectiveHuyaUid = uid || task.huya_uid
|
||||
if (platformGameRoleUid && effectiveHuyaUid && platformGameRoleUid === effectiveHuyaUid) {
|
||||
throw createHttpError('平台游戏角色 UID 不能复用虎牙账号 UID', {
|
||||
@@ -573,6 +573,16 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
errorCode: 'semi_auto_snapshot_platform_role_uid_reused',
|
||||
})
|
||||
}
|
||||
if (
|
||||
pendingPlatformGameRoleUid &&
|
||||
effectiveHuyaUid &&
|
||||
pendingPlatformGameRoleUid === effectiveHuyaUid
|
||||
) {
|
||||
throw createHttpError('待确认平台游戏角色 UID 不能复用虎牙账号 UID', {
|
||||
statusCode: 400,
|
||||
errorCode: 'semi_auto_snapshot_pending_platform_role_uid_reused',
|
||||
})
|
||||
}
|
||||
if (!ROLE_IDENTITY_SOURCES.has(roleIdentitySource)) {
|
||||
throw createHttpError('角色身份来源无效', {
|
||||
statusCode: 400,
|
||||
@@ -627,7 +637,8 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
isBindAccount: isBindAccount ?? Boolean(bindGameRole),
|
||||
isBindRole: isBindRole ?? Boolean(bindGameRole),
|
||||
roleName: bindGameRole,
|
||||
roleToken: platformGameRoleUid || bindGameRoleToken,
|
||||
roleToken: bindGameRoleToken,
|
||||
platformRoleUid: platformGameRoleUid,
|
||||
channel: bindGameChannel,
|
||||
changeBindTime: accountChangeBindTime,
|
||||
changeBindDay: accountChangeBindDay,
|
||||
@@ -639,6 +650,7 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
isBindRole: false,
|
||||
roleName: pendingBindGameRole,
|
||||
roleToken: pendingBindGameRoleToken,
|
||||
platformRoleUid: pendingPlatformGameRoleUid,
|
||||
channel: pendingBindGameChannel,
|
||||
changeBindTime: pendingChangeBindTime,
|
||||
changeBindDay: pendingChangeBindDay,
|
||||
@@ -661,6 +673,7 @@ export async function applySemiAutoTaskStateSnapshot(
|
||||
pendingBindGameAccount,
|
||||
pendingBindGameRole,
|
||||
pendingBindGameRoleToken,
|
||||
pendingPlatformGameRoleUid,
|
||||
pendingBindGameChannel,
|
||||
pendingChangeBindTime,
|
||||
pendingChangeBindDay,
|
||||
|
||||
Reference in New Issue
Block a user