- 客户资料页按设计稿重构,区服固定四项下拉,游戏编号/角色名校验 - 虎牙登录与绑定页统一深色样式,扫码页新增改用手机号登录 - 待确认角色 UID 改用 huyaUid,不再展示虎牙加密 roleId - 绑定确认新增两侧角色比对,不一致禁止确认,会话过期引导重新登录 - 新增迁移 168/169 与角色绑定单测,脚本换行符固定为 LF
192 lines
5.5 KiB
TypeScript
192 lines
5.5 KiB
TypeScript
import { apiGet, apiPost } from '@/lib/http'
|
|
import type {
|
|
CustomerBindingInfo,
|
|
CustomerLoginInfo,
|
|
CustomerSemiAutoTask,
|
|
} from '@/types/customer-fulfillment'
|
|
|
|
export function fetchCustomerFulfillment(orderNo: string) {
|
|
return apiGet<CustomerSemiAutoTask[]>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}`,
|
|
)
|
|
}
|
|
|
|
export function markCustomerFulfillmentOpened(orderNo: string, taskId: number) {
|
|
return apiPost<{ ok: boolean }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/open`,
|
|
{},
|
|
)
|
|
}
|
|
|
|
export function saveCustomerTaskProfile(
|
|
orderNo: string,
|
|
taskId: number,
|
|
input: { roleName: string; roleId: string; serverZone: string },
|
|
) {
|
|
return apiPost<{ task: CustomerSemiAutoTask }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/profile`,
|
|
input,
|
|
)
|
|
}
|
|
|
|
export function startCustomerLogin(orderNo: string, taskId: number) {
|
|
return apiPost<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/login/start`,
|
|
{},
|
|
)
|
|
}
|
|
|
|
export function pollCustomerLogin(orderNo: string, taskId: number) {
|
|
return apiGet<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo | null }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/login/status`,
|
|
)
|
|
}
|
|
|
|
export function startCustomerBinding(
|
|
orderNo: string,
|
|
taskId: number,
|
|
options: { forceRebind?: boolean } = {},
|
|
) {
|
|
return apiPost<{ task: CustomerSemiAutoTask; binding: CustomerBindingInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/binding/start`,
|
|
options.forceRebind ? { forceRebind: true } : {},
|
|
)
|
|
}
|
|
|
|
export function pollCustomerBinding(orderNo: string, taskId: number) {
|
|
return apiGet<{ task: CustomerSemiAutoTask; binding: CustomerBindingInfo | null }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/binding/status`,
|
|
)
|
|
}
|
|
|
|
export function confirmCustomerBinding(orderNo: string, taskId: number) {
|
|
return apiPost<{ task: CustomerSemiAutoTask; binding: CustomerBindingInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/binding/confirm`,
|
|
{},
|
|
)
|
|
}
|
|
|
|
type CustomerHuyaChallengeBase = {
|
|
image: string
|
|
width: number
|
|
height: number
|
|
}
|
|
|
|
export type CustomerHuyaSmsChallenge =
|
|
| (CustomerHuyaChallengeBase & {
|
|
type: 'slider'
|
|
puzzleImage: string
|
|
puzzleWidth: number
|
|
puzzleY: number
|
|
})
|
|
| (CustomerHuyaChallengeBase & {
|
|
type: 'rotate'
|
|
puzzleImage: string
|
|
puzzleWidth: number
|
|
puzzleHeight: number
|
|
puzzleX: number
|
|
puzzleY: number
|
|
})
|
|
| (CustomerHuyaChallengeBase & {
|
|
type: 'click'
|
|
tipImage: string
|
|
question: string
|
|
wordSize: number
|
|
})
|
|
|
|
export type CustomerHuyaChallengeSolution = {
|
|
distance?: number
|
|
angle?: number
|
|
points?: Array<{ x: number; y: number }>
|
|
}
|
|
|
|
export type CustomerHuyaSmsSendResult = {
|
|
ok: boolean
|
|
message: string
|
|
expiresAt: string
|
|
challenge: CustomerHuyaSmsChallenge | null
|
|
}
|
|
|
|
export function sendCustomerHuyaSmsCode(orderNo: string, taskId: number, mobile: string) {
|
|
return apiPost<CustomerHuyaSmsSendResult>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/huya/sms/send`,
|
|
{ mobile },
|
|
)
|
|
}
|
|
|
|
export function verifyCustomerHuyaSmsChallenge(
|
|
orderNo: string,
|
|
taskId: number,
|
|
solution: CustomerHuyaChallengeSolution,
|
|
) {
|
|
return apiPost<CustomerHuyaSmsSendResult>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/huya/sms/verify`,
|
|
solution,
|
|
)
|
|
}
|
|
|
|
export function loginCustomerHuyaSms(
|
|
orderNo: string,
|
|
taskId: number,
|
|
input: { mobile: string; code: string },
|
|
) {
|
|
return apiPost<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/huya/sms/login`,
|
|
input,
|
|
)
|
|
}
|
|
|
|
export type CustomerWeiboCountryCode = {
|
|
code: string
|
|
name: string
|
|
}
|
|
|
|
export function fetchCustomerWeiboCountryCodes(orderNo: string, taskId: number) {
|
|
return apiGet<{ countryCodes: CustomerWeiboCountryCode[] }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/weibo/config`,
|
|
)
|
|
}
|
|
|
|
export function sendCustomerWeiboSmsCode(
|
|
orderNo: string,
|
|
taskId: number,
|
|
mobile: string,
|
|
countryCode: string,
|
|
mfaId = '',
|
|
) {
|
|
return apiPost<{
|
|
ok: boolean
|
|
message: string
|
|
mfaRequired: boolean
|
|
mfaId?: string
|
|
captchaId?: string
|
|
}>(`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/weibo/sms/send`, {
|
|
mobile,
|
|
countryCode,
|
|
mfaId,
|
|
})
|
|
}
|
|
|
|
export function loginCustomerWeiboSms(
|
|
orderNo: string,
|
|
taskId: number,
|
|
input: { mobile: string; code: string; countryCode: string; rid?: string },
|
|
) {
|
|
return apiPost<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/weibo/sms/login`,
|
|
input,
|
|
)
|
|
}
|
|
|
|
export function startCustomerWeiboQrLogin(orderNo: string, taskId: number) {
|
|
return apiGet<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/weibo/qrcode`,
|
|
)
|
|
}
|
|
|
|
export function pollCustomerWeiboQrLogin(orderNo: string, taskId: number) {
|
|
return apiGet<{ task: CustomerSemiAutoTask; login: CustomerLoginInfo | null }>(
|
|
`/api/v1/customer-fulfillment/${encodeURIComponent(orderNo)}/tasks/${taskId}/weibo/qrcode/status`,
|
|
)
|
|
}
|