feat(closed-loop): complete end-to-end closed loops across miniapp, backend, and admin

这个提交包含在:
xcbyy
2026-10-14 10:13:50 +08:00
父节点 f8e81d2df4
当前提交 51c19d6063
共有 14 个文件被更改,包括 996 次插入 和 134 次删除

查看文件

@@ -244,7 +244,7 @@ export function formatOrderData(raw) {
if (statusKey === '待支付' || statusKey === '待付款') statusKey = 'PENDING_PAY';
else if (statusKey === '已到场核销' || statusKey === '履约中' || statusKey === '服务中') statusKey = 'IN_SERVICE';
else if (statusKey === '已完成') statusKey = 'COMPLETED';
else if (statusKey === '争议仲裁中' || statusKey === '退款中' || statusKey === '已全额退款') statusKey = 'REFUNDING';
else if (statusKey === '争议仲裁中' || statusKey === '退款中' || statusKey === '已退款' || statusKey === '已全额退款') statusKey = 'REFUNDING';
else if (statusKey === '已取消') statusKey = 'CANCELLED';
const companionAvatar = raw.expertAvatar || raw.expert_avatar || raw.avatar ||
@@ -266,6 +266,7 @@ export function formatOrderData(raw) {
quantity: Number(raw.durationHours || raw.duration_hours || raw.quantity || 2),
totalAmount: Number(raw.amount || raw.totalAmount || 0),
status: statusKey,
rawStatus: raw.status || '履约中',
meetVenue: raw.location || raw.meetVenue || '北京市公开商圈',
expenseBurden: raw.expenseBurden || raw.expense_burden || 'AA制各自付',
payType: raw.payType || raw.pay_type || 'WECHAT',
@@ -418,6 +419,7 @@ export async function getPosts(category, userId) {
return {
id: p.id,
userId: p.userId || p.user_id || 0,
author: p.author || '神秘同好',
avatar: p.avatar || 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150',
tag: p.tag || '同城认证',
@@ -433,7 +435,10 @@ export async function getPosts(category, userId) {
liked: finalLiked || isLocallyLiked,
comments: Number(p.comments) || 0,
views: Number(p.views) || 1,
category: p.category || 'partner'
category: p.category || 'partner',
applyCount: Number(p.applyCount) || 0,
pendingApplyCount: Number(p.pendingApplyCount) || 0,
myApplyStatus: p.myApplyStatus || null
};
});
}
@@ -1039,3 +1044,48 @@ export async function getDistributionRecords(userId) {
return [];
}
}
/**
* 绑定上级推荐人邀请码 (如 PW1001)
*/
export async function bindInviteCode(userId, inviteCode) {
const uid = normalizeUserId(userId);
const res = await http.post('/distribution/bind', { userId: uid, inviteCode });
return res;
}
/**
* 获取指定友圈动态的搭子上车申请列表 (供动态房主查看与审批)
*/
export async function getPostApplies(postId) {
try {
const res = await http.get(`/posts/${postId}/applies`);
return res || [];
} catch (err) {
console.warn('[API] 获取搭子上车申请列表异常:', err.message);
return [];
}
}
/**
* 房主或管理员处置搭子上车申请 (ACCEPTED | REJECTED)
*/
export async function handlePostApply(applyId, status) {
const res = await http.post(`/post-applies/${applyId}/handle`, { status });
return res;
}
/**
* 获取当前用户提交的违规举报工单与处理结果反馈
*/
export async function getMyReports(userId) {
const uid = normalizeUserId(userId);
try {
const res = await http.get(`/reports?reporterId=${uid}`);
return res || [];
} catch (err) {
console.warn('[API] 获取我的举报记录异常:', err.message);
return [];
}
}