改造短信发送图形验证码流程
This commit is contained in:
@@ -12,17 +12,35 @@ export interface OrganizationMemberInfo {
|
||||
memberRoleId?: string
|
||||
}
|
||||
|
||||
export interface SendMobileCodePayload {
|
||||
phone: string
|
||||
imageRandomStr: string
|
||||
imageCode: string
|
||||
}
|
||||
|
||||
const basicAuth = () => {
|
||||
const raw = `${env.clientId}:${env.clientSecret}`
|
||||
return `Basic ${window.btoa(raw)}`
|
||||
}
|
||||
|
||||
export const sendMobileCode = async (phone: string) => {
|
||||
if (env.useMock) return mockApi.sendMobileCode(phone)
|
||||
return await http.get<boolean>(joinUrl(env.adminBase, 'platformUser/sendMobileCode', phone), {
|
||||
export const getImageCodeUrl = (imageRandomStr: string) => {
|
||||
const params = new URLSearchParams({
|
||||
randomStr: imageRandomStr,
|
||||
t: String(Date.now())
|
||||
})
|
||||
return `${joinUrl(env.authBase, 'code/image')}?${params.toString()}`
|
||||
}
|
||||
|
||||
export const sendMobileCode = async (payload: SendMobileCodePayload) => {
|
||||
if (env.useMock) return mockApi.sendMobileCode(payload)
|
||||
return await http.get<boolean>(joinUrl(env.adminBase, 'platformUser/sendMobileCode', payload.phone), {
|
||||
headers: {
|
||||
clientId: env.clientId,
|
||||
clientConfigId: env.clientConfigId
|
||||
},
|
||||
params: {
|
||||
imageRandomStr: payload.imageRandomStr,
|
||||
imageCode: payload.imageCode
|
||||
}
|
||||
}) as unknown as boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user