You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
1.9 KiB
105 lines
1.9 KiB
import request from '@/utils/request'
|
|
|
|
// 查询答复列表
|
|
export function listAnswers(query) {
|
|
return request({
|
|
url: '/system/answers/list',
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
}
|
|
|
|
// 查询答复详细
|
|
export function getAnswers(id) {
|
|
return request({
|
|
url: '/system/answers/' + id,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
// 新增答复
|
|
export function addAnswers(data) {
|
|
return request({
|
|
url: '/system/answers',
|
|
method: 'post',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
// 修改答复
|
|
export function updateAnswers(data) {
|
|
return request({
|
|
url: '/system/answers',
|
|
method: 'put',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
// 删除答复
|
|
export function delAnswers(id) {
|
|
return request({
|
|
url: '/system/answers/' + id,
|
|
method: 'delete'
|
|
})
|
|
}
|
|
|
|
// 以下是新增的回复相关API
|
|
|
|
// 查询顶级答复列表
|
|
export function listRootAnswers(questionId, query) {
|
|
return request({
|
|
url: `/system/answers/question/${questionId}/roots`,
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
}
|
|
|
|
// 查询答复树形结构
|
|
export function getAnswerTree(questionId) {
|
|
return request({
|
|
url: `/system/answers/question/${questionId}/tree`,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
// 查询子回复列表
|
|
export function listChildrenAnswers(parentId, query) {
|
|
return request({
|
|
url: `/system/answers/parent/${parentId}/children`,
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
}
|
|
|
|
// 新增回复
|
|
export function addReply(data) {
|
|
return request({
|
|
url: '/system/answers/reply',
|
|
method: 'post',
|
|
data: data
|
|
})
|
|
}
|
|
|
|
// 点赞答复
|
|
export function likeAnswer(id) {
|
|
return request({
|
|
url: `/system/answers/${id}/like`,
|
|
method: 'post'
|
|
})
|
|
}
|
|
|
|
// 取消点赞答复
|
|
export function unlikeAnswer(id) {
|
|
return request({
|
|
url: `/system/answers/${id}/unlike`,
|
|
method: 'post'
|
|
})
|
|
}
|
|
|
|
// 获取问题的答案数量
|
|
export function countAnswersByQuestionId(questionId) {
|
|
return request({
|
|
url: `/system/answers/count/${questionId}`,
|
|
method: 'get'
|
|
})
|
|
}
|