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

149 lines
3.7 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 { Player } from '@/types'
// 模拟代练列表
export const mockPlayers: Player[] = [
{
id: 1,
tenantId: 1001,
userId: 10003,
openid: 'oXxxx_mock_player_001',
name: '代练小王',
phone: '13700137001',
avatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
gameId: 'wzry',
gameName: '王者荣耀',
level: '荣耀王者100星',
intro: '5年王者经验专业上分效率高态度好',
skills: ['射手', '打野', '中单'],
status: '0',
isOnline: true,
rating: 4.9,
orderCount: 238,
completeCount: 235,
completeRate: 98.74,
depositAmount: 1000,
inviteCode: 'INV12345',
invitedBy: 1001,
createTime: '2025-01-15 14:00:00'
},
{
id: 2,
tenantId: 1001,
openid: 'oXxxx_mock_player_002',
name: '代练小李',
phone: '13700137002',
avatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
gameId: 'wzry',
gameName: '王者荣耀',
level: '荣耀王者80星',
intro: '专业打野,带飞上分,胜率保证',
skills: ['打野', '对抗路'],
status: '0',
isOnline: true,
rating: 4.8,
orderCount: 189,
completeCount: 185,
completeRate: 97.88,
depositAmount: 1000,
createTime: '2025-01-20 10:00:00'
},
{
id: 3,
tenantId: 1001,
openid: 'oXxxx_mock_player_003',
name: '代练小张',
phone: '13700137003',
avatar: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
gameId: 'lol',
gameName: '英雄联盟',
level: '钻石I',
intro: 'LOL资深玩家擅长中单和ADC',
skills: ['中单', 'ADC'],
status: '0',
isOnline: false,
rating: 4.7,
orderCount: 156,
completeCount: 152,
completeRate: 97.44,
depositAmount: 1000,
createTime: '2025-02-01 16:00:00'
},
{
id: 4,
tenantId: 1001,
openid: 'oXxxx_mock_player_004',
name: '代练小刘',
phone: '13700137004',
avatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
gameId: 'hpjy',
gameName: '和平精英',
level: '超级王牌',
intro: '和平精英职业选手,技术过硬',
skills: ['突击手', '狙击手'],
status: '0',
isOnline: true,
rating: 4.9,
orderCount: 203,
completeCount: 201,
completeRate: 99.01,
depositAmount: 1000,
createTime: '2025-01-25 12:00:00'
},
{
id: 5,
tenantId: 1001,
openid: 'oXxxx_mock_player_005',
name: '代练小赵',
phone: '13700137005',
avatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
gameId: 'wzry',
gameName: '王者荣耀',
level: '荣耀王者60星',
intro: '稳定上分,价格实惠',
skills: ['辅助', '坦克'],
status: '0',
isOnline: true,
rating: 4.6,
orderCount: 128,
completeCount: 124,
completeRate: 96.88,
depositAmount: 1000,
createTime: '2025-02-05 09:00:00'
}
]
// 获取代练列表
export function getPlayerList(params?: {
gameId?: string
isOnline?: boolean
minRating?: number
}): Player[] {
let list = [...mockPlayers]
if (params?.gameId) {
list = list.filter(p => p.gameId === params.gameId)
}
if (params?.isOnline !== undefined) {
list = list.filter(p => p.isOnline === params.isOnline)
}
if (params?.minRating) {
list = list.filter(p => p.rating >= params.minRating)
}
// 按评分排序
list.sort((a, b) => b.rating - a.rating)
return list
}
// 获取代练详情
export function getPlayerDetail(id: number): Player | undefined {
return mockPlayers.find(p => p.id === id)
}