初始化

This commit is contained in:
2025-01-27 23:24:42 +08:00
parent c8a96306c4
commit 6ae8339299
421 changed files with 35687 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { GoodsComment, GoodsCommentParam } from './model';
import { MODULES_API_URL } from '@/config';
/**
* 分页查询评论表
*/
export async function pageGoodsComment(params: GoodsCommentParam) {
const res = await request.get<ApiResult<PageResult<GoodsComment>>>(
MODULES_API_URL + '/shop/goods-comment/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询评论表列表
*/
export async function listGoodsComment(params?: GoodsCommentParam) {
const res = await request.get<ApiResult<GoodsComment[]>>(
MODULES_API_URL + '/shop/goods-comment',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加评论表
*/
export async function addGoodsComment(data: GoodsComment) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/shop/goods-comment',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改评论表
*/
export async function updateGoodsComment(data: GoodsComment) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/goods-comment',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除评论表
*/
export async function removeGoodsComment(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/goods-comment/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除评论表
*/
export async function removeBatchGoodsComment(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/goods-comment/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询评论表
*/
export async function getGoodsComment(id: number) {
const res = await request.get<ApiResult<GoodsComment>>(
MODULES_API_URL + '/shop/goods-comment/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,61 @@
import type { PageParam } from '@/api';
/**
* 评论表
*/
export interface GoodsComment {
// 评论ID
id?: number;
// 用户ID
uid?: number;
// 订单ID
oid?: number;
// 商品唯一id
unique?: string;
// 商品id
goodsId?: number;
// 某种商品类型(普通商品、秒杀商品)
replyType?: string;
// 商品分数
goodsScore?: string;
// 服务分数
serviceScore?: string;
// 评论内容
comment?: string;
// 评论图片
pics?: string;
// 管理员回复内容
merchantReplyContent?: string;
// 管理员回复时间
merchantReplyTime?: number;
// 0未删除1已删除
isDel?: string;
// 0未回复1已回复
isReply?: string;
// 用户名称
nickname?: string;
// 用户头像
avatar?: string;
// 商品规格属性值,多个,号隔开
sku?: string;
// 状态, 0正常, 1冻结
status?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 用户ID
userId?: number;
// 租户id
tenantId?: number;
// 注册时间
createTime?: string;
// 更新时间
updateTime?: string;
}
/**
* 评论表搜索条件
*/
export interface GoodsCommentParam extends PageParam {
id?: number;
keywords?: string;
}