refactor(data): 全面移除小程序写死的演示/兜底数据,测试数据统一落库
- 删除无引用的 common/mock.js;登录页与个人中心的演示账号改为 DB 配置 demo_accounts + /api/auth/demo-accounts、/api/auth/demo-login(签发真实 token) - 移除订单/活动/大神/动态/推广/工作台/门票/充值/举报等页面的演示列表与假兜底;新增真实空态 - 修复伪造成功:活动调价、评价回复、核销、海报保存、图片上传失败、提现/核销固定 1001、随机开黑房号、随机即时匹配、假语音播放等 - 服务端移除 101/2006 合成用户与合成大神兜底、移除默认服务包虚构价格;演示账号清单可在后台关闭 - 111 套件/733 用例全绿;已部署 20261021_162041,demo-accounts/demo-login 实测通过
这个提交包含在:
@@ -429,7 +429,7 @@ const loadCouponUsable = async () => {
|
||||
couponUsable.value = 0;
|
||||
}
|
||||
};
|
||||
const cacheSizeText = ref('1.25 MB');
|
||||
const cacheSizeText = ref('0 KB');
|
||||
|
||||
// 分销推广管理
|
||||
const showDistributionModal = ref(false);
|
||||
@@ -446,32 +446,7 @@ const distributionRecords = ref([]);
|
||||
const distWithdrawAmount = ref('');
|
||||
const submittingDistWithdraw = ref(false);
|
||||
|
||||
const DEMO_ACCOUNTS = [
|
||||
{
|
||||
id: 1001,
|
||||
nickname: '同城局长',
|
||||
roleTag: 'host',
|
||||
roleDesc: '房主/局长',
|
||||
desc: '余额充足 · 组局发单',
|
||||
avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=200'
|
||||
},
|
||||
{
|
||||
id: 2001,
|
||||
nickname: '超能电竞玩家',
|
||||
roleTag: 'buyer',
|
||||
roleDesc: '普通买家',
|
||||
desc: '搭子报名 · 预约下单',
|
||||
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200'
|
||||
},
|
||||
{
|
||||
id: 2006,
|
||||
nickname: '苏苏学姐',
|
||||
roleTag: 'expert',
|
||||
roleDesc: '金牌陪伴师',
|
||||
desc: '接单工作台 · 4位核销',
|
||||
avatar: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?w=200'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
const user = ref({
|
||||
id: initialUserId || '',
|
||||
@@ -1075,7 +1050,7 @@ const updateCacheSize = () => {
|
||||
cacheSizeText.value = `${kb} KB`;
|
||||
}
|
||||
} catch (_) {
|
||||
cacheSizeText.value = '1.25 MB';
|
||||
cacheSizeText.value = '0 KB';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1150,7 +1125,18 @@ const copyInviteLink = () => {
|
||||
};
|
||||
|
||||
const savePosterImage = () => {
|
||||
uni.showToast({ title: '海报已保存至相册', icon: 'success' });
|
||||
const uid = normalizeUserId();
|
||||
if (!uid) {
|
||||
uni.showToast({ title: '请先登录后再分享', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const link = `https://peiww.gynhc.com/invite?code=PW${uid}`;
|
||||
uni.setClipboardData({
|
||||
data: link,
|
||||
success: () => {
|
||||
uni.showToast({ title: '邀请链接已复制,可粘贴到微信分享', icon: 'none', duration: 2200 });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const submitDistWithdraw = async () => {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<view class="dist-stat-divider"></view>
|
||||
<view class="dist-stat-col">
|
||||
<view class="code-box btn-active" @click="copyInviteCode">
|
||||
<text class="code-txt">PW{{ user.id || 2006 }}</text>
|
||||
<text class="code-txt">PW{{ user.id || '' }}</text>
|
||||
<text class="copy-tag">一键复制</text>
|
||||
</view>
|
||||
<text class="dist-stat-lbl">专属邀请码</text>
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<view class="poster-footer-code">
|
||||
<text class="lbl">邀请码:</text>
|
||||
<text class="val">PW{{ user.id || 2006 }}</text>
|
||||
<text class="val">PW{{ user.id || '' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -218,7 +218,8 @@ import {
|
||||
getDistributionTeam,
|
||||
getDistributionRecords,
|
||||
withdrawCommission,
|
||||
bindInviteCode
|
||||
bindInviteCode,
|
||||
normalizeUserId
|
||||
} from '@/common/api.js';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
@@ -232,11 +233,11 @@ const bindCodeInput = ref('');
|
||||
const defaultAvatar = 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=200';
|
||||
|
||||
const user = ref({
|
||||
id: 2006,
|
||||
nickname: '苏苏学姐',
|
||||
id: 0,
|
||||
nickname: '',
|
||||
avatar: defaultAvatar,
|
||||
commission: '0.00',
|
||||
invitedCount: 5
|
||||
invitedCount: 0
|
||||
});
|
||||
|
||||
const distActiveTab = ref('poster');
|
||||
@@ -250,25 +251,14 @@ const tabs = [
|
||||
];
|
||||
|
||||
const distributionTeam = ref({
|
||||
directCount: 3,
|
||||
indirectCount: 2,
|
||||
totalTeamCount: 5,
|
||||
directList: [
|
||||
{ id: 3001, nickname: '晨光玩家', avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=200', level: 1, createdAt: '2026-10-08 14:20', totalContribute: '48.50' },
|
||||
{ id: 3002, nickname: '风暴骑士', avatar: 'https://images.unsplash.com/photo-1570295999919-56ceb5ecca61?w=200', level: 1, createdAt: '2026-10-09 11:35', totalContribute: '32.00' },
|
||||
{ id: 3003, nickname: '月下独酌', avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=200', level: 1, createdAt: '2026-10-10 09:12', totalContribute: '19.80' }
|
||||
],
|
||||
indirectList: [
|
||||
{ id: 4001, nickname: '极光闪电', avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200', level: 2, createdAt: '2026-10-11 16:45', totalContribute: '12.60' },
|
||||
{ id: 4002, nickname: '晴空万里', avatar: 'https://images.unsplash.com/photo-1522075469751-3a6694fb2f61?w=200', level: 2, createdAt: '2026-10-12 18:02', totalContribute: '8.40' }
|
||||
]
|
||||
directCount: 0,
|
||||
indirectCount: 0,
|
||||
totalTeamCount: 0,
|
||||
directList: [],
|
||||
indirectList: []
|
||||
});
|
||||
|
||||
const distributionRecords = ref([
|
||||
{ id: 'REC_101', orderNo: 'ORD_2026101201', fromUserName: '晨光玩家', level: 1, ratePercent: 5, commission: '25.00', orderAmount: '500.00', status: '已入账', createdAt: '2026-10-12 20:30' },
|
||||
{ id: 'REC_102', orderNo: 'ORD_2026101102', fromUserName: '风暴骑士', level: 1, ratePercent: 5, commission: '16.00', orderAmount: '320.00', status: '已入账', createdAt: '2026-10-11 19:15' },
|
||||
{ id: 'REC_103', orderNo: 'ORD_2026101003', fromUserName: '极光闪电', level: 2, ratePercent: 2, commission: '6.40', orderAmount: '320.00', status: '已入账', createdAt: '2026-10-10 15:00' }
|
||||
]);
|
||||
const distributionRecords = ref([]);
|
||||
|
||||
const distWithdrawAmount = ref('');
|
||||
const submittingDistWithdraw = ref(false);
|
||||
@@ -311,7 +301,7 @@ const handleBack = () => {
|
||||
};
|
||||
|
||||
const copyInviteCode = () => {
|
||||
const code = `PW${user.value.id || 2006}`;
|
||||
const code = `PW${normalizeUserId()}`;
|
||||
uni.setClipboardData({
|
||||
data: code,
|
||||
success: () => {
|
||||
@@ -321,7 +311,7 @@ const copyInviteCode = () => {
|
||||
};
|
||||
|
||||
const copyInviteLink = () => {
|
||||
const link = `https://peiww.gynhc.com/invite?code=PW${user.value.id || 2006}`;
|
||||
const link = `https://peiww.gynhc.com/invite?code=PW${normalizeUserId()}`;
|
||||
uni.setClipboardData({
|
||||
data: link,
|
||||
success: () => {
|
||||
@@ -331,7 +321,18 @@ const copyInviteLink = () => {
|
||||
};
|
||||
|
||||
const savePosterImage = () => {
|
||||
uni.showToast({ title: '海报已保存至相册', icon: 'success' });
|
||||
const uid = normalizeUserId();
|
||||
if (!uid) {
|
||||
uni.showToast({ title: '请先登录后再分享', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const link = `https://peiww.gynhc.com/invite?code=PW${uid}`;
|
||||
uni.setClipboardData({
|
||||
data: link,
|
||||
success: () => {
|
||||
uni.showToast({ title: '邀请链接已复制,可粘贴到微信分享', icon: 'none', duration: 2200 });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleBindInviteCode = async () => {
|
||||
@@ -341,7 +342,7 @@ const handleBindInviteCode = async () => {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const uid = user.value.id || 2006;
|
||||
const uid = normalizeUserId();
|
||||
const res = await bindInviteCode(uid, code);
|
||||
user.value.inviterId = res.inviterId;
|
||||
bindCodeInput.value = '';
|
||||
@@ -381,7 +382,7 @@ const submitDistWithdraw = async () => {
|
||||
submittingDistWithdraw.value = true;
|
||||
uni.showLoading({ title: '正在提交申请...' });
|
||||
try {
|
||||
const uid = user.value.id || 2006;
|
||||
const uid = normalizeUserId();
|
||||
await withdrawCommission(uid, amount, { channel: 'WECHAT' });
|
||||
user.value.commission = (currentComm - amount).toFixed(2);
|
||||
distWithdrawAmount.value = '';
|
||||
@@ -397,7 +398,7 @@ const submitDistWithdraw = async () => {
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
const uid = uni.getStorageSync('userId') || 2006;
|
||||
const uid = normalizeUserId();
|
||||
try {
|
||||
const [profile, teamData, records] = await Promise.all([
|
||||
getUserProfile(uid).catch(() => null),
|
||||
|
||||
@@ -219,26 +219,17 @@ import { onShow } from '@dcloudio/uni-app';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { getNavBarInfo } from '@/common/nav.js';
|
||||
import { getUserProfile, rechargeBalance, getRechargeTiers, requestWechatPayment } from '@/common/api.js';
|
||||
import { getUserProfile, rechargeBalance, getRechargeTiers, requestWechatPayment, normalizeUserId } from '@/common/api.js';
|
||||
|
||||
const currentThemeKey = ref(getCurrentThemeKey());
|
||||
const navInfo = ref(getNavBarInfo());
|
||||
|
||||
const currentUserId = ref(1001);
|
||||
const currentUserId = ref(0);
|
||||
const userBalance = ref('0.00');
|
||||
|
||||
// 预设阶梯列表 (自带高质量官方预置,支持后台动态更新)
|
||||
const DEFAULT_TIERS = [
|
||||
{ id: 1, amount: 50, bonusAmount: 0, tag: '基础充值' },
|
||||
{ id: 2, amount: 100, bonusAmount: 5, tag: '热门畅享' },
|
||||
{ id: 3, amount: 200, bonusAmount: 15, tag: '超值加赠' },
|
||||
{ id: 4, amount: 500, bonusAmount: 50, tag: '尊享特惠' },
|
||||
{ id: 5, amount: 1000, bonusAmount: 120, tag: '土豪专享' },
|
||||
{ id: 6, amount: 2000, bonusAmount: 300, tag: '超神狂欢' }
|
||||
];
|
||||
|
||||
const tierList = ref([...DEFAULT_TIERS]);
|
||||
const selectedTierIndex = ref(1); // 默认选中 100 元 (热门畅享)
|
||||
// 充值档位由后台配置(recharge_tiers),小程序端不写死
|
||||
const tierList = ref([]);
|
||||
const selectedTierIndex = ref(0);
|
||||
const isCustomMode = ref(false);
|
||||
const customAmountText = ref('');
|
||||
const isInputFocused = ref(false);
|
||||
@@ -352,7 +343,7 @@ const clearCustomAmount = () => {
|
||||
// 加载充值档位与用户数据
|
||||
const loadData = async () => {
|
||||
try {
|
||||
const uid = uni.getStorageSync('userId') || 1001;
|
||||
const uid = normalizeUserId();
|
||||
currentUserId.value = uid;
|
||||
const profile = await getUserProfile(uid);
|
||||
if (profile && profile.balance !== undefined) {
|
||||
@@ -405,7 +396,7 @@ const handleConfirmRecharge = async () => {
|
||||
uni.showLoading({ title: '正在调起微信支付...', mask: true });
|
||||
|
||||
try {
|
||||
const uid = currentUserId.value || uni.getStorageSync('userId') || 1001;
|
||||
const uid = currentUserId.value || normalizeUserId();
|
||||
await requestWechatPayment({
|
||||
amount: payAmount,
|
||||
title: `钱包余额充值 ¥${payAmount}`,
|
||||
@@ -416,12 +407,14 @@ const handleConfirmRecharge = async () => {
|
||||
const res = await rechargeBalance(uid, payAmount, bonus);
|
||||
uni.hideLoading();
|
||||
|
||||
// 更新本地资产与全局缓存
|
||||
// 余额以服务端返回为准;未返回则重新拉取,不在本地伪造入账
|
||||
if (res && res.balance !== undefined) {
|
||||
userBalance.value = String(res.balance);
|
||||
} else {
|
||||
const cur = parseFloat(userBalance.value) || 0;
|
||||
userBalance.value = (cur + payAmount + bonus).toFixed(2);
|
||||
const fresh = await getUserProfile(uid).catch(() => null);
|
||||
if (fresh && fresh.balance !== undefined) {
|
||||
userBalance.value = String(fresh.balance);
|
||||
}
|
||||
}
|
||||
|
||||
const userInfo = uni.getStorageSync('userInfo') || {};
|
||||
|
||||
@@ -266,13 +266,13 @@ const getFeedbackText = (rpt) => {
|
||||
if (rpt.handleNote || rpt.handleResult) {
|
||||
return rpt.handleNote || rpt.handleResult;
|
||||
}
|
||||
if (rpt.status === '已核实处罚' || rpt.status === '已处置') {
|
||||
return '平台已核实违规事实并对涉事账号或内容采取限制处罚措施,感谢您共同维护社区环境。';
|
||||
}
|
||||
if (rpt.status === '已驳回') {
|
||||
return '经安全专员核查,暂未发现明显违规行为;若有补充凭证可随时联系官方在线客服申诉。';
|
||||
return '该举报未被采纳';
|
||||
}
|
||||
return '平台安全专员正在核实处理中,预计 24 小时内同步处置结果。';
|
||||
if (rpt.status === '已核实处罚' || rpt.status === '已处置') {
|
||||
return '已处理';
|
||||
}
|
||||
return '处理中';
|
||||
};
|
||||
|
||||
const handleCopyReportNo = (id) => {
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
<view class="reject-title-row">
|
||||
<text class="reject-title">审核未通过说明:</text>
|
||||
</view>
|
||||
<text class="reject-reason">{{ item.reason || '收款信息不完整或账户异常,请核对后重试。' }}</text>
|
||||
<text class="reject-reason">{{ item.reason || '未填写驳回原因' }}</text>
|
||||
<button class="btn-re-withdraw btn-active" @click="goToWithdraw">重新发起申请</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -352,7 +352,7 @@ const handleSubmitWithdraw = async () => {
|
||||
channel: 'WECHAT'
|
||||
};
|
||||
|
||||
const res = await withdrawCommission(1001, amt, payload);
|
||||
const res = await withdrawCommission(normalizeUserId(), amt, payload);
|
||||
uni.hideLoading();
|
||||
isSubmitting.value = false;
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户