gameSeriveUniapp/mock/service.ts
2026-01-12 16:48:28 +08:00

203 lines
6.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Mock 服务数据
*/
import type { ServiceCategory, Service } from '@/types'
// 模拟服务分类
export const mockCategories: ServiceCategory[] = [
{
id: 1,
parentId: 0,
name: '王者荣耀',
icon: '🎮',
sortOrder: 1,
status: '0',
createTime: '2024-12-01 10:00:00'
},
{
id: 2,
parentId: 0,
name: '英雄联盟',
icon: '⚔️',
sortOrder: 2,
status: '0',
createTime: '2024-12-01 10:00:00'
},
{
id: 3,
parentId: 0,
name: '和平精英',
icon: '🔫',
sortOrder: 3,
status: '0',
createTime: '2024-12-01 10:00:00'
},
{
id: 4,
parentId: 0,
name: '原神',
icon: '✨',
sortOrder: 4,
status: '0',
createTime: '2024-12-01 10:00:00'
}
]
// 模拟服务列表
export const mockServices: Service[] = [
{
id: 1,
tenantId: 1001,
categoryId: 1,
categoryName: '王者荣耀',
name: '王者荣耀段位提升 - 黄金到钻石',
coverImage: 'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
images: JSON.stringify([
'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600'
]),
price: 199,
originalPrice: 299,
description: '专业代练快速上分黄金到钻石3天完成',
detail: '### 服务说明\n\n1. 专业王者荣耀代练团队\n2. 保证3天内从黄金上到钻石\n3. 胜率保证80%以上\n4. 可指定英雄和位置\n\n### 服务流程\n\n1. 提供账号信息\n2. 代练接单开始上分\n3. 实时更新进度\n4. 完成后确认验收',
serviceTime: 4320, // 72小时
status: '0',
salesCount: 158,
rating: 4.8,
reviewCount: 142,
sortOrder: 1,
createTime: '2024-12-15 10:00:00',
updateTime: '2025-12-30 09:00:00'
},
{
id: 2,
tenantId: 1001,
categoryId: 1,
categoryName: '王者荣耀',
name: '王者荣耀巅峰赛陪玩',
coverImage: 'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
images: JSON.stringify([
'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600'
]),
price: 50,
originalPrice: 80,
description: '国服大神陪玩,带你冲击巅峰赛高分',
detail: '### 服务说明\n\n- 国服巅峰2500分以上大神\n- 语音教学,实时指导\n- 氛围轻松,技术过硬\n\n### 服务时长\n\n单场约30分钟',
serviceTime: 30,
status: '0',
salesCount: 326,
rating: 4.9,
reviewCount: 298,
sortOrder: 2,
createTime: '2024-12-20 14:00:00',
updateTime: '2025-12-30 09:00:00'
},
{
id: 3,
tenantId: 1001,
categoryId: 2,
categoryName: '英雄联盟',
name: 'LOL段位提升 - 黄金到铂金',
coverImage: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
images: JSON.stringify([
'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600'
]),
price: 299,
originalPrice: 399,
description: 'LOL专业代练黄金到铂金4天完成',
detail: '### 服务说明\n\n1. 专业LOL代练团队\n2. 4天内黄金上铂金\n3. 胜率保证75%以上\n4. 支持指定位置\n\n### 安全保障\n\n- 使用加速器,安全稳定\n- 不使用任何外挂\n- 完成后修改密码',
serviceTime: 5760, // 96小时
status: '0',
salesCount: 89,
rating: 4.7,
reviewCount: 76,
sortOrder: 3,
createTime: '2024-12-18 11:00:00',
updateTime: '2025-12-29 10:00:00'
},
{
id: 4,
tenantId: 1001,
categoryId: 3,
categoryName: '和平精英',
name: '和平精英段位提升',
coverImage: 'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
images: JSON.stringify([
'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600'
]),
price: 188,
originalPrice: 268,
description: '和平精英快速上分,白金到钻石',
detail: '### 服务说明\n\n- 职业选手代练\n- 3天完成段位提升\n- KDA保证2.0以上\n\n### 服务承诺\n\n- 不使用任何辅助\n- 安全可靠\n- 完成即确认',
serviceTime: 4320,
status: '0',
salesCount: 112,
rating: 4.8,
reviewCount: 95,
sortOrder: 4,
createTime: '2024-12-22 15:00:00',
updateTime: '2025-12-30 08:00:00'
},
{
id: 5,
tenantId: 1001,
categoryId: 4,
categoryName: '原神',
name: '原神深渊满星代打',
coverImage: 'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
images: [
'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600'
],
price: 99,
originalPrice: 149,
description: '原神深渊12层满星专业代打',
detail: '### 服务说明\n\n- 深渊12-12满星\n- 使用您的角色配置\n- 1小时内完成\n\n### 注意事项\n\n- 需要您的角色已练成\n- 武器圣遗物齐全',
serviceTime: 60,
status: '0',
salesCount: 67,
rating: 4.6,
reviewCount: 58,
sortOrder: 5,
createTime: '2024-12-25 16:00:00',
updateTime: '2025-12-28 12:00:00'
}
]
// 获取服务列表
export function getServiceList(params?: {
categoryId?: number
keyword?: string
}): Service[] {
let list = [...mockServices]
if (params?.categoryId) {
list = list.filter(s => s.categoryId === params.categoryId)
}
if (params?.keyword) {
const keyword = params.keyword.toLowerCase()
list = list.filter(s =>
s.name.toLowerCase().includes(keyword) ||
s.description.toLowerCase().includes(keyword)
)
}
// 按销量排序
list.sort((a, b) => b.salesCount - a.salesCount)
return list
}
// 获取服务详情
export function getServiceDetail(id: number): Service | undefined {
return mockServices.find(s => s.id === id)
}
// 获取热门服务
export function getHotServices(limit: number = 6): Service[] {
return mockServices
.sort((a, b) => b.salesCount - a.salesCount)
.slice(0, limit)
}