修复:全局治理雪花ID精度问题
This commit is contained in:
+70
-69
@@ -2,6 +2,7 @@ import axios, { AxiosError, type AxiosProgressEvent } from 'axios'
|
||||
import router from '../router'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { ADMIN_API_BASE_URL } from '../config/api'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
let lastErrorTime = 0
|
||||
let lastErrorMessage = ''
|
||||
@@ -169,7 +170,7 @@ adminApi.interceptors.response.use(
|
||||
export interface AdminLoginRequest {
|
||||
account: string
|
||||
password: string
|
||||
shopId?: string | number
|
||||
shopId?: IdType
|
||||
}
|
||||
|
||||
export interface AdminLoginResponse {
|
||||
@@ -182,7 +183,7 @@ export interface LoginShopSelectionResponse {
|
||||
allowShoplessLogin: boolean
|
||||
message: string
|
||||
shops: Array<{
|
||||
id: number | string
|
||||
id: IdType
|
||||
shopName: string
|
||||
}>
|
||||
}
|
||||
@@ -197,7 +198,7 @@ export const adminAuthApi = {
|
||||
logout: () => {
|
||||
return adminApi.post<boolean>('/auth/logout')
|
||||
},
|
||||
switchShop: (shopId?: string | number) => {
|
||||
switchShop: (shopId?: IdType) => {
|
||||
return adminApi.post<AdminLoginResponse>('/auth/switch-shop', { shopId })
|
||||
},
|
||||
refreshToken: (refreshToken: string) => {
|
||||
@@ -206,7 +207,7 @@ export const adminAuthApi = {
|
||||
}
|
||||
|
||||
export interface ObjectStorageFileVO {
|
||||
id: number
|
||||
id: IdType
|
||||
fileName: string
|
||||
fileSize: number
|
||||
contentType: string
|
||||
@@ -264,18 +265,18 @@ export const adminFileApi = {
|
||||
cancelChunkUpload: (uploadId: string) => {
|
||||
return adminApi.delete<boolean>(`/object-storage-file/upload/${uploadId}`)
|
||||
},
|
||||
getSignedUrl: (id: number) => {
|
||||
getSignedUrl: (id: IdType) => {
|
||||
return adminApi.get<string>(`/object-storage-file/get-signed-url/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
export interface Tag {
|
||||
id: number
|
||||
id: IdType
|
||||
tagName: string
|
||||
textColor?: string
|
||||
bgColor?: string
|
||||
borderColor?: string
|
||||
shopId?: number
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
createTime: string
|
||||
updateTime: string
|
||||
@@ -285,33 +286,33 @@ export const adminTagApi = {
|
||||
listAllTags: () => {
|
||||
return adminApi.get<Tag[]>('/tag/list/all') as unknown as Promise<Tag[]>
|
||||
},
|
||||
listTagsByShopId: (shopId: number) => {
|
||||
listTagsByShopId: (shopId: IdType) => {
|
||||
return adminApi.get<Tag[]>(`/tag/list/by-shop/${shopId}`) as unknown as Promise<Tag[]>
|
||||
},
|
||||
createTag: (data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: number }) => {
|
||||
return adminApi.post<number>('/tag/create', data)
|
||||
createTag: (data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType }) => {
|
||||
return adminApi.post<IdType>('/tag/create', data)
|
||||
},
|
||||
updateTag: (id: number, data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: number }) => {
|
||||
updateTag: (id: IdType, data: { tagName: string; textColor?: string; bgColor?: string; borderColor?: string; shopId?: IdType }) => {
|
||||
return adminApi.put<boolean>(`/tag/update/${id}`, data)
|
||||
},
|
||||
deleteTag: (id: number) => {
|
||||
deleteTag: (id: IdType) => {
|
||||
return adminApi.delete<boolean>(`/tag/delete/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
export interface Artist {
|
||||
id: number
|
||||
id: IdType
|
||||
nickname: string
|
||||
account: string
|
||||
avatar?: string
|
||||
shopId?: number
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
createTime: string
|
||||
updateTime: string
|
||||
}
|
||||
|
||||
export const adminArtistApi = {
|
||||
listArtists: (shopId?: number) => {
|
||||
listArtists: (shopId?: IdType) => {
|
||||
const params: any = {}
|
||||
if (shopId) {
|
||||
params.shopId = shopId
|
||||
@@ -321,7 +322,7 @@ export const adminArtistApi = {
|
||||
}
|
||||
|
||||
export interface Coupon {
|
||||
id: number
|
||||
id: IdType
|
||||
couponCode?: string
|
||||
couponName: string
|
||||
couponType: number
|
||||
@@ -336,7 +337,7 @@ export interface Coupon {
|
||||
endTime: string
|
||||
status?: number
|
||||
statusName?: string
|
||||
shopId?: number
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
@@ -348,17 +349,17 @@ export interface Coupon {
|
||||
}
|
||||
|
||||
export const adminCouponApi = {
|
||||
listAllCoupons: (shopId?: number) => {
|
||||
listAllCoupons: (shopId?: IdType) => {
|
||||
const params = shopId ? { shopId } : {}
|
||||
return adminApi.get<Coupon[]>('/coupon/list/all', { params }) as unknown as Promise<Coupon[]>
|
||||
},
|
||||
createCoupon: (data: any) => {
|
||||
return adminApi.post<number>('/coupon/create', data)
|
||||
return adminApi.post<IdType>('/coupon/create', data)
|
||||
},
|
||||
updateCoupon: (id: number, data: any) => {
|
||||
updateCoupon: (id: IdType, data: any) => {
|
||||
return adminApi.put<boolean>(`/coupon/update/${id}`, data)
|
||||
},
|
||||
deleteCoupon: (id: number) => {
|
||||
deleteCoupon: (id: IdType) => {
|
||||
return adminApi.delete<boolean>(`/coupon/delete/${id}`)
|
||||
},
|
||||
distributeCoupon: (data: any) => {
|
||||
@@ -367,8 +368,8 @@ export const adminCouponApi = {
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: number
|
||||
shopId: number
|
||||
id: IdType
|
||||
shopId: IdType
|
||||
shopName?: string
|
||||
title: string
|
||||
description: string
|
||||
@@ -388,25 +389,25 @@ export interface Product {
|
||||
}
|
||||
|
||||
export const adminProductApi = {
|
||||
listProducts: (params: { page: number; size: number; keyword?: string; shopId?: number }) => {
|
||||
listProducts: (params: { page: number; size: number; keyword?: string; shopId?: IdType }) => {
|
||||
return adminApi.get<{ list: Product[]; total: number; page: number; size: number }>('/product/list', { params })
|
||||
},
|
||||
listAllProducts: () => {
|
||||
return adminApi.get<Product[]>('/product/list/all')
|
||||
},
|
||||
createProduct: (data: any) => {
|
||||
return adminApi.post<number>('/product/create', data)
|
||||
return adminApi.post<IdType>('/product/create', data)
|
||||
},
|
||||
updateProduct: (id: number, data: any) => {
|
||||
updateProduct: (id: IdType, data: any) => {
|
||||
return adminApi.put<boolean>(`/product/update/${id}`, data)
|
||||
},
|
||||
deleteProduct: (id: number) => {
|
||||
deleteProduct: (id: IdType) => {
|
||||
return adminApi.delete<boolean>(`/product/delete/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
export interface Shop {
|
||||
id: number
|
||||
id: IdType
|
||||
shopName: string
|
||||
description: string
|
||||
address: string
|
||||
@@ -438,31 +439,31 @@ export interface CreateShopRequest {
|
||||
}
|
||||
|
||||
export const adminShopApi = {
|
||||
listShops: (params: { page: number; size: number; keyword?: string; shopId?: number }) => {
|
||||
listShops: (params: { page: number; size: number; keyword?: string; shopId?: IdType }) => {
|
||||
return adminApi.get<ShopListResponse>('/shops/list', { params }) as unknown as Promise<ShopListResponse>
|
||||
},
|
||||
listAllShops: () => {
|
||||
return adminApi.get<Shop[]>('/shops/list/all') as unknown as Promise<Shop[]>
|
||||
},
|
||||
createShop: (data: CreateShopRequest) => {
|
||||
return adminApi.post<number>('/shops/create', data)
|
||||
return adminApi.post<IdType>('/shops/create', data)
|
||||
},
|
||||
updateShop: (id: number, data: CreateShopRequest) => {
|
||||
updateShop: (id: IdType, data: CreateShopRequest) => {
|
||||
return adminApi.put<boolean>(`/shops/update/${id}`, data)
|
||||
},
|
||||
updateShopStatus: (id: number, status: number) => {
|
||||
updateShopStatus: (id: IdType, status: number) => {
|
||||
return adminApi.put<boolean>(`/shops/status/${id}`, { status })
|
||||
},
|
||||
deleteShop: (id: number) => {
|
||||
deleteShop: (id: IdType) => {
|
||||
return adminApi.delete<boolean>(`/shops/delete/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserVO {
|
||||
id: number
|
||||
shopId?: number
|
||||
id: IdType
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
shopIds?: Array<number | string>
|
||||
shopIds?: IdType[]
|
||||
shopNames?: string[]
|
||||
nickname: string
|
||||
account: string
|
||||
@@ -471,7 +472,7 @@ export interface UserVO {
|
||||
signature?: string
|
||||
level?: string
|
||||
type: number
|
||||
vipId?: number
|
||||
vipId?: IdType
|
||||
createTime: string
|
||||
updateTime: string
|
||||
status?: number
|
||||
@@ -485,59 +486,59 @@ export interface PageResult<T> {
|
||||
}
|
||||
|
||||
export const adminUserApi = {
|
||||
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: number; status?: number }) => {
|
||||
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: IdType; status?: number }) => {
|
||||
return adminApi.get<PageResult<UserVO>>('/user/list', { params }) as unknown as Promise<PageResult<UserVO>>
|
||||
},
|
||||
listAllUsers: () => {
|
||||
return adminApi.get<UserVO[]>('/user/list/all') as unknown as Promise<UserVO[]>
|
||||
},
|
||||
createUser: (data: any) => {
|
||||
return adminApi.post<number>('/user/create', data)
|
||||
return adminApi.post<IdType>('/user/create', data)
|
||||
},
|
||||
updateUser: (id: number, data: any) => {
|
||||
updateUser: (id: IdType, data: any) => {
|
||||
return adminApi.put<boolean>(`/user/update/${id}`, data)
|
||||
},
|
||||
deleteUser: (id: number) => {
|
||||
deleteUser: (id: IdType) => {
|
||||
return adminApi.delete<boolean>(`/user/delete/${id}`)
|
||||
},
|
||||
unbindUser: (id: number) => {
|
||||
unbindUser: (id: IdType) => {
|
||||
return adminApi.put<boolean>(`/user/unbind/${id}`, {})
|
||||
},
|
||||
updateUserStatus: (id: number, status: number) => {
|
||||
updateUserStatus: (id: IdType, status: number) => {
|
||||
return adminApi.put<boolean>(`/user/status/${id}`, { status })
|
||||
},
|
||||
resetPassword: (id: number) => {
|
||||
resetPassword: (id: IdType) => {
|
||||
return adminApi.post<string>(`/user/reset-password/${id}`)
|
||||
},
|
||||
getUserInfo: () => {
|
||||
return adminApi.get<UserVO>('/user/info') as unknown as Promise<UserVO>
|
||||
},
|
||||
getUserAsset: (id: number) => {
|
||||
getUserAsset: (id: IdType) => {
|
||||
return adminApi.get<UserAssetVO>(`/user/${id}/asset`) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
getUserBalanceHistory: (id: number) => {
|
||||
getUserBalanceHistory: (id: IdType) => {
|
||||
return adminApi.get<UserBalanceHistoryItem[]>(`/user/${id}/balance/history`) as unknown as Promise<UserBalanceHistoryItem[]>
|
||||
},
|
||||
changeUserBalance: (id: number, data: AdminUserBalanceChangeRequest) => {
|
||||
changeUserBalance: (id: IdType, data: AdminUserBalanceChangeRequest) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/balance/change`, data) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
overrideUserVip: (id: number, data: AdminUserVipOverrideRequest) => {
|
||||
overrideUserVip: (id: IdType, data: AdminUserVipOverrideRequest) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/vip/override`, data) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
recalculateUserVip: (id: number) => {
|
||||
recalculateUserVip: (id: IdType) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/vip/recalculate`) as unknown as Promise<UserAssetVO>
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserAssetVO {
|
||||
userId: number
|
||||
userId: IdType
|
||||
nickname: string
|
||||
balance: number
|
||||
totalRechargeAmount: number
|
||||
lastRechargeTime?: string
|
||||
vipInfoId?: number
|
||||
vipInfoId?: IdType
|
||||
vipLevel: string
|
||||
benefitId?: number
|
||||
benefitId?: IdType
|
||||
benefitInfo?: string
|
||||
manualOverride: boolean
|
||||
vipStartTime?: string
|
||||
@@ -545,8 +546,8 @@ export interface UserAssetVO {
|
||||
}
|
||||
|
||||
export interface UserBalanceHistoryItem {
|
||||
id: number
|
||||
userId: number
|
||||
id: IdType
|
||||
userId: IdType
|
||||
userNickname?: string
|
||||
amount: number
|
||||
type?: string
|
||||
@@ -554,10 +555,10 @@ export interface UserBalanceHistoryItem {
|
||||
beforeBalance?: number
|
||||
afterBalance?: number
|
||||
changeScene?: string
|
||||
relatedOrderId?: number
|
||||
relatedOrderId?: IdType
|
||||
relatedOrderNo?: string
|
||||
externalOrderNo?: string
|
||||
operatorId?: number
|
||||
operatorId?: IdType
|
||||
remark?: string
|
||||
changeTime: string
|
||||
}
|
||||
@@ -565,7 +566,7 @@ export interface UserBalanceHistoryItem {
|
||||
export interface AdminUserBalanceChangeRequest {
|
||||
amount: number
|
||||
changeScene: string
|
||||
relatedOrderId?: number
|
||||
relatedOrderId?: IdType
|
||||
externalOrderNo?: string
|
||||
remark?: string
|
||||
}
|
||||
@@ -578,13 +579,13 @@ export interface AdminUserVipOverrideRequest {
|
||||
export const userApi = adminUserApi
|
||||
|
||||
export interface OrderVO {
|
||||
id: number
|
||||
id: IdType
|
||||
orderNo: string
|
||||
userId: number
|
||||
userId: IdType
|
||||
userNickname?: string
|
||||
shopId: number
|
||||
shopId: IdType
|
||||
shopName?: string
|
||||
artistId?: number
|
||||
artistId?: IdType
|
||||
artistName?: string
|
||||
totalAmount: number
|
||||
discountAmount: number
|
||||
@@ -597,16 +598,16 @@ export interface OrderVO {
|
||||
}
|
||||
|
||||
export const adminOrderApi = {
|
||||
listOrders: (params: { page: number; size: number; keyword?: string; status?: number; shopId?: number }) => {
|
||||
listOrders: (params: { page: number; size: number; keyword?: string; status?: number; shopId?: IdType }) => {
|
||||
return adminApi.get<PageResult<OrderVO>>('/order/list', { params })
|
||||
},
|
||||
updateOrderStatus: (id: number, status: number) => {
|
||||
updateOrderStatus: (id: IdType, status: number) => {
|
||||
return adminApi.put<boolean>(`/order/update-status/${id}`, { status })
|
||||
}
|
||||
}
|
||||
|
||||
export interface HotProductVO {
|
||||
id: number
|
||||
id: IdType
|
||||
title: string
|
||||
price: number
|
||||
likeCount: number
|
||||
@@ -614,7 +615,7 @@ export interface HotProductVO {
|
||||
}
|
||||
|
||||
export interface RecentActivityVO {
|
||||
id: number
|
||||
id: IdType
|
||||
type: string
|
||||
title?: string
|
||||
description: string
|
||||
@@ -638,8 +639,8 @@ export const adminDashboardApi = {
|
||||
}
|
||||
|
||||
export interface NailArtistInfoVO {
|
||||
id: number | string
|
||||
userId: number | string
|
||||
id: IdType
|
||||
userId: IdType
|
||||
identity: string
|
||||
experience: number
|
||||
skills: string
|
||||
@@ -647,7 +648,7 @@ export interface NailArtistInfoVO {
|
||||
status: number
|
||||
portfolio: string
|
||||
nickname: string
|
||||
shopId: number | string
|
||||
shopId: IdType
|
||||
shopName: string
|
||||
}
|
||||
|
||||
@@ -655,7 +656,7 @@ export const adminNailArtistApi = {
|
||||
listNailArtists: () => {
|
||||
return adminApi.get<NailArtistInfoVO[]>('/nail-artist/list')
|
||||
},
|
||||
getNailArtistInfo: (userId: number) => {
|
||||
getNailArtistInfo: (userId: IdType) => {
|
||||
return adminApi.get<NailArtistInfoVO>(`/nail-artist/get/${userId}`)
|
||||
},
|
||||
saveNailArtistInfo: (data: any) => {
|
||||
|
||||
Reference in New Issue
Block a user