This commit is contained in:
2026-01-29 10:43:43 +08:00
commit 4a76df3391
426 changed files with 74975 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
import request from '~/utils/request';
import type {ApiResult, PageResult} from '@/api';
import type {CmsProductComment, CmsProductCommentParam} from './model';
/**
* 分页查询产品评论
*/
export async function pageCmsProductComment(params: CmsProductCommentParam) {
const res = await request.get<ApiResult<PageResult<CmsProductComment>>>(
'/cms/cms-product-comment/page',
{
params
}
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询产品评论列表
*/
export async function listCmsProductComment(params?: CmsProductCommentParam) {
const res = await request.get<ApiResult<CmsProductComment[]>>(
'/cms/cms-product-comment',
{
params
}
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 添加产品评论
*/
export async function addCmsProductComment(data: CmsProductComment) {
const res = await request.post<ApiResult<unknown>>(
'/cms/cms-product-comment',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 修改产品评论
*/
export async function updateCmsProductComment(data: CmsProductComment) {
const res = await request.put<ApiResult<unknown>>(
'/cms/cms-product-comment',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 删除产品评论
*/
export async function removeCmsProductComment(id?: number) {
const res = await request.del<ApiResult<unknown>>(
'/cms/cms-product-comment/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 批量删除产品评论
*/
export async function removeBatchCmsProductComment(data: (number | undefined)[]) {
const res = await request.del<ApiResult<unknown>>(
'/cms/cms-product-comment/batch',
{
data
}
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据id查询产品评论
*/
export async function getCmsProductComment(id: number) {
const res = await request.get<ApiResult<CmsProductComment>>(
'/cms/cms-product-comment/' + id
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -0,0 +1,37 @@
import type { PageParam } from '@/api';
/**
* 产品评论
*/
export interface CmsProductComment {
// ID
id?: number;
// 产品ID
productId?: number;
// 用户ID
userId?: number;
// 昵称
nickname?: string;
// 用户头像
avatar?: string;
// 排序(数字越小越靠前)
sortNumber?: number;
// 评论内容
comments?: string;
// 状态
status?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
image?: string;
}
/**
* 产品评论搜索条件
*/
export interface CmsProductCommentParam extends PageParam {
id?: number;
userId?: number;
keywords?: string;
}