fix(business-loop): complete arbitration balance refund, withdrawal rejection compensation, admin activity takedown, and companion violation alerts

这个提交包含在:
xcbyy
2026-10-13 17:18:11 +08:00
父节点 9e2c19088b
当前提交 173835dc4e
共有 5 个文件被更改,包括 168 次插入 和 22 次删除

查看文件

@@ -479,16 +479,18 @@ app.post('/api/activities/:id/adjust-price', async (req: Request, res: Response)
}
});
// 房主取消/解散组局并触发全额原路退款
// 房主或平台管理员取消/违规下架组局并触发全额原路退款
app.post('/api/activities/:id/cancel', async (req: Request, res: Response) => {
try {
const actId = String(req.params.id);
const { hostId, reason } = req.body;
const result = await repo.cancelActivity(actId, Number(hostId || 1001), reason);
const { hostId, reason, operatorRole } = req.body || {};
const headerRole = req.headers['x-user-role'];
const isAdmin = operatorRole === 'admin' || headerRole === 'admin';
const result = await repo.cancelActivity(actId, Number(hostId || 1001), reason, isAdmin);
res.json({
code: 20000,
data: result,
message: `组局已成功解散${result.refundedCount > 0 ? `,已原路全额退款 ${result.refundedCount} 位搭子` : ''}`
message: `组局已成功解散下架${result.refundedCount > 0 ? `,已原路全额退款 ${result.refundedCount} 位搭子` : ''}`
});
} catch (err: any) {
res.status(400).json({ code: 40000, message: err.message });