新版本官网优化完成
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import request from '@/utils/request';
|
||||
import request from '~/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {CmsProductComment, CmsProductCommentParam} from './model';
|
||||
import {SERVER_API_URL} from '@/config/index';
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询产品评论
|
||||
*/
|
||||
export async function pageCmsProductComment(params: CmsProductCommentParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CmsProductComment>>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment/page',
|
||||
'/cms/cms-product-comment/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,15 +24,15 @@ export async function pageCmsProductComment(params: CmsProductCommentParam) {
|
||||
*/
|
||||
export async function listCmsProductComment(params?: CmsProductCommentParam) {
|
||||
const res = await request.get<ApiResult<CmsProductComment[]>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment',
|
||||
'/cms/cms-product-comment',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,13 +40,13 @@ export async function listCmsProductComment(params?: CmsProductCommentParam) {
|
||||
*/
|
||||
export async function addCmsProductComment(data: CmsProductComment) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment',
|
||||
'/cms/cms-product-comment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,42 +54,42 @@ export async function addCmsProductComment(data: CmsProductComment) {
|
||||
*/
|
||||
export async function updateCmsProductComment(data: CmsProductComment) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment',
|
||||
'/cms/cms-product-comment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品评论
|
||||
*/
|
||||
export async function removeCmsProductComment(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment/' + id
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/cms/cms-product-comment/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品评论
|
||||
*/
|
||||
export async function removeBatchCmsProductComment(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment/batch',
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/cms/cms-product-comment/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,10 +97,10 @@ export async function removeBatchCmsProductComment(data: (number | undefined)[])
|
||||
*/
|
||||
export async function getCmsProductComment(id: number) {
|
||||
const res = await request.get<ApiResult<CmsProductComment>>(
|
||||
SERVER_API_URL + '/cms/cms-product-comment/' + id
|
||||
'/cms/cms-product-comment/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
@@ -10,25 +10,21 @@ export interface CmsProductComment {
|
||||
productId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 昵称
|
||||
nickname?: string;
|
||||
// 用户头像
|
||||
avatar?: string;
|
||||
// 用户昵称
|
||||
nickname?: string;
|
||||
image?: string;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 评论内容
|
||||
comments?: string;
|
||||
// 评分
|
||||
rate?: number;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 子列表
|
||||
children?: CmsProductComment[];
|
||||
image?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user