修复接单平台并发、分页与补资料

This commit is contained in:
yml2213
2026-07-28 10:15:44 +08:00
parent a2587eda01
commit f0ba0fe17f
22 changed files with 1096 additions and 145 deletions
+13 -8
View File
@@ -37,14 +37,19 @@ export function getRequiredWorkerSession(req: Request): WorkerSession {
}
export function extractWorkerBearerToken(req: Request): string {
const authorization = String(req.headers.authorization || '').trim()
const matched = authorization.match(/^Bearer\s+(.+)$/i)
if (!matched?.[1]) {
throw createHttpError('未登录或登录已失效', {
statusCode: 401,
errorCode: 'worker_auth_required',
})
const token = extractOptionalWorkerBearerToken(req)
if (token) {
return token
}
return matched[1].trim()
throw createHttpError('未登录或登录已失效', {
statusCode: 401,
errorCode: 'worker_auth_required',
})
}
export function extractOptionalWorkerBearerToken(req: Request): string {
const authorization = String(req.headers.authorization || '').trim()
const matched = authorization.match(/^Bearer\s+(.+)$/i)
return matched?.[1]?.trim() || ''
}