功能:落地待优化建议与VIP资产联动
This commit is contained in:
@@ -146,10 +146,10 @@ export interface Tag {
|
||||
|
||||
export const adminTagApi = {
|
||||
listAllTags: () => {
|
||||
return adminApi.get<Tag[]>('/tag/list/all')
|
||||
return adminApi.get<Tag[]>('/tag/list/all') as unknown as Promise<Tag[]>
|
||||
},
|
||||
listTagsByShopId: (shopId: number) => {
|
||||
return adminApi.get<Tag[]>(`/tag/list/by-shop/${shopId}`)
|
||||
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)
|
||||
@@ -185,15 +185,27 @@ export const adminArtistApi = {
|
||||
|
||||
export interface Coupon {
|
||||
id: number
|
||||
couponCode?: string
|
||||
couponName: string
|
||||
couponType: number
|
||||
couponTypeName?: string
|
||||
discountValue?: string
|
||||
minAmount?: number
|
||||
reduceAmount?: string
|
||||
totalCount?: number
|
||||
usedCount?: number
|
||||
remainingCount?: number
|
||||
startTime: string
|
||||
endTime: string
|
||||
status?: number
|
||||
statusName?: string
|
||||
shopId?: number
|
||||
shopName?: string
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatch?: number
|
||||
availableTags?: Tag[]
|
||||
unavailableTags?: Tag[]
|
||||
createTime: string
|
||||
updateTime: string
|
||||
}
|
||||
@@ -201,7 +213,7 @@ export interface Coupon {
|
||||
export const adminCouponApi = {
|
||||
listAllCoupons: (shopId?: number) => {
|
||||
const params = shopId ? { shopId } : {}
|
||||
return adminApi.get<Coupon[]>('/coupon/list/all', { params })
|
||||
return adminApi.get<Coupon[]>('/coupon/list/all', { params }) as unknown as Promise<Coupon[]>
|
||||
},
|
||||
createCoupon: (data: any) => {
|
||||
return adminApi.post<number>('/coupon/create', data)
|
||||
@@ -213,7 +225,7 @@ export const adminCouponApi = {
|
||||
return adminApi.delete<boolean>(`/coupon/delete/${id}`)
|
||||
},
|
||||
distributeCoupon: (data: any) => {
|
||||
return adminApi.post<boolean>('/coupon/distribute', data)
|
||||
return adminApi.post<boolean>('/coupon/distribute', null, { params: data })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,10 +300,10 @@ export interface CreateShopRequest {
|
||||
|
||||
export const adminShopApi = {
|
||||
listShops: (params: { page: number; size: number; keyword?: string; shopId?: number }) => {
|
||||
return adminApi.get<ShopListResponse>('/shops/list', { params })
|
||||
return adminApi.get<ShopListResponse>('/shops/list', { params }) as unknown as Promise<ShopListResponse>
|
||||
},
|
||||
listAllShops: () => {
|
||||
return adminApi.get<Shop[]>('/shops/list/all')
|
||||
return adminApi.get<Shop[]>('/shops/list/all') as unknown as Promise<Shop[]>
|
||||
},
|
||||
createShop: (data: CreateShopRequest) => {
|
||||
return adminApi.post<number>('/shops/create', data)
|
||||
@@ -311,12 +323,14 @@ export interface UserVO {
|
||||
nickname: string
|
||||
account: string
|
||||
avatar: string
|
||||
phone?: string
|
||||
signature?: string
|
||||
level?: string
|
||||
type: number
|
||||
vipId?: number
|
||||
createTime: string
|
||||
updateTime: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
export interface PageResult<T> {
|
||||
@@ -328,10 +342,10 @@ export interface PageResult<T> {
|
||||
|
||||
export const adminUserApi = {
|
||||
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: number; status?: number }) => {
|
||||
return adminApi.get<PageResult<UserVO>>('/user/list', { params })
|
||||
return adminApi.get<PageResult<UserVO>>('/user/list', { params }) as unknown as Promise<PageResult<UserVO>>
|
||||
},
|
||||
listAllUsers: () => {
|
||||
return adminApi.get<UserVO[]>('/user/list/all')
|
||||
return adminApi.get<UserVO[]>('/user/list/all') as unknown as Promise<UserVO[]>
|
||||
},
|
||||
createUser: (data: any) => {
|
||||
return adminApi.post<number>('/user/create', data)
|
||||
@@ -349,10 +363,71 @@ export const adminUserApi = {
|
||||
return adminApi.post<string>(`/user/reset-password/${id}`)
|
||||
},
|
||||
getUserInfo: () => {
|
||||
return adminApi.get<UserVO>('/user/info')
|
||||
return adminApi.get<UserVO>('/user/info') as unknown as Promise<UserVO>
|
||||
},
|
||||
getUserAsset: (id: number) => {
|
||||
return adminApi.get<UserAssetVO>(`/user/${id}/asset`) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
getUserBalanceHistory: (id: number) => {
|
||||
return adminApi.get<UserBalanceHistoryItem[]>(`/user/${id}/balance/history`) as unknown as Promise<UserBalanceHistoryItem[]>
|
||||
},
|
||||
changeUserBalance: (id: number, data: AdminUserBalanceChangeRequest) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/balance/change`, data) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
overrideUserVip: (id: number, data: AdminUserVipOverrideRequest) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/vip/override`, data) as unknown as Promise<UserAssetVO>
|
||||
},
|
||||
recalculateUserVip: (id: number) => {
|
||||
return adminApi.post<UserAssetVO>(`/user/${id}/vip/recalculate`) as unknown as Promise<UserAssetVO>
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserAssetVO {
|
||||
userId: number
|
||||
nickname: string
|
||||
balance: number
|
||||
totalRechargeAmount: number
|
||||
lastRechargeTime?: string
|
||||
vipInfoId?: number
|
||||
vipLevel: string
|
||||
benefitId?: number
|
||||
benefitInfo?: string
|
||||
manualOverride: boolean
|
||||
vipStartTime?: string
|
||||
vipExpireTime?: string
|
||||
}
|
||||
|
||||
export interface UserBalanceHistoryItem {
|
||||
id: number
|
||||
userId: number
|
||||
userNickname?: string
|
||||
amount: number
|
||||
type?: string
|
||||
currentBalance?: number
|
||||
beforeBalance?: number
|
||||
afterBalance?: number
|
||||
changeScene?: string
|
||||
relatedOrderId?: number
|
||||
relatedOrderNo?: string
|
||||
externalOrderNo?: string
|
||||
operatorId?: number
|
||||
remark?: string
|
||||
changeTime: string
|
||||
}
|
||||
|
||||
export interface AdminUserBalanceChangeRequest {
|
||||
amount: number
|
||||
changeScene: string
|
||||
relatedOrderId?: number
|
||||
externalOrderNo?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface AdminUserVipOverrideRequest {
|
||||
vipLevel: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 别名导出,兼容旧代码
|
||||
export const userApi = adminUserApi
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ export interface Coupon {
|
||||
status: number
|
||||
statusName: string
|
||||
shopId?: number
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatch?: number
|
||||
availableTags: Tag[]
|
||||
unavailableTags: Tag[]
|
||||
}
|
||||
@@ -41,6 +44,9 @@ export interface UserCoupon {
|
||||
statusName: string
|
||||
obtainTime: string
|
||||
useTime: string
|
||||
sourceType?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatched?: boolean
|
||||
}
|
||||
|
||||
export interface CreateCouponRequest {
|
||||
@@ -53,6 +59,9 @@ export interface CreateCouponRequest {
|
||||
totalCount: number
|
||||
startTime: string
|
||||
endTime: string
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatch?: number
|
||||
availableTagIds: number[]
|
||||
unavailableTagIds: number[]
|
||||
}
|
||||
@@ -136,11 +145,11 @@ export const couponApi = {
|
||||
},
|
||||
|
||||
// 获取作品可用的优惠券
|
||||
getAvailableCoupons: (productTags: string, productPrice: number) => {
|
||||
getAvailableCoupons: (productTags: string, productPrice: number, shopId?: number) => {
|
||||
return request({
|
||||
url: '/coupon/available',
|
||||
method: 'get',
|
||||
params: { productTags, productPrice }
|
||||
params: { productTags, productPrice, shopId }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ api.interceptors.response.use(
|
||||
const isWhitelistedPath = (url: string) => {
|
||||
return url?.includes('/user/login') ||
|
||||
url?.includes('/user/register') ||
|
||||
url?.includes('/user/check/') ||
|
||||
url?.includes('/user/refresh-token') ||
|
||||
url?.includes('/user/send-verification-code') ||
|
||||
url?.includes('/user/phone-login') ||
|
||||
|
||||
@@ -9,6 +9,7 @@ interface OrderItem {
|
||||
|
||||
interface CreateOrderRequest {
|
||||
couponId?: number
|
||||
couponSourceType?: string
|
||||
items: OrderItem[]
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,12 @@ export interface AvailabilityCheckResponse {
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface LoginAccountCheckResponse {
|
||||
exists: boolean
|
||||
nickname?: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface UpdatePhoneRequest {
|
||||
oldPhone: string
|
||||
newPhone: string
|
||||
@@ -92,6 +98,9 @@ export const userApi = {
|
||||
checkAccountAvailability: (account: string) => {
|
||||
return api.get<AvailabilityCheckResponse>(`/user/check/account/${encodeURIComponent(account)}`)
|
||||
},
|
||||
checkLoginAccountAvailability: (account: string) => {
|
||||
return api.get<LoginAccountCheckResponse>(`/user/check/login-account/${encodeURIComponent(account)}`)
|
||||
},
|
||||
checkPhoneAvailability: (phone: string) => {
|
||||
return api.get<AvailabilityCheckResponse>(`/user/check/phone/${encodeURIComponent(phone)}`)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user