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 次删除

查看文件

@@ -286,7 +286,7 @@ import { ensureLoginOrRedirect } from '@/common/role.js';
const currentThemeKey = ref(getCurrentThemeKey());
const currentUserId = ref(Number(uni.getStorageSync('userId') || 1001));
const currentUserName = ref((uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').nickname) || '超能电竞玩家');
const currentUserName = ref((uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').nickname) || '同城用户');
const userBalance = ref('0.00');
const payMethod = ref('WECHAT'); // 'WECHAT' | 'BALANCE'
@@ -346,25 +346,25 @@ const loadUserWallet = async () => {
const expert = ref({
id: '',
nickname: '同城陪伴师',
avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150',
game: '同城陪伴',
price: 68,
nickname: '',
avatar: '',
game: '',
price: 0,
services: []
});
const selectedService = ref(null);
// 模板安全视图:即便服务包尚未加载完成,也不会出现 null.title 崩溃
// 模板安全视图:服务包未加载时展示中性占位,不伪造价格/服务名
const serviceView = computed(() => selectedService.value || {
id: 'base',
title: '同城陪伴基础服务',
price: Number(expert.value && expert.value.price) || 35,
id: '',
title: '暂未选择服务',
price: 0,
unit: '小时'
});
const hours = ref(2);
const timeType = ref('NOW');
const discount = ref(0);
const remark = ref('');
const meetVenue = ref('朝阳大悦城海底捞');
const meetVenue = ref('');
const meetCoords = ref({ latitude: null, longitude: null });
// 下单模式:EXPERT=指定大神,PLATFORM=平台派单(发布需求,附近大神抢单)
@@ -425,7 +425,13 @@ const isOffline = computed(() => {
});
onLoad(async (query) => {
const targetId = (query && query.expertId) ? query.expertId : '1';
const targetId = (query && query.expertId) ? String(query.expertId) : '';
if (!targetId) {
// 未指定大神:直接进入平台派单模式
orderMode.value = 'PLATFORM';
await loadLiveCoupons();
return;
}
try {
const liveExpert = await getCompanionDetail(targetId);
if (liveExpert) {
@@ -440,33 +446,11 @@ onLoad(async (query) => {
if (!selectedService.value && services.length > 0) {
selectedService.value = services[0];
}
// 兜底:大神尚未配置服务包时,按其基础时薪提供"基础陪伴服务",保证仍可下单
// (价格仍以服务端大神档案价为准,createOrder 会二次校验)
if (!selectedService.value) {
selectedService.value = {
id: 'base',
title: `${liveExpert.game || '同城陪伴'}基础陪伴服务`,
price: Number(liveExpert.price) || 35,
unit: '小时',
desc: '大神暂未配置服务包,按基础时薪计费'
};
}
}
} catch (err) {
console.warn('[OrderCreate] 获取线上大神详情异常:', err);
}
// 极端兜底:详情获取失败时也要保证不会因空服务崩溃
if (!selectedService.value) {
selectedService.value = {
id: 'base',
title: '同城陪伴基础服务',
price: Number(expert.value.price) || 35,
unit: '小时',
desc: ''
};
}
// 加载后台真实可用优惠券
await loadLiveCoupons();
});
@@ -579,6 +563,10 @@ const handlePay = async () => {
if (!ensureLoginOrRedirect('/pages/order/create')) {
return;
}
if (!isPlatformMode.value && !selectedService.value) {
uni.showToast({ title: '该大神暂未配置服务包,无法下单', icon: 'none' });
return;
}
// 平台派单校验:品类预算与碰面地点
if (isPlatformMode.value) {
if (!(Number(platformBudget.value) > 0)) {
@@ -605,7 +593,7 @@ const handlePay = async () => {
const usingUserCoupon = currentCoupon.value && currentCoupon.value.id && currentCoupon.value.id !== 'c_none';
const basePayload = {
buyerId: uid,
clientName: currentUserName.value || '超能电竞玩家',
clientName: currentUserName.value || '同城用户',
expertId: isPlatform ? 0 : expert.value.id,
companionName: isPlatform ? '平台派单' : expert.value.nickname,
expertAvatar: isPlatform ? '' : expert.value.avatar,

查看文件

@@ -355,7 +355,8 @@ import {
submitOrderReview as submitOrderReviewApi,
submitReport as submitReportApi,
requestWechatPayment,
uploadImage
uploadImage,
normalizeUserId
} from '@/common/api.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
@@ -547,16 +548,9 @@ const payOrder = async (id) => {
const contactExpert = (name) => {
uni.showActionSheet({
itemList: [`复制【${name}】陪玩开黑房间号`, '联系 7x24h 官方电竞客服'],
itemList: ['联系 7x24h 官方电竞客服'],
success: (res) => {
if (res.tapIndex === 0) {
uni.setClipboardData({
data: `PW-${Math.floor(100000 + Math.random() * 900000)}`,
success: () => {
uni.showToast({ title: '开黑房号已复制', icon: 'success' });
}
});
} else {
uni.showActionSheet({
itemList: [
'拨打官方服务热线 (400-888-6666)',
@@ -593,7 +587,7 @@ const getOrderCountdown = (order) => {
if (!isNaN(parsed)) createdAtTs = parsed;
}
if (!createdAtTs) {
createdAtTs = Date.now();
return '待支付';
}
const expireTs = createdAtTs + 15 * 60 * 1000;
const diffSec = Math.max(0, Math.floor((expireTs - nowTick.value) / 1000));
@@ -885,17 +879,23 @@ const toggleTag = (tag) => {
const submitReview = async () => {
if (!targetReviewOrder.value) return;
const content = reviewForm.value.content.trim();
if (!content) {
uni.showToast({ title: '请填写评价内容', icon: 'none' });
return;
}
submittingReview.value = true;
try {
const order = targetReviewOrder.value;
const expertId = order.expert ? order.expert.id : (order.expertId || 101);
const expertId = order.expert ? order.expert.id : (order.expertId || 0);
const cachedUser = uni.getStorageSync('userInfo') || {};
await submitOrderReviewApi(order.id, {
expertId,
userId: Number(uni.getStorageSync('userId') || 1001),
userNickname: '电竞玩家 (我)',
userId: normalizeUserId(),
userNickname: cachedUser.nickname || '',
rating: reviewForm.value.rating,
tags: reviewForm.value.selectedTags,
content: reviewForm.value.content.trim() || '大神技术很棒,履约准时,体验绝佳!'
content
});
order.isReviewed = true;