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 实测通过
这个提交包含在:
xcbyy
2026-10-21 16:21:10 +08:00
父节点 77aa4cb50b
当前提交 16f6419cba
共有 30 个文件被更改,包括 661 次插入 和 1366 次删除

查看文件

@@ -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),