修复接单平台并发、分页与补资料
This commit is contained in:
@@ -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() || ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user