功能:完善评论测试与优惠券最优选择

This commit is contained in:
xiaowang
2026-05-16 14:28:42 +08:00
parent 1f05e0ab44
commit 4563dd2538
31 changed files with 1130 additions and 581 deletions
+23
View File
@@ -360,6 +360,29 @@ export const adminCouponApi = {
}
}
export interface AdminCommentVO {
id: IdType
userId: IdType
userNickname?: string
shopId?: IdType
shopName?: string
productId?: IdType
productTitle?: string
commentContent: string
parentCommentId?: IdType
parentCommentContent?: string
createTime?: string
}
export const adminCommentApi = {
listComments: (params: { productId?: IdType; userId?: IdType; shopId?: IdType; keyword?: string }) => {
return adminApi.get<AdminCommentVO[]>('/comment/list', { params }) as unknown as Promise<AdminCommentVO[]>
},
deleteComment: (id: IdType) => {
return adminApi.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
}
}
export interface Product {
id: IdType
shopId: IdType
+31
View File
@@ -0,0 +1,31 @@
import api from './index'
import type { IdType } from '@/utils/id'
export interface CommentVO {
id: IdType
userId: IdType
userNickname?: string
shopId?: IdType
shopName?: string
productId?: IdType
productTitle?: string
commentContent: string
parentCommentId?: IdType
parentCommentContent?: string
likeCount?: number
createTime?: string
updateTime?: string
replies?: CommentVO[]
}
export const commentApi = {
listByProduct: (productId: IdType) => {
return api.get<CommentVO[]>(`/comment/list/product/${productId}`) as unknown as Promise<CommentVO[]>
},
create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => {
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
},
delete: (id: IdType) => {
return api.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
}
}
+2
View File
@@ -60,6 +60,7 @@ const isAuthFreePath = (url?: string) => {
'/user/reset-password-by-phone',
'/product/get/',
'/product/list/',
'/comment/list/product/',
'/shop/get/',
'/shop/list/public',
'/shop/list/simple',
@@ -150,6 +151,7 @@ api.interceptors.response.use(
url?.includes('/user/phone-login') ||
url?.includes('/product/get/') ||
url?.includes('/product/list/') ||
url?.includes('/comment/list/product/') ||
url?.includes('/shop/get/') ||
url?.includes('/shop/list/public') ||
url?.includes('/shop/list/simple') ||