GameServicePlatform/mock/evaluations.js

145 lines
3.8 KiB
JavaScript

/**
* 评价数据
*/
export const evaluations = [
{
id: 1,
orderId: 100003,
serviceId: 2002,
serviceName: 'LOL 娱乐陪玩 御姐音',
playerId: 30018,
playerName: '冰霜女王',
customerId: 20001,
customerName: '电竞少年',
customerAvatar: 'https://picsum.photos/100/100?random=301',
rating: 5,
content: '小姐姐声音真的超好听!技术也很好,打得很开心!五星好评!',
images: [],
isAnonymous: false,
reply: '谢谢小哥哥的好评~下次继续约我哦💕',
replyTime: '2025-01-26 21:00:00',
createTime: '2025-01-26 20:35:00'
},
{
id: 2,
orderId: 100006,
serviceId: 1002,
serviceName: '王者荣耀 娱乐陪玩 甜美女声',
playerId: 30005,
playerName: '甜心小鹿',
customerId: 20002,
customerName: '匿名用户',
customerAvatar: 'https://picsum.photos/100/100?random=302',
rating: 5,
content: '甜心小姐姐真的太温柔了,声音超甜,还教我玩法师,超级耐心!强烈推荐!',
images: [
'https://picsum.photos/400/300?random=61',
'https://picsum.photos/400/300?random=62'
],
isAnonymous: true,
reply: '谢谢支持呀~很开心能帮到你🦌',
replyTime: '2025-01-25 19:30:00',
createTime: '2025-01-25 18:45:00'
},
{
id: 3,
orderId: 100007,
serviceId: 1003,
serviceName: '王者荣耀 一对一教学 国服射手',
playerId: 30012,
playerName: '狙击之王',
customerId: 20003,
customerName: '游戏新手',
customerAvatar: 'https://picsum.photos/100/100?random=303',
rating: 5,
content: '教练真的专业!我的后羿从青铜打法变成了钻石水平,讲解很细致,物超所值!',
images: [
'https://picsum.photos/400/300?random=63'
],
isAnonymous: false,
reply: '加油!继续努力,下个赛季冲王者!',
replyTime: '2025-01-24 16:20:00',
createTime: '2025-01-24 15:55:00'
},
{
id: 4,
orderId: 100008,
serviceId: 6001,
serviceName: '原神 深渊12层满星代打',
playerId: 30025,
playerName: '璃月大佬',
customerId: 20004,
customerName: '旅行者',
customerAvatar: 'https://picsum.photos/100/100?random=304',
rating: 4,
content: '代打很快,半小时就满星了,就是没看到过程有点遗憾',
images: [],
isAnonymous: false,
reply: '下次可以提前说要录屏哦~',
replyTime: '2025-01-23 14:30:00',
createTime: '2025-01-23 14:15:00'
},
{
id: 5,
orderId: 100009,
serviceId: 2002,
serviceName: 'LOL 娱乐陪玩 御姐音',
playerId: 30018,
playerName: '冰霜女王',
customerId: 20005,
customerName: '召唤师',
customerAvatar: 'https://picsum.photos/100/100?random=305',
rating: 5,
content: '御姐音太棒了!而且辅助玩得真好,这局躺赢!',
images: [],
isAnonymous: false,
reply: '谢谢夸奖~继续努力💪',
replyTime: '2025-01-22 21:45:00',
createTime: '2025-01-22 21:30:00'
}
]
/**
* 根据服务ID获取评价列表
*/
export function getEvaluationsByServiceId(serviceId) {
return evaluations.filter(e => e.serviceId === serviceId)
}
/**
* 根据选手ID获取评价列表
*/
export function getEvaluationsByPlayerId(playerId) {
return evaluations.filter(e => e.playerId === playerId)
}
/**
* 评价统计
*/
export function getEvaluationStats(serviceId) {
const evals = getEvaluationsByServiceId(serviceId)
const total = evals.length
if (total === 0) {
return {
total: 0,
avgRating: 5.0,
distribution: { 5: 0, 4: 0, 3: 0, 2: 0, 1: 0 }
}
}
const distribution = { 5: 0, 4: 0, 3: 0, 2: 0, 1: 0 }
let sum = 0
evals.forEach(e => {
distribution[e.rating]++
sum += e.rating
})
return {
total,
avgRating: (sum / total).toFixed(2),
distribution
}
}