fix: 完善全系统业务闭环(大神入驻联动用户角色、服务评价人工下架监管、友圈搭子上车审核与抽屉)
这个提交包含在:
@@ -1903,6 +1903,32 @@ app.post('/api/reviews/:id/reply', async (req: Request, res: Response) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 管理员全量查询评价与回复列表
|
||||
app.get('/api/reviews', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const expertId = req.query.expertId ? Number(req.query.expertId) : undefined;
|
||||
const orderId = req.query.orderId ? String(req.query.orderId) : undefined;
|
||||
const reviews = await repo.getOrderReviews(expertId, orderId);
|
||||
res.json({
|
||||
code: 20000,
|
||||
data: reviews
|
||||
});
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ code: 50000, message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 管理员违规下架/删除评价
|
||||
app.delete('/api/reviews/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
await repo.deleteReview(String(id));
|
||||
res.json({ code: 20000, message: '违规评价已成功删除,大神信誉评分已重新计算' });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ code: 50000, message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 友圈本人动态删除接口
|
||||
app.delete('/api/posts/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
@@ -2003,6 +2029,41 @@ app.post('/api/posts/:id/apply', async (req: Request, res: Response) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 获取指定动态或全部搭子上车申请列表
|
||||
app.get('/api/posts/:id/applies', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const postId = String(req.params.id);
|
||||
const applies = await repo.getPostApplies(postId);
|
||||
res.json({ code: 20000, data: applies });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ code: 50000, message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/post-applies', async (_req: Request, res: Response) => {
|
||||
try {
|
||||
const applies = await repo.getPostApplies();
|
||||
res.json({ code: 20000, data: applies });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ code: 50000, message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 审核/处置搭子上车申请 (同意/谢绝)
|
||||
app.post('/api/post-applies/:id/handle', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const applyId = String(req.params.id);
|
||||
const { status } = req.body || {};
|
||||
if (!status || !['ACCEPTED', 'REJECTED'].includes(status)) {
|
||||
return res.status(400).json({ code: 40000, message: '状态参数必须为 ACCEPTED 或 REJECTED' });
|
||||
}
|
||||
const result = await repo.handlePostApply(applyId, status);
|
||||
res.json({ code: 20000, data: result, message: status === 'ACCEPTED' ? '已同意搭子上车申请' : '已谢绝搭子上车申请' });
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ code: 50000, message: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// 7.8 陪玩收藏管理接口 (收藏/取消收藏/列表/状态探测)
|
||||
app.get('/api/favorites', async (req: Request, res: Response) => {
|
||||
try {
|
||||
|
||||
在新工单中引用
屏蔽一个用户