功能:完善多店铺登录与首次部署SQL
This commit is contained in:
+34
-12
@@ -5,6 +5,8 @@ export interface UserVO extends UserInfo {
|
||||
id: number
|
||||
shopId?: number
|
||||
shopName?: string
|
||||
shopIds?: Array<number | string>
|
||||
shopNames?: string[]
|
||||
nickname: string
|
||||
account: string
|
||||
avatar: string
|
||||
@@ -39,6 +41,7 @@ export interface CreateUserRequest {
|
||||
password: string
|
||||
type: number
|
||||
shopId?: number
|
||||
shopIds?: Array<number | string>
|
||||
}
|
||||
|
||||
export interface UpdateUserRequest {
|
||||
@@ -47,6 +50,7 @@ export interface UpdateUserRequest {
|
||||
phone?: string
|
||||
type?: number
|
||||
shopId?: number
|
||||
shopIds?: Array<number | string>
|
||||
}
|
||||
|
||||
export interface UpdatePasswordRequest {
|
||||
@@ -70,6 +74,15 @@ export interface LoginAccountCheckResponse {
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface LoginShopSelectionResponse {
|
||||
allowShoplessLogin: boolean
|
||||
message: string
|
||||
shops: Array<{
|
||||
id: number | string
|
||||
shopName: string
|
||||
}>
|
||||
}
|
||||
|
||||
export interface UpdatePhoneRequest {
|
||||
oldPhone: string
|
||||
newPhone: string
|
||||
@@ -77,8 +90,8 @@ export interface UpdatePhoneRequest {
|
||||
}
|
||||
|
||||
export const userApi = {
|
||||
getUserInfo: () => {
|
||||
return api.get<UserVO>('/user/info')
|
||||
getUserInfo: async (): Promise<UserVO> => {
|
||||
return await api.get<UserVO>('/user/info') as unknown as UserVO
|
||||
},
|
||||
updateUserInfo: (data: UpdateUserInfoRequest) => {
|
||||
return api.put('/user/update', data)
|
||||
@@ -92,24 +105,33 @@ export const userApi = {
|
||||
updatePhone: (data: UpdatePhoneRequest) => {
|
||||
return api.put('/user/phone', data)
|
||||
},
|
||||
getUserByAccount: (account: string) => {
|
||||
return api.get<UserVO>(`/user/get/account/${account}`)
|
||||
getUserByAccount: async (account: string): Promise<UserVO> => {
|
||||
return await api.get<UserVO>(`/user/get/account/${account}`) as unknown as UserVO
|
||||
},
|
||||
checkAccountAvailability: (account: string) => {
|
||||
return api.get<AvailabilityCheckResponse>(`/user/check/account/${encodeURIComponent(account)}`)
|
||||
checkAccountAvailability: async (account: string): Promise<AvailabilityCheckResponse> => {
|
||||
return await api.get<AvailabilityCheckResponse>(`/user/check/account/${encodeURIComponent(account)}`) as unknown as AvailabilityCheckResponse
|
||||
},
|
||||
checkLoginAccountAvailability: (account: string) => {
|
||||
return api.get<LoginAccountCheckResponse>(`/user/check/login-account/${encodeURIComponent(account)}`)
|
||||
checkLoginAccountAvailability: async (account: string): Promise<LoginAccountCheckResponse> => {
|
||||
return await api.get<LoginAccountCheckResponse>(`/user/check/login-account/${encodeURIComponent(account)}`) as unknown as LoginAccountCheckResponse
|
||||
},
|
||||
checkPhoneAvailability: (phone: string) => {
|
||||
return api.get<AvailabilityCheckResponse>(`/user/check/phone/${encodeURIComponent(phone)}`)
|
||||
getLoginShopsByAccount: async (account: string): Promise<LoginShopSelectionResponse> => {
|
||||
return await api.get<LoginShopSelectionResponse>(`/user/check/login-shops/account/${encodeURIComponent(account)}`) as unknown as LoginShopSelectionResponse
|
||||
},
|
||||
listUsersByType: (type: number) => {
|
||||
return api.get<UserVO[]>(`/user/list/type/${type}`)
|
||||
getLoginShopsByPhone: async (phone: string): Promise<LoginShopSelectionResponse> => {
|
||||
return await api.get<LoginShopSelectionResponse>(`/user/check/login-shops/phone/${encodeURIComponent(phone)}`) as unknown as LoginShopSelectionResponse
|
||||
},
|
||||
checkPhoneAvailability: async (phone: string): Promise<AvailabilityCheckResponse> => {
|
||||
return await api.get<AvailabilityCheckResponse>(`/user/check/phone/${encodeURIComponent(phone)}`) as unknown as AvailabilityCheckResponse
|
||||
},
|
||||
listUsersByType: async (type: number): Promise<UserVO[]> => {
|
||||
return await api.get<UserVO[]>(`/user/list/type/${type}`) as unknown as UserVO[]
|
||||
},
|
||||
sendVerificationCode: (data: { phone: string }) => {
|
||||
return api.post('/user/send-verification-code', data)
|
||||
},
|
||||
switchShop: (shopId?: string | number) => {
|
||||
return api.post('/user/switch-shop', { shopId })
|
||||
},
|
||||
deactivateAccount: () => {
|
||||
return api.delete('/user/deactivate')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user