2026-06-11 15:51:45 +08:00
|
|
|
|
import { request } from "@/utils/request.js";
|
|
|
|
|
|
|
|
|
|
|
|
// 获取随机一组PK主题
|
|
|
|
|
|
export const fetchRandomTopicList = async () => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/random",
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户投票
|
|
|
|
|
|
* @param { pkId, itemId }
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const vote = async (data) => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/vote",
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
data,
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2026-06-15 19:59:07 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取PK 评论列表
|
|
|
|
|
|
* @param { pkId: string, page: number, orderBy: string }
|
|
|
|
|
|
* @param { orderBy: string } 排序字段,可选值:'hot' | 'new',
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const fetchCommentList = async (data) => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/comment/list",
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
data,
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取PK 评论回复
|
|
|
|
|
|
* @param { pkId: string, rootCommentId: string, page: number }
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const fetchCommentReplyList = async (data) => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/comment/replies",
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
data,
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 发布PK 评论
|
|
|
|
|
|
* @param { pkId: string, content: string, parentCommentId?: string, replyToCommentId?: string }
|
|
|
|
|
|
* @param { parentCommentId?: string } 父评论ID,回复时必填
|
|
|
|
|
|
* @param { replyToCommentId?: string } 回复的评论ID,回复时必填
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const publishComment = async (data) => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/comment",
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
data,
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* PK 评论 点赞
|
|
|
|
|
|
* @param { commentId: string }
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const likeComment = async (data) => {
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: "/api/rating/pk/comment/like",
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
data,
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|