feat(expert): full closure of expert revenue trends, multichannel withdrawals, service manage, review reply and post manage

这个提交包含在:
xcbyy
2026-10-13 09:13:06 +08:00
父节点 a004584109
当前提交 e867488d0d
共有 11 个文件被更改,包括 2565 次插入 和 103 次删除

查看文件

@@ -343,16 +343,29 @@ export async function completeOrder(orderId) {
}
/**
* 申请退款/售后
* 申请退款/售后仲裁工单 (支持理由、详细说明与图片凭证)
*/
export async function refundOrder(orderId) {
export async function refundOrder(orderId, data = {}) {
try {
const res = await http.post(`/orders/${orderId}/refund`);
const res = await http.post(`/orders/${orderId}/refund`, data);
return formatOrderData(res);
} catch (err) {
console.warn('[API] 申请退款网络异常:', err.message);
throw err;
}
}
/**
* 提交不良陪玩举报工单 (涉黄、涉赌、线下违规等)
*/
export async function submitReport(payload = {}) {
try {
const res = await http.post('/reports', payload);
return res;
} catch (err) {
console.warn('[API] 提交举报网络异常:', err.message);
throw err;
}
return null;
}
/**
@@ -483,11 +496,14 @@ export async function rechargeBalance(userId = 1001, amount) {
}
/**
* 佣金提现申请 (扣减可提现金额,写入提现待审核表与出账流水)
* 佣金提现申请 (支持微信零钱、支付宝、银行卡多渠道及账号信息)
*/
export async function withdrawCommission(userId = 1001, amount, channel = '微信商户零钱') {
export async function withdrawCommission(userId = 1001, amount, options = {}) {
try {
const res = await http.post(`/users/${userId}/withdraw`, { amount, channel });
const payload = typeof options === 'string'
? { amount, channel: options }
: { amount, ...options };
const res = await http.post(`/users/${userId}/withdraw`, payload);
return res;
} catch (err) {
console.warn('[API] 提现申请接口异常:', err.message);
@@ -495,6 +511,19 @@ export async function withdrawCommission(userId = 1001, amount, channel = '微
}
}
/**
* 查询用户提现记录与审批状态 (待审核/处理中/已打款/已驳回)
*/
export async function getUserWithdrawals(userId = 1001) {
try {
const res = await http.get(`/users/${userId}/withdrawals`);
return res || [];
} catch (err) {
console.warn('[API] 获取提现记录异常:', err.message);
return [];
}
}
/**
* 查询用户财务收支流水
*/
@@ -692,8 +721,30 @@ export async function applyPostParty(postId, applyData = {}) {
*/
export function uploadImage(tempFilePath) {
return new Promise((resolve, reject) => {
// 若本身已经是网络公网链接,直接返回
if (tempFilePath.startsWith('http://') || tempFilePath.startsWith('https://') || tempFilePath.startsWith('/uploads/')) {
if (!tempFilePath) return reject(new Error('图片路径为空'));
// 微信开发者工具临时路径形如 http://tmp/ 或 http://usr/
// 微信真机临时路径形如 wxfile://tmp_xxx 或 wxfile://clientdata/xxx
// H5 临时路径形如 blob:xxx
const isLocalTemp =
tempFilePath.startsWith('http://tmp/') ||
tempFilePath.startsWith('http://usr/') ||
tempFilePath.startsWith('wxfile://') ||
tempFilePath.startsWith('blob:');
// 只有真正的公网远程地址或相对静态路径,才无需上传直接返回
if (
!isLocalTemp &&
(tempFilePath.startsWith('http://') ||
tempFilePath.startsWith('https://') ||
tempFilePath.startsWith('/uploads/'))
) {
// 若是小程序端且为 /uploads/ 开头,补全完整公网域名
// #ifndef H5
if (tempFilePath.startsWith('/uploads/')) {
return resolve(`https://peiww.gynhc.com${tempFilePath}`);
}
// #endif
return resolve(tempFilePath);
}
@@ -712,7 +763,14 @@ export function uploadImage(tempFilePath) {
try {
const data = JSON.parse(uploadRes.data);
if (data && data.code === 20000 && data.data && data.data.url) {
resolve(data.data.url);
let finalUrl = data.data.url;
// 非H5平台(小程序端)图片访问需补全公网域名
// #ifndef H5
if (finalUrl.startsWith('/uploads/')) {
finalUrl = `https://peiww.gynhc.com${finalUrl}`;
}
// #endif
resolve(finalUrl);
} else {
reject(new Error((data && data.message) || '上传解析异常'));
}
@@ -777,4 +835,69 @@ export async function applyExpertCert(data) {
}
}
/**
* 获取大神多维收益走势统计分析 (近7天/近4周/近6个月)
*/
export async function getExpertRevenueTrends(expertId = 101) {
try {
const res = await http.get(`/expert/stats/${expertId}/trends`);
return res || { daily: [], weekly: [], monthly: [] };
} catch (err) {
console.warn('[API] 获取大神收益走势异常:', err.message);
return { daily: [], weekly: [], monthly: [] };
}
}
/**
* 大神感谢回复买家评价
*/
export async function replyOrderReview(reviewId, replyContent) {
try {
const res = await http.post(`/reviews/${reviewId}/reply`, { replyContent });
return res;
} catch (err) {
console.warn('[API] 回复评价异常:', err.message);
throw err;
}
}
/**
* 友圈本人动态删除
*/
export async function deletePost(postId, userId = 1001) {
try {
const res = await http.delete(`/posts/${postId}?userId=${userId}`);
return res;
} catch (err) {
console.warn('[API] 删除动态异常:', err.message);
throw err;
}
}
/**
* 获取大神专属细分服务包列表
*/
export async function getExpertServices(expertId = 101) {
try {
const res = await http.get(`/companions/${expertId}/services`);
return res || [];
} catch (err) {
console.warn('[API] 获取服务包异常:', err.message);
return [];
}
}
/**
* 切换大神单个服务包上下架状态
*/
export async function updateExpertServiceStatus(expertId = 101, serviceId, status) {
try {
const res = await http.put(`/companions/${expertId}/services/${serviceId}/status`, { status });
return res;
} catch (err) {
console.warn('[API] 切换服务包状态异常:', err.message);
throw err;
}
}