提交Salon旧接口清理与安全配置基线
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* Purpose: CartItem supports cart.ts by holding or executing the cart item page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
interface CartItem {
|
||||
productId: IdType
|
||||
quantity: number
|
||||
}
|
||||
|
||||
/**
|
||||
* cartApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const cartApi = {
|
||||
// 添加作品到购物车
|
||||
/**
|
||||
* `addToCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param item: CartItem caller-supplied value for `item: CartItem`
|
||||
*/
|
||||
addToCart: (item: CartItem) => {
|
||||
return api.post('/cart/add', item)
|
||||
},
|
||||
|
||||
// 从购物车移除作品
|
||||
/**
|
||||
* `removeFromCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
removeFromCart: (productId: IdType) => {
|
||||
return api.delete(`/cart/remove/${productId}`)
|
||||
},
|
||||
|
||||
// 批量从购物车移除作品
|
||||
/**
|
||||
* `batchRemoveFromCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param cartItemIds: IdType[] caller-supplied value for `cartItemIds: IdType[]`
|
||||
*/
|
||||
batchRemoveFromCart: (cartItemIds: IdType[]) => {
|
||||
return api.post('/cart/batch-remove', cartItemIds)
|
||||
},
|
||||
|
||||
// 更新购物车作品数量
|
||||
/**
|
||||
* `updateCartQuantity` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param item: CartItem caller-supplied value for `item: CartItem`
|
||||
*/
|
||||
updateCartQuantity: (item: CartItem) => {
|
||||
return api.put('/cart/update', item)
|
||||
},
|
||||
|
||||
// 获取购物车列表
|
||||
/**
|
||||
* `getCartList` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
getCartList: () => {
|
||||
return api.get('/cart/list')
|
||||
},
|
||||
|
||||
// 清空购物车
|
||||
/**
|
||||
* `clearCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
clearCart: () => {
|
||||
return api.delete('/cart/clear')
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import request from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* Purpose: Coupon supports coupon.ts by holding or executing the coupon page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface Coupon {
|
||||
id: IdType
|
||||
couponCode: string
|
||||
couponName: string
|
||||
couponType: number
|
||||
couponTypeName: string
|
||||
discountValue?: number
|
||||
minAmount?: number
|
||||
reduceAmount?: number
|
||||
totalCount: number
|
||||
usedCount: number
|
||||
remainingCount: number
|
||||
startTime: string
|
||||
endTime: string
|
||||
status: number
|
||||
statusName: string
|
||||
shopId?: IdType
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatch?: number
|
||||
availableTags: Tag[]
|
||||
unavailableTags: Tag[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: Tag supports coupon.ts by holding or executing the tag page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface Tag {
|
||||
id: IdType
|
||||
tagName?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: UserCoupon supports coupon.ts by holding or executing the user coupon page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface UserCoupon {
|
||||
id: IdType
|
||||
couponId: IdType
|
||||
couponName: string
|
||||
couponType: number
|
||||
couponTypeName: string
|
||||
discountValue: string
|
||||
minAmount: string
|
||||
reduceAmount: string
|
||||
startTime: string
|
||||
endTime: string
|
||||
status: number
|
||||
statusName: string
|
||||
obtainTime: string
|
||||
useTime: string
|
||||
sourceType?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatched?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: CreateCouponRequest supports coupon.ts by holding or executing the create coupon request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface CreateCouponRequest {
|
||||
couponCode: string
|
||||
couponName: string
|
||||
couponType: number
|
||||
discountValue?: number
|
||||
minAmount?: number
|
||||
reduceAmount?: number
|
||||
totalCount: number
|
||||
startTime: string
|
||||
endTime: string
|
||||
couponScene?: string
|
||||
requiredVipLevel?: string
|
||||
autoMatch?: number
|
||||
availableTagIds: IdType[]
|
||||
unavailableTagIds: IdType[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: CouponListResponse supports coupon.ts by holding or executing the coupon list response page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface CouponListResponse {
|
||||
list: Coupon[]
|
||||
total: number
|
||||
page: number
|
||||
size: number
|
||||
}
|
||||
|
||||
/**
|
||||
* couponApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const couponApi = {
|
||||
// 创建优惠券
|
||||
/**
|
||||
* `createCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
|
||||
*/
|
||||
createCoupon: (data: CreateCouponRequest) => {
|
||||
return request({
|
||||
url: '/coupon/create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
// 更新优惠券
|
||||
/**
|
||||
* `updateCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
|
||||
*/
|
||||
updateCoupon: (id: IdType, data: CreateCouponRequest) => {
|
||||
return request({
|
||||
url: `/coupon/update/${id}`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
// 删除优惠券
|
||||
/**
|
||||
* `deleteCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
deleteCoupon: (id: IdType) => {
|
||||
return request({
|
||||
url: `/coupon/delete/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取优惠券详情
|
||||
/**
|
||||
* `getCouponById` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
getCouponById: (id: IdType) => {
|
||||
return request({
|
||||
url: `/coupon/detail/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取优惠券列表
|
||||
/**
|
||||
* `listCoupons` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param params: { page: number; size: number; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; shopId?: IdType }`
|
||||
*/
|
||||
listCoupons: (params: { page: number; size: number; shopId?: IdType }) => {
|
||||
return request({
|
||||
url: '/coupon/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
// 为用户分配优惠券
|
||||
/**
|
||||
* `assignCouponToUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userId: IdType caller-supplied value for `userId: IdType`
|
||||
* @param couponId: IdType caller-supplied value for `couponId: IdType`
|
||||
*/
|
||||
assignCouponToUser: (userId: IdType, couponId: IdType) => {
|
||||
return request({
|
||||
url: '/coupon/assign',
|
||||
method: 'post',
|
||||
params: { userId, couponId }
|
||||
})
|
||||
},
|
||||
|
||||
// 获取用户优惠券列表
|
||||
listUserCoupons: async (status?: number): Promise<UserCoupon[]> => {
|
||||
return await request({
|
||||
url: '/coupon/user/list',
|
||||
method: 'get',
|
||||
params: { status }
|
||||
}) as UserCoupon[]
|
||||
},
|
||||
|
||||
// 使用优惠券
|
||||
/**
|
||||
* `useCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userCouponId: IdType caller-supplied value for `userCouponId: IdType`
|
||||
*/
|
||||
useCoupon: (userCouponId: IdType) => {
|
||||
return request({
|
||||
url: '/coupon/use',
|
||||
method: 'post',
|
||||
params: { userCouponId }
|
||||
})
|
||||
},
|
||||
|
||||
// 获取作品可用的优惠券
|
||||
getAvailableCoupons: async (productTags: string, productPrice: number, shopId?: IdType): Promise<UserCoupon[]> => {
|
||||
return await request({
|
||||
url: '/coupon/available',
|
||||
method: 'get',
|
||||
params: { productTags, productPrice, shopId }
|
||||
}) as UserCoupon[]
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
import axios, { AxiosError } from 'axios'
|
||||
import { authApi } from './auth'
|
||||
import { adminAuthApi } from './admin'
|
||||
import { wishlistApi } from './wishlist'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { API_BASE_URL } from '../config/api'
|
||||
import type { IdType } from '@/utils/id'
|
||||
@@ -393,6 +392,4 @@ export const fileApi = {
|
||||
}
|
||||
}
|
||||
|
||||
export { wishlistApi }
|
||||
|
||||
export default api
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* productLikeApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const productLikeApi = {
|
||||
/**
|
||||
* 点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `likeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
likeProduct: (productId: IdType) => {
|
||||
return api.post<boolean>(`/product-like/like/${productId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `unlikeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
unlikeProduct: (productId: IdType) => {
|
||||
return api.post<boolean>(`/product-like/unlike/${productId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 检查用户是否已点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `checkLikeStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
checkLikeStatus: (productId: IdType) => {
|
||||
return api.get<boolean>(`/product-like/check/${productId}`)
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* Purpose: WishlistItem supports wishlist.ts by holding or executing the wishlist item page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface WishlistItem {
|
||||
id: IdType
|
||||
userId: IdType
|
||||
productId: IdType
|
||||
groupId?: IdType | null
|
||||
groupName?: string | null
|
||||
note?: string | null
|
||||
sortOrder?: number | null
|
||||
product: {
|
||||
id: IdType
|
||||
shopId: IdType | null
|
||||
shopName?: string
|
||||
title: string
|
||||
description: string
|
||||
imageFileIds?: string
|
||||
imageUrls?: string[]
|
||||
price: number
|
||||
tags?: string
|
||||
tagList?: string[]
|
||||
tagInfos?: any[]
|
||||
likeCount?: number
|
||||
collectCount?: number
|
||||
approximateDuration?: string
|
||||
bookableArtists?: string
|
||||
availableCoupons?: string
|
||||
createTime: string
|
||||
updateTime: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface WishlistGroup {
|
||||
id: IdType
|
||||
name: string
|
||||
sortOrder: number
|
||||
itemCount: number
|
||||
items?: WishlistItem[]
|
||||
}
|
||||
|
||||
export interface WishlistInspiration {
|
||||
total: number
|
||||
groups: WishlistGroup[]
|
||||
}
|
||||
|
||||
export interface WishlistGroupPayload {
|
||||
name: string
|
||||
sortOrder?: number
|
||||
}
|
||||
|
||||
export interface WishlistAddWithGroupPayload {
|
||||
productId: IdType
|
||||
groupId?: IdType | null
|
||||
note?: string
|
||||
sortOrder?: number
|
||||
}
|
||||
|
||||
export interface WishlistMovePayload {
|
||||
wishlistId?: IdType
|
||||
productId?: IdType
|
||||
groupId?: IdType | null
|
||||
note?: string
|
||||
sortOrder?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* wishlistApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const wishlistApi = {
|
||||
addToWishlist: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.post<boolean>('/wishlist/add', { productId }) as unknown as boolean
|
||||
},
|
||||
|
||||
removeFromWishlist: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.post<boolean>('/wishlist/remove', { productId }) as unknown as boolean
|
||||
},
|
||||
|
||||
checkWishlist: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.get<boolean>(`/wishlist/check?productId=${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
getWishlist: async (): Promise<WishlistItem[]> => {
|
||||
return await api.get<WishlistItem[]>('/wishlist/list') as unknown as WishlistItem[]
|
||||
},
|
||||
|
||||
getGroups: async (): Promise<WishlistGroup[]> => {
|
||||
return await api.get<WishlistGroup[]>('/wishlist/groups') as unknown as WishlistGroup[]
|
||||
},
|
||||
|
||||
createGroup: async (payload: WishlistGroupPayload): Promise<IdType> => {
|
||||
return await api.post<IdType>('/wishlist/groups', payload) as unknown as IdType
|
||||
},
|
||||
|
||||
updateGroup: async (id: IdType, payload: WishlistGroupPayload): Promise<boolean> => {
|
||||
return await api.put<boolean>(`/wishlist/groups/${id}`, payload) as unknown as boolean
|
||||
},
|
||||
|
||||
deleteGroup: async (id: IdType): Promise<boolean> => {
|
||||
return await api.delete<boolean>(`/wishlist/groups/${id}`) as unknown as boolean
|
||||
},
|
||||
|
||||
addWithGroup: async (payload: WishlistAddWithGroupPayload): Promise<boolean> => {
|
||||
return await api.post<boolean>('/wishlist/add-with-group', payload) as unknown as boolean
|
||||
},
|
||||
|
||||
moveWishlist: async (payload: WishlistMovePayload): Promise<boolean> => {
|
||||
return await api.post<boolean>('/wishlist/move', payload) as unknown as boolean
|
||||
},
|
||||
|
||||
getInspiration: async (): Promise<WishlistInspiration> => {
|
||||
return await api.get<WishlistInspiration>('/wishlist/inspiration') as unknown as WishlistInspiration
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user