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 实测通过
这个提交包含在:
@@ -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') || {};
|
||||
|
||||
在新工单中引用
屏蔽一个用户