diff --git a/components/header.tsx b/components/header.tsx index b5e8008..efa3a31 100644 --- a/components/header.tsx +++ b/components/header.tsx @@ -39,6 +39,7 @@ const roleLabels: Record = { consumer: "客户", player: "打手", owner: "店主", + admin: "管理员", } export function Header() { diff --git a/lib/id.ts b/lib/id.ts index a2f6c11..fcf021e 100644 --- a/lib/id.ts +++ b/lib/id.ts @@ -1,6 +1,10 @@ let counter = 0 export function generateId(prefix: string) { + void prefix counter += 1 - return `${prefix}-${Date.now()}-${counter}` + + const now = Date.now().toString() + const suffix = counter.toString().padStart(3, "0") + return `${now}${suffix}` } diff --git a/lib/mock/chat.ts b/lib/mock/chat.ts index e35c20c..3e4576e 100644 --- a/lib/mock/chat.ts +++ b/lib/mock/chat.ts @@ -2,12 +2,12 @@ import type { ChatMessage, ChatSession } from "../types" export const mockChatSessions: ChatSession[] = [ { - id: "chat1", + id: "9001", type: "order", - orderId: "ord10", + orderId: "6010", participants: [ - { id: "u2", name: "玲玲", avatar: "/avatars/u2.jpg" }, - { id: "u7", name: "琪琪", avatar: "/avatars/u2.jpg" }, + { id: "1002", name: "玲玲", avatar: "/avatars/u2.jpg" }, + { id: "1007", name: "琪琪", avatar: "/avatars/u2.jpg" }, ], lastMessage: "好的那我先上号等你", lastMessageAt: "2025-02-06T19:15:00Z", @@ -15,12 +15,12 @@ export const mockChatSessions: ChatSession[] = [ readonly: false, }, { - id: "chat2", + id: "9002", type: "order", - orderId: "ord11", + orderId: "6011", participants: [ - { id: "u3", name: "zz", avatar: "/avatars/u3.jpg" }, - { id: "u9", name: "飞飞", avatar: "/avatars/u4.jpg" }, + { id: "1003", name: "zz", avatar: "/avatars/u3.jpg" }, + { id: "1009", name: "飞飞", avatar: "/avatars/u4.jpg" }, ], lastMessage: "走走走开一把", lastMessageAt: "2025-02-08T21:10:00Z", @@ -28,12 +28,12 @@ export const mockChatSessions: ChatSession[] = [ readonly: false, }, { - id: "chat3", + id: "9003", type: "order", - orderId: "ord1", + orderId: "6001", participants: [ - { id: "u2", name: "玲玲", avatar: "/avatars/u2.jpg" }, - { id: "u5", name: "俊俊", avatar: "/avatars/u5.jpg" }, + { id: "1002", name: "玲玲", avatar: "/avatars/u2.jpg" }, + { id: "1005", name: "俊俊", avatar: "/avatars/u5.jpg" }, ], lastMessage: "好的辛苦了", lastMessageAt: "2025-01-05T22:15:00Z", @@ -41,11 +41,11 @@ export const mockChatSessions: ChatSession[] = [ readonly: true, }, { - id: "chat4", + id: "9004", type: "consultation", participants: [ - { id: "u1", name: "小陈", avatar: "/avatars/u1.jpg" }, - { id: "u7", name: "琪琪", avatar: "/avatars/u2.jpg" }, + { id: "1001", name: "小陈", avatar: "/avatars/u1.jpg" }, + { id: "1007", name: "琪琪", avatar: "/avatars/u2.jpg" }, ], lastMessage: "周末能接单吗", lastMessageAt: "2025-02-09T15:00:00Z", @@ -53,12 +53,12 @@ export const mockChatSessions: ChatSession[] = [ readonly: false, }, { - id: "chat5", + id: "9005", type: "order", - orderId: "ord2", + orderId: "6002", participants: [ - { id: "u1", name: "小陈", avatar: "/avatars/u1.jpg" }, - { id: "u6", name: "Winter", avatar: "/avatars/u1.jpg" }, + { id: "1001", name: "小陈", avatar: "/avatars/u1.jpg" }, + { id: "1006", name: "Winter", avatar: "/avatars/u1.jpg" }, ], lastMessage: "下次再组", lastMessageAt: "2025-01-08T17:45:00Z", @@ -66,11 +66,11 @@ export const mockChatSessions: ChatSession[] = [ readonly: true, }, { - id: "chat6", + id: "9006", type: "consultation", participants: [ - { id: "u4", name: "莫莫", avatar: "/avatars/u4.jpg" }, - { id: "u8", name: "暗影", avatar: "/avatars/u3.jpg" }, + { id: "1004", name: "莫莫", avatar: "/avatars/u4.jpg" }, + { id: "1008", name: "暗影", avatar: "/avatars/u3.jpg" }, ], lastMessage: "你CS2什么段位", lastMessageAt: "2025-02-10T20:30:00Z", @@ -78,12 +78,12 @@ export const mockChatSessions: ChatSession[] = [ readonly: false, }, { - id: "chat7", + id: "9007", type: "order", - orderId: "ord5", + orderId: "6005", participants: [ - { id: "u1", name: "小陈", avatar: "/avatars/u1.jpg" }, - { id: "u9", name: "飞飞", avatar: "/avatars/u4.jpg" }, + { id: "1001", name: "小陈", avatar: "/avatars/u1.jpg" }, + { id: "1009", name: "飞飞", avatar: "/avatars/u4.jpg" }, ], lastMessage: "打得不错 下次还找你", lastMessageAt: "2025-01-17T23:10:00Z", @@ -94,9 +94,9 @@ export const mockChatSessions: ChatSession[] = [ export const mockChatMessages: ChatMessage[] = [ { - id: "msg1", - sessionId: "chat1", - senderId: "system", + id: "9101", + sessionId: "9001", + senderId: "0", senderName: "系统", senderAvatar: "", type: "system", @@ -104,9 +104,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:00:00Z", }, { - id: "msg2", - sessionId: "chat1", - senderId: "u7", + id: "9102", + sessionId: "9001", + senderId: "1007", senderName: "琪琪", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -114,9 +114,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:02:00Z", }, { - id: "msg3", - sessionId: "chat1", - senderId: "u2", + id: "9103", + sessionId: "9001", + senderId: "1002", senderName: "玲玲", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -124,9 +124,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:05:00Z", }, { - id: "msg4", - sessionId: "chat1", - senderId: "u7", + id: "9104", + sessionId: "9001", + senderId: "1007", senderName: "琪琪", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -134,9 +134,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:08:00Z", }, { - id: "msg5", - sessionId: "chat1", - senderId: "u2", + id: "9105", + sessionId: "9001", + senderId: "1002", senderName: "玲玲", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -144,9 +144,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:10:00Z", }, { - id: "msg6", - sessionId: "chat1", - senderId: "u7", + id: "9106", + sessionId: "9001", + senderId: "1007", senderName: "琪琪", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -154,9 +154,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:12:00Z", }, { - id: "msg7", - sessionId: "chat1", - senderId: "u2", + id: "9107", + sessionId: "9001", + senderId: "1002", senderName: "玲玲", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -164,9 +164,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-06T19:15:00Z", }, { - id: "msg8", - sessionId: "chat2", - senderId: "system", + id: "9108", + sessionId: "9002", + senderId: "0", senderName: "系统", senderAvatar: "", type: "system", @@ -174,9 +174,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-08T21:00:00Z", }, { - id: "msg9", - sessionId: "chat2", - senderId: "u9", + id: "9109", + sessionId: "9002", + senderId: "1009", senderName: "飞飞", senderAvatar: "/avatars/u4.jpg", type: "text", @@ -184,9 +184,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-08T21:06:00Z", }, { - id: "msg10", - sessionId: "chat2", - senderId: "u3", + id: "9110", + sessionId: "9002", + senderId: "1003", senderName: "zz", senderAvatar: "/avatars/u3.jpg", type: "text", @@ -194,9 +194,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-08T21:07:00Z", }, { - id: "msg11", - sessionId: "chat2", - senderId: "u9", + id: "9111", + sessionId: "9002", + senderId: "1009", senderName: "飞飞", senderAvatar: "/avatars/u4.jpg", type: "text", @@ -204,9 +204,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-08T21:08:00Z", }, { - id: "msg12", - sessionId: "chat2", - senderId: "u3", + id: "9112", + sessionId: "9002", + senderId: "1003", senderName: "zz", senderAvatar: "/avatars/u3.jpg", type: "text", @@ -214,9 +214,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-08T21:10:00Z", }, { - id: "msg13", - sessionId: "chat4", - senderId: "u1", + id: "9113", + sessionId: "9004", + senderId: "1001", senderName: "小陈", senderAvatar: "/avatars/u1.jpg", type: "text", @@ -224,9 +224,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-09T14:55:00Z", }, { - id: "msg14", - sessionId: "chat4", - senderId: "u7", + id: "9114", + sessionId: "9004", + senderId: "1007", senderName: "琪琪", senderAvatar: "/avatars/u2.jpg", type: "text", @@ -234,9 +234,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-09T14:58:00Z", }, { - id: "msg15", - sessionId: "chat4", - senderId: "u1", + id: "9115", + sessionId: "9004", + senderId: "1001", senderName: "小陈", senderAvatar: "/avatars/u1.jpg", type: "text", @@ -244,9 +244,9 @@ export const mockChatMessages: ChatMessage[] = [ createdAt: "2025-02-09T15:00:00Z", }, { - id: "msg16", - sessionId: "chat6", - senderId: "u4", + id: "9116", + sessionId: "9006", + senderId: "1004", senderName: "莫莫", senderAvatar: "/avatars/u4.jpg", type: "text", diff --git a/lib/mock/comments.ts b/lib/mock/comments.ts index 95cc577..a8d47ec 100644 --- a/lib/mock/comments.ts +++ b/lib/mock/comments.ts @@ -3,8 +3,8 @@ import { mockUsers } from "./users" export const mockComments: Comment[] = [ { - id: "c1", - postId: "p1", + id: "9601", + postId: "9501", author: mockUsers[4], content: "谢谢老板 下次还可以组", likeCount: 12, @@ -12,8 +12,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-02T11:00:00Z", }, { - id: "c2", - postId: "p1", + id: "9602", + postId: "9501", author: mockUsers[2], content: "这个活动力度可以 我去看看", likeCount: 5, @@ -21,8 +21,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-02T12:30:00Z", }, { - id: "c3", - postId: "p2", + id: "9603", + postId: "9502", author: mockUsers[4], content: "收到好评 下次继续", likeCount: 8, @@ -30,8 +30,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-06T10:00:00Z", }, { - id: "c4", - postId: "p2", + id: "9604", + postId: "9502", author: mockUsers[3], content: "俊俊确实稳 我也找过他", likeCount: 6, @@ -39,8 +39,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-06T11:30:00Z", }, { - id: "c5", - postId: "p3", + id: "9605", + postId: "9503", author: mockUsers[0], content: "第三点说得对 之前就是自己乱搞输的", likeCount: 15, @@ -48,8 +48,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-11T08:00:00Z", }, { - id: "c6", - postId: "p3", + id: "9606", + postId: "9503", author: mockUsers[1], content: "学到了 下次试试", likeCount: 3, @@ -57,8 +57,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-11T09:20:00Z", }, { - id: "c7", - postId: "p3", + id: "9607", + postId: "9503", author: mockUsers[5], content: "补充一下 打野来gank的时候别退 跟着打就行", likeCount: 22, @@ -66,8 +66,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-11T10:45:00Z", }, { - id: "c8", - postId: "p4", + id: "9608", + postId: "9504", author: mockUsers[6], content: "确实有些人态度不行 但大部分还是靠谱的", likeCount: 18, @@ -75,8 +75,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-14T00:10:00Z", }, { - id: "c9", - postId: "p4", + id: "9609", + postId: "9504", author: mockUsers[9], content: "我们店里不会这样 有问题随时找我", likeCount: 7, @@ -84,8 +84,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-14T08:00:00Z", }, { - id: "c10", - postId: "p5", + id: "9610", + postId: "9505", author: mockUsers[0], content: "Winter确实不催人 这点很舒服", likeCount: 4, @@ -93,8 +93,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-09T19:00:00Z", }, { - id: "c11", - postId: "p6", + id: "9611", + postId: "9506", author: mockUsers[3], content: "决赛圈那段说得好 我每次都死在跑圈", likeCount: 11, @@ -102,8 +102,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-18T16:30:00Z", }, { - id: "c12", - postId: "p6", + id: "9612", + postId: "9506", author: mockUsers[0], content: "稳健打法确实适合新手 我试了几把有效果", likeCount: 8, @@ -111,8 +111,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-19T10:00:00Z", }, { - id: "c13", - postId: "p7", + id: "9613", + postId: "9507", author: mockUsers[6], content: "谢谢认可!下次还可以组", likeCount: 14, @@ -120,8 +120,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-15T22:00:00Z", }, { - id: "c14", - postId: "p7", + id: "9614", + postId: "9507", author: mockUsers[1], content: "女打手这么猛的吗 我也想试试", likeCount: 9, @@ -129,8 +129,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-16T08:30:00Z", }, { - id: "c15", - postId: "p8", + id: "9615", + postId: "9508", author: mockUsers[8], content: "我可以 私聊了", likeCount: 2, @@ -138,8 +138,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-22T12:00:00Z", }, { - id: "c16", - postId: "p9", + id: "9616", + postId: "9509", author: mockUsers[8], content: "谢谢老板好评 准时上线是基本的", likeCount: 6, @@ -147,8 +147,8 @@ export const mockComments: Comment[] = [ createdAt: "2025-01-19T00:10:00Z", }, { - id: "c17", - postId: "p10", + id: "9617", + postId: "9510", author: mockUsers[7], content: "谢谢推荐", likeCount: 3, diff --git a/lib/mock/disputes.ts b/lib/mock/disputes.ts index 4519852..c799995 100644 --- a/lib/mock/disputes.ts +++ b/lib/mock/disputes.ts @@ -2,9 +2,9 @@ import type { Dispute } from "../types" export const mockDisputes: Dispute[] = [ { - id: "d1", - orderId: "ord14", - initiatorId: "u3", + id: "8001", + orderId: "6014", + initiatorId: "1003", initiatorName: "zz", reason: "打了两局DOTA,第二局中途说有事直接退了,等了半小时没回来。约好的两局只打了一局半。", evidence: ["/evidence/d1-1.jpg", "/evidence/d1-2.jpg"], @@ -12,9 +12,9 @@ export const mockDisputes: Dispute[] = [ createdAt: "2025-02-15T10:00:00Z", }, { - id: "d2", - orderId: "ord10", - initiatorId: "u7", + id: "8002", + orderId: "6010", + initiatorId: "1007", initiatorName: "琪琪", reason: "对方下单后一直不上线,约了三次时间都放鸽子,已经拖了两天了。", evidence: ["/evidence/d2-1.jpg"], diff --git a/lib/mock/favorites.ts b/lib/mock/favorites.ts index c8a7787..d2d17c6 100644 --- a/lib/mock/favorites.ts +++ b/lib/mock/favorites.ts @@ -2,73 +2,73 @@ import type { Favorite } from "../types" export const mockFavorites: Favorite[] = [ { - id: "fav1", - userId: "u1", + id: "9201", + userId: "1001", targetType: "player", - targetId: "u5", + targetId: "1005", createdAt: "2025-01-06T10:30:00Z", }, { - id: "fav2", - userId: "u1", + id: "9202", + userId: "1001", targetType: "shop", - targetId: "shop1", + targetId: "3001", createdAt: "2025-01-10T14:00:00Z", }, { - id: "fav3", - userId: "u1", + id: "9203", + userId: "1001", targetType: "player", - targetId: "u7", + targetId: "1007", createdAt: "2025-01-16T20:00:00Z", }, { - id: "fav4", - userId: "u2", + id: "9204", + userId: "1002", targetType: "player", - targetId: "u6", + targetId: "1006", createdAt: "2025-01-09T18:00:00Z", }, { - id: "fav5", - userId: "u2", + id: "9205", + userId: "1002", targetType: "shop", - targetId: "shop2", + targetId: "3002", createdAt: "2025-01-12T09:00:00Z", }, { - id: "fav6", - userId: "u3", + id: "9206", + userId: "1003", targetType: "player", - targetId: "u8", + targetId: "1008", createdAt: "2025-01-12T01:00:00Z", }, { - id: "fav7", - userId: "u4", + id: "9207", + userId: "1004", targetType: "player", - targetId: "u7", + targetId: "1007", createdAt: "2025-01-15T22:30:00Z", }, { - id: "fav8", - userId: "u4", + id: "9208", + userId: "1004", targetType: "shop", - targetId: "shop1", + targetId: "3001", createdAt: "2025-01-20T11:00:00Z", }, { - id: "fav9", - userId: "u1", + id: "9209", + userId: "1001", targetType: "player", - targetId: "u9", + targetId: "1009", createdAt: "2025-01-18T23:30:00Z", }, { - id: "fav10", - userId: "u3", + id: "9210", + userId: "1003", targetType: "shop", - targetId: "shop3", + targetId: "3003", createdAt: "2025-02-09T15:00:00Z", }, ] diff --git a/lib/mock/games.ts b/lib/mock/games.ts index 9497192..e50aae1 100644 --- a/lib/mock/games.ts +++ b/lib/mock/games.ts @@ -1,16 +1,16 @@ import type { Game } from "../types" export const mockGames: Game[] = [ - { id: "g1", name: "英雄联盟", icon: "Swords", category: "MOBA" }, - { id: "g2", name: "王者荣耀", icon: "Crown", category: "MOBA" }, - { id: "g3", name: "CS2", icon: "Crosshair", category: "FPS" }, - { id: "g4", name: "永劫无间", icon: "Sword", category: "动作" }, - { id: "g5", name: "原神", icon: "Sparkles", category: "RPG" }, - { id: "g6", name: "和平精英", icon: "Target", category: "FPS" }, - { id: "g7", name: "DOTA2", icon: "Shield", category: "MOBA" }, - { id: "g8", name: "无畏契约", icon: "Zap", category: "FPS" }, - { id: "g9", name: "绝区零", icon: "Flame", category: "动作" }, - { id: "g10", name: "崩坏:星穹铁道", icon: "Star", category: "RPG" }, - { id: "g11", name: "第五人格", icon: "Ghost", category: "动作" }, - { id: "g12", name: "三角洲行动", icon: "Radar", category: "FPS" }, + { id: "2001", name: "英雄联盟", icon: "Swords", category: "MOBA" }, + { id: "2002", name: "王者荣耀", icon: "Crown", category: "MOBA" }, + { id: "2003", name: "CS2", icon: "Crosshair", category: "FPS" }, + { id: "2004", name: "永劫无间", icon: "Sword", category: "动作" }, + { id: "2005", name: "原神", icon: "Sparkles", category: "RPG" }, + { id: "2006", name: "和平精英", icon: "Target", category: "FPS" }, + { id: "2007", name: "DOTA2", icon: "Shield", category: "MOBA" }, + { id: "2008", name: "无畏契约", icon: "Zap", category: "FPS" }, + { id: "2009", name: "绝区零", icon: "Flame", category: "动作" }, + { id: "2010", name: "崩坏:星穹铁道", icon: "Star", category: "RPG" }, + { id: "2011", name: "第五人格", icon: "Ghost", category: "动作" }, + { id: "2012", name: "三角洲行动", icon: "Radar", category: "FPS" }, ] diff --git a/lib/mock/notifications.ts b/lib/mock/notifications.ts index 3afa270..9792708 100644 --- a/lib/mock/notifications.ts +++ b/lib/mock/notifications.ts @@ -2,52 +2,52 @@ import type { Notification } from "../types" export const mockNotifications: Notification[] = [ { - id: "n1", + id: "9301", type: "order", title: "订单已接单", content: "琪琪接了你的王者荣耀订单,去聊天约时间吧", read: false, - link: "/order/ord10", + link: "/order/6010", createdAt: "2025-02-06T19:08:00Z", }, { - id: "n2", + id: "9302", type: "order", title: "订单已完成", content: "你和俊俊的LOL订单已完成,快去评价吧", read: false, - link: "/order/ord1", + link: "/order/6001", createdAt: "2025-01-05T22:25:00Z", }, { - id: "n3", + id: "9303", type: "order", title: "争议处理中", content: "你提交的订单争议已进入审核,请耐心等待", read: true, - link: "/dispute/ord14", + link: "/dispute/6014", createdAt: "2025-02-15T10:05:00Z", }, { - id: "n4", + id: "9304", type: "community", title: "帖子获得点赞", content: "你的帖子「找了个LOL陪玩 三把全赢了」又多了87个赞", read: false, - link: "/post/p1", + link: "/post/9501", createdAt: "2025-01-08T20:00:00Z", }, { - id: "n5", + id: "9305", type: "community", title: "新评论", content: "俊俊评论了你的帖子", read: false, - link: "/post/p2", + link: "/post/9502", createdAt: "2025-01-06T10:00:00Z", }, { - id: "n6", + id: "9306", type: "system", title: "平台公告", content: "春节活动上线,2月1日至2月15日全场服务享9折优惠", @@ -55,25 +55,25 @@ export const mockNotifications: Notification[] = [ createdAt: "2025-01-28T00:00:00Z", }, { - id: "n7", + id: "9307", type: "order", title: "新订单待接单", content: "莫莫下了一个原神深渊代打的单,快去看看", read: false, - link: "/order/ord12", + link: "/order/6012", createdAt: "2025-02-10T20:00:00Z", }, { - id: "n8", + id: "9308", type: "community", title: "帖子被引用", content: "zz引用了你的帖子「吐槽一下,有些打手真的不行」", read: true, - link: "/post/p10", + link: "/post/9510", createdAt: "2025-01-14T10:05:00Z", }, { - id: "n9", + id: "9309", type: "system", title: "认证通过", content: "你的打手认证已通过,现在可以发布服务了", @@ -81,25 +81,25 @@ export const mockNotifications: Notification[] = [ createdAt: "2024-12-20T09:00:00Z", }, { - id: "n10", + id: "9310", type: "order", title: "订单已取消", content: "玲玲取消了CS2车队位的订单", read: true, - link: "/order/ord15", + link: "/order/6015", createdAt: "2025-02-16T18:05:00Z", }, { - id: "n11", + id: "9311", type: "community", title: "新评论", content: "Winter评论了你的帖子「LOL双排接单攻略」", read: false, - link: "/post/p3", + link: "/post/9503", createdAt: "2025-01-11T10:45:00Z", }, { - id: "n12", + id: "9312", type: "system", title: "系统维护通知", content: "2月20日凌晨2:00-4:00进行系统维护,届时无法下单", diff --git a/lib/mock/orders.ts b/lib/mock/orders.ts index acbb5ef..69f5109 100644 --- a/lib/mock/orders.ts +++ b/lib/mock/orders.ts @@ -3,12 +3,12 @@ import { mockServices } from "./services" export const mockOrders: Order[] = [ { - id: "ord1", - consumerId: "u2", + id: "6001", + consumerId: "1002", consumerName: "玲玲", - playerId: "u5", + playerId: "1005", playerName: "俊俊", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[0], status: "completed", @@ -20,12 +20,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-05T22:25:00Z", }, { - id: "ord2", - consumerId: "u1", + id: "6002", + consumerId: "1001", consumerName: "小陈", - playerId: "u6", + playerId: "1006", playerName: "Winter", - shopId: "shop2", + shopId: "3002", shopName: "Yuki 小屋", service: mockServices[3], status: "completed", @@ -37,10 +37,10 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-08T17:55:00Z", }, { - id: "ord3", - consumerId: "u3", + id: "6003", + consumerId: "1003", consumerName: "zz", - playerId: "u8", + playerId: "1008", playerName: "暗影", service: mockServices[9], status: "completed", @@ -51,12 +51,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-12T00:45:00Z", }, { - id: "ord4", - consumerId: "u4", + id: "6004", + consumerId: "1004", consumerName: "莫莫", - playerId: "u7", + playerId: "1007", playerName: "琪琪", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[7], status: "completed", @@ -68,12 +68,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-14T22:05:00Z", }, { - id: "ord5", - consumerId: "u1", + id: "6005", + consumerId: "1001", consumerName: "小陈", - playerId: "u9", + playerId: "1009", playerName: "飞飞", - shopId: "shop3", + shopId: "3003", shopName: "浩哥开黑", service: mockServices[12], status: "completed", @@ -85,12 +85,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-17T23:15:00Z", }, { - id: "ord6", - consumerId: "u3", + id: "6006", + consumerId: "1003", consumerName: "zz", - playerId: "u6", + playerId: "1006", playerName: "Winter", - shopId: "shop2", + shopId: "3002", shopName: "Yuki 小屋", service: mockServices[5], status: "completed", @@ -102,12 +102,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-20T23:35:00Z", }, { - id: "ord7", - consumerId: "u2", + id: "6007", + consumerId: "1002", consumerName: "玲玲", - playerId: "u9", + playerId: "1009", playerName: "飞飞", - shopId: "shop3", + shopId: "3003", shopName: "浩哥开黑", service: mockServices[13], status: "completed", @@ -118,12 +118,12 @@ export const mockOrders: Order[] = [ completedAt: "2025-01-23T11:20:00Z", }, { - id: "ord8", - consumerId: "u4", + id: "6008", + consumerId: "1004", consumerName: "莫莫", - playerId: "u5", + playerId: "1005", playerName: "俊俊", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[1], status: "pending_review", @@ -134,10 +134,10 @@ export const mockOrders: Order[] = [ closedAt: "2025-02-01T22:00:00Z", }, { - id: "ord9", - consumerId: "u1", + id: "6009", + consumerId: "1001", consumerName: "小陈", - playerId: "u8", + playerId: "1008", playerName: "暗影", service: mockServices[11], status: "pending_review", @@ -147,12 +147,12 @@ export const mockOrders: Order[] = [ closedAt: "2025-02-04T01:00:00Z", }, { - id: "ord10", - consumerId: "u2", + id: "6010", + consumerId: "1002", consumerName: "玲玲", - playerId: "u7", + playerId: "1007", playerName: "琪琪", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[6], status: "in_progress", @@ -162,12 +162,12 @@ export const mockOrders: Order[] = [ acceptedAt: "2025-02-06T19:08:00Z", }, { - id: "ord11", - consumerId: "u3", + id: "6011", + consumerId: "1003", consumerName: "zz", - playerId: "u9", + playerId: "1009", playerName: "飞飞", - shopId: "shop3", + shopId: "3003", shopName: "浩哥开黑", service: mockServices[14], status: "in_progress", @@ -176,12 +176,12 @@ export const mockOrders: Order[] = [ acceptedAt: "2025-02-08T21:05:00Z", }, { - id: "ord12", - consumerId: "u4", + id: "6012", + consumerId: "1004", consumerName: "莫莫", - playerId: "u6", + playerId: "1006", playerName: "Winter", - shopId: "shop2", + shopId: "3002", shopName: "Yuki 小屋", service: mockServices[4], status: "pending_accept", @@ -190,12 +190,12 @@ export const mockOrders: Order[] = [ createdAt: "2025-02-10T20:00:00Z", }, { - id: "ord13", - consumerId: "u1", + id: "6013", + consumerId: "1001", consumerName: "小陈", - playerId: "u7", + playerId: "1007", playerName: "琪琪", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[8], status: "pending_close", @@ -205,10 +205,10 @@ export const mockOrders: Order[] = [ closedAt: "2025-02-12T15:30:00Z", }, { - id: "ord14", - consumerId: "u3", + id: "6014", + consumerId: "1003", consumerName: "zz", - playerId: "u8", + playerId: "1008", playerName: "暗影", service: mockServices[10], status: "disputed", @@ -219,12 +219,12 @@ export const mockOrders: Order[] = [ closedAt: "2025-02-14T23:30:00Z", }, { - id: "ord15", - consumerId: "u2", + id: "6015", + consumerId: "1002", consumerName: "玲玲", - playerId: "u5", + playerId: "1005", playerName: "俊俊", - shopId: "shop1", + shopId: "3001", shopName: "老王游戏工作室", service: mockServices[2], status: "cancelled", diff --git a/lib/mock/players.ts b/lib/mock/players.ts index c8ff178..a4a245d 100644 --- a/lib/mock/players.ts +++ b/lib/mock/players.ts @@ -4,65 +4,65 @@ import { mockUsers } from "./users" export const mockPlayers: Player[] = [ { - id: "u5", + id: "1005", user: mockUsers[4], rating: 4.2, totalOrders: 156, completionRate: 0.94, status: "available", games: ["英雄联盟", "王者荣耀"], - services: mockServices.filter((s) => s.playerId === "u5"), - shopId: "shop1", + services: mockServices.filter((s) => s.playerId === "1005"), + shopId: "3001", shopName: "老王游戏工作室", tags: ["闷声干活", "不催不急", "准时上线"], }, { - id: "u6", + id: "1006", user: mockUsers[5], rating: 4.7, totalOrders: 412, completionRate: 0.97, status: "available", games: ["英雄联盟", "DOTA2", "原神", "第五人格"], - services: mockServices.filter((s) => s.playerId === "u6"), - shopId: "shop2", + services: mockServices.filter((s) => s.playerId === "1006"), + shopId: "3002", shopName: "Yuki 小屋", tags: ["态度好", "会讲思路", "老手"], }, { - id: "u7", + id: "1007", user: mockUsers[6], rating: 4.5, totalOrders: 289, completionRate: 0.95, status: "busy", games: ["王者荣耀", "和平精英", "绝区零"], - services: mockServices.filter((s) => s.playerId === "u7"), - shopId: "shop1", + services: mockServices.filter((s) => s.playerId === "1007"), + shopId: "3001", shopName: "老王游戏工作室", tags: ["女打手", "技术硬", "不闲聊"], }, { - id: "u8", + id: "1008", user: mockUsers[7], rating: 4.8, totalOrders: 97, completionRate: 0.91, status: "available", games: ["无畏契约", "DOTA2", "CS2"], - services: mockServices.filter((s) => s.playerId === "u8"), + services: mockServices.filter((s) => s.playerId === "1008"), tags: ["效率高", "话少", "枪法硬"], }, { - id: "u9", + id: "1009", user: mockUsers[8], rating: 4.4, totalOrders: 203, completionRate: 0.98, status: "offline", games: ["英雄联盟", "崩坏:星穹铁道", "三角洲行动"], - services: mockServices.filter((s) => s.playerId === "u9"), - shopId: "shop3", + services: mockServices.filter((s) => s.playerId === "1009"), + shopId: "3003", shopName: "浩哥开黑", tags: ["不掉线", "守时", "长期接单"], }, diff --git a/lib/mock/posts.ts b/lib/mock/posts.ts index 0d843ef..80ff5df 100644 --- a/lib/mock/posts.ts +++ b/lib/mock/posts.ts @@ -3,7 +3,7 @@ import { mockUsers } from "./users" export const mockPosts: Post[] = [ { - id: "p1", + id: "9501", author: mockUsers[10], authorRole: "owner", title: "Yuki小屋新年活动!1月全场8折,限时7天", @@ -18,7 +18,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-02T10:00:00Z", }, { - id: "p2", + id: "9502", author: mockUsers[1], authorRole: "consumer", title: "跟俊俊打了三局LOL,赢了两把!", @@ -26,7 +26,7 @@ export const mockPosts: Post[] = [ "之前一直输一直输,今天下单试了一下,俊俊打野,我打中单,配合还挺顺的。第一局有点磨合,后面两局就好多了。话不多但是打得认真,该抓的时候就来,不会乱。下次还找他。", images: ["/posts/p2-1.jpg", "/posts/p2-2.jpg"], tags: ["英雄联盟", "LOL", "秀单"], - linkedOrderId: "ord1", + linkedOrderId: "6001", likeCount: 43, commentCount: 8, liked: true, @@ -34,7 +34,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-06T09:15:00Z", }, { - id: "p3", + id: "9503", author: mockUsers[4], authorRole: "player", title: "LOL双排接单攻略——怎么配合你的打手赢更多", @@ -49,7 +49,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-10T20:30:00Z", }, { - id: "p4", + id: "9504", author: mockUsers[2], authorRole: "consumer", title: "吐槽一下,有些打手真的不行", @@ -64,7 +64,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-13T22:45:00Z", }, { - id: "p5", + id: "9505", author: mockUsers[0], authorRole: "consumer", title: "和Winter打王者,体验还不错", @@ -72,7 +72,7 @@ export const mockPosts: Post[] = [ "我用鲁班,他配合我,打了三局赢了两局。主要是他不催,我手速慢他也没说什么,就正常打。上了两颗星,今天满足了。", images: ["/posts/p5-1.jpg"], tags: ["王者荣耀", "秀单", "Yuki小屋"], - linkedOrderId: "ord2", + linkedOrderId: "6002", likeCount: 31, commentCount: 5, liked: false, @@ -80,7 +80,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-09T18:20:00Z", }, { - id: "p6", + id: "9506", author: mockUsers[6], authorRole: "player", title: "和平精英吃鸡小技巧,稳健打法分享", @@ -95,7 +95,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-18T15:00:00Z", }, { - id: "p7", + id: "9507", author: mockUsers[3], authorRole: "consumer", title: "琪琪带我打和平,枪法真的稳", @@ -103,7 +103,7 @@ export const mockPosts: Post[] = [ "之前一直觉得女生打手可能没那么厉害,结果被打脸了。琪琪枪法比我认识的大多数男生都稳,决赛圈那把压枪压得我看呆了。两局都进了前三,第二局吃鸡。下次还找她。", images: ["/posts/p7-1.jpg"], tags: ["和平精英", "秀单", "老王游戏工作室"], - linkedOrderId: "ord4", + linkedOrderId: "6004", likeCount: 67, commentCount: 9, liked: true, @@ -111,7 +111,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-15T21:30:00Z", }, { - id: "p8", + id: "9508", author: mockUsers[9], authorRole: "owner", title: "老王工作室招新打手,有意向的来聊", @@ -126,7 +126,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-22T11:00:00Z", }, { - id: "p9", + id: "9509", author: mockUsers[1], authorRole: "consumer", title: "飞飞LOL辅助真的很懂配合", @@ -134,7 +134,7 @@ export const mockPosts: Post[] = [ "我打ADC,飞飞打辅助,三局全赢。他会看我的走位然后跟着保护,不会乱抢资源,视野也插得很好。感觉比我之前随机到的辅助强多了。而且说好几点上就几点上,没让我等。", images: ["/posts/p9-1.jpg", "/posts/p9-2.jpg"], tags: ["英雄联盟", "LOL", "秀单", "浩哥开黑"], - linkedOrderId: "ord5", + linkedOrderId: "6005", likeCount: 49, commentCount: 6, liked: false, @@ -142,7 +142,7 @@ export const mockPosts: Post[] = [ createdAt: "2025-01-18T23:45:00Z", }, { - id: "p10", + id: "9510", author: mockUsers[2], authorRole: "consumer", title: "回复p4,找打手真的要看评价", @@ -150,7 +150,7 @@ export const mockPosts: Post[] = [ "看到之前那个吐槽帖,深有同感。我也踩过坑,后来学乖了,下单前一定先看评价,特别是最近一个月的。评价少的或者有差评的直接跳过,不值得赌。\n\n现在找到几个靠谱的了,暗影的无畏契约打得很好,推荐。", images: [], tags: ["陪玩体验", "避坑"], - quotedPostId: "p4", + quotedPostId: "9504", likeCount: 38, commentCount: 4, liked: false, diff --git a/lib/mock/reviews.ts b/lib/mock/reviews.ts index 50218b3..858ff16 100644 --- a/lib/mock/reviews.ts +++ b/lib/mock/reviews.ts @@ -2,214 +2,214 @@ import type { Review } from "../types" export const mockReviews: Review[] = [ { - id: "r1", - orderId: "ord1", - fromUserId: "u1", + id: "7001", + orderId: "6001", + fromUserId: "1001", fromUserName: "小陈", fromUserAvatar: "/avatars/u1.jpg", - toUserId: "u5", + toUserId: "1005", rating: 5, content: "打得很好,带我上了好几局,沟通也顺畅,下次还找", sealed: false, createdAt: "2025-01-10T20:30:00Z", }, { - id: "r2", - orderId: "ord1", - fromUserId: "u5", + id: "7002", + orderId: "6001", + fromUserId: "1005", fromUserName: "俊俊", fromUserAvatar: "/avatars/u4.jpg", - toUserId: "u1", + toUserId: "1001", rating: 5, content: "配合很好,没有乱跑,愉快", sealed: false, createdAt: "2025-01-10T21:00:00Z", }, { - id: "r3", - orderId: "ord2", - fromUserId: "u2", + id: "7003", + orderId: "6002", + fromUserId: "1002", fromUserName: "玲玲", fromUserAvatar: "/avatars/u2.jpg", - toUserId: "u6", + toUserId: "1006", rating: 4, content: "整体还不错,就是中间断线了一次,不过后来补回来了", sealed: false, createdAt: "2025-01-12T19:15:00Z", }, { - id: "r4", - orderId: "ord2", - fromUserId: "u6", + id: "7004", + orderId: "6002", + fromUserId: "1006", fromUserName: "Winter", fromUserAvatar: "/avatars/u1.jpg", - toUserId: "u2", + toUserId: "1002", rating: 4, sealed: false, createdAt: "2025-01-12T19:45:00Z", }, { - id: "r5", - orderId: "ord3", - fromUserId: "u3", + id: "7005", + orderId: "6003", + fromUserId: "1003", fromUserName: "zz", fromUserAvatar: "/avatars/u3.jpg", - toUserId: "u7", + toUserId: "1007", rating: 5, content: "琪琪真的很厉害!教了我好多操作,感觉进步了不少", sealed: false, createdAt: "2025-01-14T22:00:00Z", }, { - id: "r6", - orderId: "ord3", - fromUserId: "u7", + id: "7006", + orderId: "6003", + fromUserId: "1007", fromUserName: "琪琪", fromUserAvatar: "/avatars/u2.jpg", - toUserId: "u3", + toUserId: "1003", rating: 5, content: "学得很认真,问题也问得很到位,喜欢这种用户", sealed: false, createdAt: "2025-01-14T22:30:00Z", }, { - id: "r7", - orderId: "ord4", - fromUserId: "u4", + id: "7007", + orderId: "6004", + fromUserId: "1004", fromUserName: "莫莫", fromUserAvatar: "/avatars/u4.jpg", - toUserId: "u8", + toUserId: "1008", rating: 3, content: "发挥一般,感觉状态不太好,赢了两局输了三局", sealed: false, createdAt: "2025-01-16T18:00:00Z", }, { - id: "r8", - orderId: "ord4", - fromUserId: "u8", + id: "7008", + orderId: "6004", + fromUserId: "1008", fromUserName: "暗影", fromUserAvatar: "/avatars/u3.jpg", - toUserId: "u4", + toUserId: "1004", rating: 4, content: "还行,没有乱催,比较好说话", sealed: false, createdAt: "2025-01-16T18:20:00Z", }, { - id: "r9", - orderId: "ord5", - fromUserId: "u1", + id: "7009", + orderId: "6005", + fromUserId: "1001", fromUserName: "小陈", fromUserAvatar: "/avatars/u1.jpg", - toUserId: "u9", + toUserId: "1009", rating: 5, content: "飞飞太强了,全程碾压,爽!", sealed: false, createdAt: "2025-01-18T21:10:00Z", }, { - id: "r10", - orderId: "ord5", - fromUserId: "u9", + id: "7010", + orderId: "6005", + fromUserId: "1009", fromUserName: "飞飞", fromUserAvatar: "/avatars/u4.jpg", - toUserId: "u1", + toUserId: "1001", rating: 5, sealed: false, createdAt: "2025-01-18T21:30:00Z", }, { - id: "r11", - orderId: "ord6", - fromUserId: "u2", + id: "7011", + orderId: "6006", + fromUserId: "1002", fromUserName: "玲玲", fromUserAvatar: "/avatars/u2.jpg", - toUserId: "u5", + toUserId: "1005", rating: 4, content: "挺专业的,就是话不多,不过打得好就行", sealed: false, createdAt: "2025-01-20T20:00:00Z", }, { - id: "r12", - orderId: "ord6", - fromUserId: "u5", + id: "7012", + orderId: "6006", + fromUserId: "1005", fromUserName: "俊俊", fromUserAvatar: "/avatars/u4.jpg", - toUserId: "u2", + toUserId: "1002", rating: 3, content: "中途有点急,催了好几次,下次希望耐心一点", sealed: false, createdAt: "2025-01-20T20:25:00Z", }, { - id: "r13", - orderId: "ord7", - fromUserId: "u3", + id: "7013", + orderId: "6007", + fromUserId: "1003", fromUserName: "zz", fromUserAvatar: "/avatars/u3.jpg", - toUserId: "u6", + toUserId: "1006", rating: 2, content: "感觉没有简介里说的那么厉害,好几局都没发挥出来,有点失望", sealed: false, createdAt: "2025-01-22T17:30:00Z", }, { - id: "r14", - orderId: "ord7", - fromUserId: "u6", + id: "7014", + orderId: "6007", + fromUserId: "1006", fromUserName: "Winter", fromUserAvatar: "/avatars/u1.jpg", - toUserId: "u3", + toUserId: "1003", rating: 4, content: "配合还可以,就是网络有点卡", sealed: false, createdAt: "2025-01-22T17:50:00Z", }, { - id: "r15", - orderId: "ord8", - fromUserId: "u4", + id: "7015", + orderId: "6008", + fromUserId: "1004", fromUserName: "莫莫", fromUserAvatar: "/avatars/u4.jpg", - toUserId: "u7", + toUserId: "1007", rating: 5, content: "超级好!带我连赢了五局,开心死了", sealed: true, createdAt: "2025-01-24T23:00:00Z", }, { - id: "r16", - orderId: "ord8", - fromUserId: "u7", + id: "7016", + orderId: "6008", + fromUserId: "1007", fromUserName: "琪琪", fromUserAvatar: "/avatars/u2.jpg", - toUserId: "u4", + toUserId: "1004", rating: 5, content: "很好带,状态也好,合作愉快", sealed: true, createdAt: "2025-01-24T23:15:00Z", }, { - id: "r17", - orderId: "ord9", - fromUserId: "u1", + id: "7017", + orderId: "6009", + fromUserId: "1001", fromUserName: "小陈", fromUserAvatar: "/avatars/u1.jpg", - toUserId: "u8", + toUserId: "1008", rating: 4, content: "打得稳,没有骚操作,就是风格比较保守", sealed: false, createdAt: "2025-01-26T19:40:00Z", }, { - id: "r18", - orderId: "ord9", - fromUserId: "u8", + id: "7018", + orderId: "6009", + fromUserId: "1008", fromUserName: "暗影", fromUserAvatar: "/avatars/u3.jpg", - toUserId: "u1", + toUserId: "1001", rating: 4, sealed: false, createdAt: "2025-01-26T20:00:00Z", diff --git a/lib/mock/services.ts b/lib/mock/services.ts index 83f8ec3..ec6c54f 100644 --- a/lib/mock/services.ts +++ b/lib/mock/services.ts @@ -2,9 +2,9 @@ import type { PlayerService } from "../types" export const mockServices: PlayerService[] = [ { - id: "s1", - playerId: "u5", - gameId: "g1", + id: "5001", + playerId: "1005", + gameId: "2001", gameName: "英雄联盟", title: "LOL双排上分", description: "打得不好说话,但是认真打。黄金到铂金段位都接,不保证赢但保证尽力。", @@ -14,9 +14,9 @@ export const mockServices: PlayerService[] = [ availability: ["工作日晚上9点后", "周末全天"], }, { - id: "s2", - playerId: "u5", - gameId: "g4", + id: "5002", + playerId: "1005", + gameId: "2004", gameName: "永劫无间", title: "永劫双人组队", description: "永劫玩了两年多,输出位,跟着我打就行,不用担心被带走。", @@ -25,9 +25,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天晚上8点到凌晨1点"], }, { - id: "s3", - playerId: "u5", - gameId: "g3", + id: "5003", + playerId: "1005", + gameId: "2003", gameName: "CS2", title: "CS2车队位", description: "信使/支援位,不抢枪不乱走,配合好的话胜率挺高的。", @@ -37,9 +37,9 @@ export const mockServices: PlayerService[] = [ availability: ["工作日晚上9点后", "周末下午到凌晨"], }, { - id: "s4", - playerId: "u6", - gameId: "g2", + id: "5004", + playerId: "1006", + gameId: "2002", gameName: "王者荣耀", title: "王者双排稳上星", description: @@ -50,9 +50,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天下午3点到凌晨"], }, { - id: "s5", - playerId: "u6", - gameId: "g1", + id: "5005", + playerId: "1006", + gameId: "2001", gameName: "英雄联盟", title: "LOL陪玩轻松局", description: "不想上分只想开心的也可以来,我陪你打,不骂人不催,聊天也行。", @@ -62,9 +62,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天都有空,提前说一声"], }, { - id: "s6", - playerId: "u6", - gameId: "g11", + id: "5006", + playerId: "1006", + gameId: "2011", gameName: "第五人格", title: "第五人格求生者陪玩", description: "求生者主,各个角色都会,带你赢监管者。新手也接,慢慢教。", @@ -73,9 +73,9 @@ export const mockServices: PlayerService[] = [ availability: ["周末全天", "工作日晚上8点后"], }, { - id: "s7", - playerId: "u7", - gameId: "g2", + id: "5007", + playerId: "1007", + gameId: "2002", gameName: "王者荣耀", title: "王者女生陪玩双排", description: "女生打手,段位星耀,不接受质疑我的操作。认真打的来,想找人聊天的别来。", @@ -85,9 +85,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天晚上7点到12点"], }, { - id: "s8", - playerId: "u7", - gameId: "g6", + id: "5008", + playerId: "1007", + gameId: "2006", gameName: "和平精英", title: "和平精英吃鸡陪玩", description: "和平玩了三年,枪法稳,带你吃鸡。不喜欢乱冲的,打法偏稳健。", @@ -97,9 +97,9 @@ export const mockServices: PlayerService[] = [ availability: ["周末全天", "工作日晚上8点后"], }, { - id: "s9", - playerId: "u7", - gameId: "g9", + id: "5009", + playerId: "1007", + gameId: "2009", gameName: "绝区零", title: "绝区零日常代肝", description: "每天日常、周常都帮你做,不漏活动,有什么特殊需求说一声。", @@ -108,9 +108,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天下午到晚上"], }, { - id: "s10", - playerId: "u8", - gameId: "g8", + id: "5010", + playerId: "1008", + gameId: "2008", gameName: "无畏契约", title: "无畏契约上分", description: "不多说,看战绩。", @@ -120,9 +120,9 @@ export const mockServices: PlayerService[] = [ availability: ["晚上10点后"], }, { - id: "s11", - playerId: "u8", - gameId: "g7", + id: "5011", + playerId: "1008", + gameId: "2007", gameName: "DOTA2", title: "DOTA2组排", description: "DOTA老玩家,各位置都行,不废话,进来打就是了。", @@ -132,9 +132,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天凌晨前都在"], }, { - id: "s12", - playerId: "u8", - gameId: "g3", + id: "5012", + playerId: "1008", + gameId: "2003", gameName: "CS2", title: "CS2上分代打", description: "只接代打,不陪玩。效率高,不磨蹭。", @@ -144,9 +144,9 @@ export const mockServices: PlayerService[] = [ availability: ["不定时,接单后尽快开始"], }, { - id: "s13", - playerId: "u9", - gameId: "g1", + id: "5013", + playerId: "1009", + gameId: "2001", gameName: "英雄联盟", title: "LOL稳定双排", description: "接单稳,不掉线,说几点上就几点上。打辅助和打野,配合你的节奏走。", @@ -156,9 +156,9 @@ export const mockServices: PlayerService[] = [ availability: ["工作日晚上8点后", "周末下午开始"], }, { - id: "s14", - playerId: "u9", - gameId: "g10", + id: "5014", + playerId: "1009", + gameId: "2010", gameName: "崩坏:星穹铁道", title: "星铁日常代肝", description: "每日任务、模拟宇宙、忘却之庭都做,体力全清,活动不落。长期单子优先。", @@ -167,9 +167,9 @@ export const mockServices: PlayerService[] = [ availability: ["每天都有,早上到晚上都行"], }, { - id: "s15", - playerId: "u9", - gameId: "g12", + id: "5015", + playerId: "1009", + gameId: "2012", gameName: "三角洲行动", title: "三角洲行动组队", description: "三角洲玩得比较多,战术打法,不乱冲。稳定上线,说好时间不会放鸽子。", diff --git a/lib/mock/shops.ts b/lib/mock/shops.ts index 9ef508d..21db182 100644 --- a/lib/mock/shops.ts +++ b/lib/mock/shops.ts @@ -3,7 +3,7 @@ import { mockUsers } from "./users" export const mockShops: Shop[] = [ { - id: "shop1", + id: "3001", owner: mockUsers[9], name: "老王游戏工作室", banner: "/banners/shop1.jpg", @@ -34,7 +34,7 @@ export const mockShops: Shop[] = [ }, }, { - id: "shop2", + id: "3002", owner: mockUsers[10], name: "Yuki 小屋", description: @@ -60,7 +60,7 @@ export const mockShops: Shop[] = [ }, }, { - id: "shop3", + id: "3003", owner: mockUsers[11], name: "浩哥开黑", description: diff --git a/lib/mock/transactions.ts b/lib/mock/transactions.ts index 13cb157..4521275 100644 --- a/lib/mock/transactions.ts +++ b/lib/mock/transactions.ts @@ -2,133 +2,133 @@ import type { WalletTransaction } from "../types" export const mockTransactions: WalletTransaction[] = [ { - id: "t1", + id: "9401", type: "topup", amount: 500, description: "充值", createdAt: "2025-01-03T10:00:00Z", }, { - id: "t2", + id: "9402", type: "payment", amount: -75, - description: "支付订单 ord1", + description: "支付订单 6001", createdAt: "2025-01-05T19:30:00Z", }, { - id: "t3", + id: "9403", type: "payment", amount: -54, - description: "支付订单 ord2", + description: "支付订单 6002", createdAt: "2025-01-08T15:00:00Z", }, { - id: "t4", + id: "9404", type: "topup", amount: 300, description: "充值", createdAt: "2025-01-15T09:00:00Z", }, { - id: "t5", + id: "9405", type: "payment", amount: -60, - description: "支付订单 ord5", + description: "支付订单 6005", createdAt: "2025-01-17T20:30:00Z", }, { - id: "t6", + id: "9406", type: "payment", amount: -90, - description: "支付订单 ord3", + description: "支付订单 6003", createdAt: "2025-01-11T22:00:00Z", }, { - id: "t7", + id: "9407", type: "payment", amount: -44, - description: "支付订单 ord4", + description: "支付订单 6004", createdAt: "2025-01-14T20:00:00Z", }, { - id: "t8", + id: "9408", type: "refund", amount: 44, - description: "订单 ord15 退款", + description: "订单 6015 退款", createdAt: "2025-02-16T18:10:00Z", }, { - id: "t9", + id: "9409", type: "topup", amount: 200, description: "充值", createdAt: "2025-02-01T09:00:00Z", }, { - id: "t10", + id: "9410", type: "payment", amount: -40, - description: "支付订单 ord8", + description: "支付订单 6008", createdAt: "2025-02-01T20:00:00Z", }, { - id: "t11", + id: "9411", type: "payment", amount: -120, - description: "支付订单 ord9", + description: "支付订单 6009", createdAt: "2025-02-03T22:30:00Z", }, { - id: "t12", + id: "9412", type: "payment", amount: -84, - description: "支付订单 ord10", + description: "支付订单 6010", createdAt: "2025-02-06T19:00:00Z", }, { - id: "t13", + id: "9413", type: "payment", amount: -50, - description: "支付订单 ord11", + description: "支付订单 6011", createdAt: "2025-02-08T21:00:00Z", }, { - id: "t14", + id: "9414", type: "payment", amount: -30, - description: "支付订单 ord12", + description: "支付订单 6012", createdAt: "2025-02-10T20:00:00Z", }, { - id: "t15", + id: "9415", type: "payment", amount: -18, - description: "支付订单 ord13", + description: "支付订单 6013", createdAt: "2025-02-12T14:00:00Z", }, { - id: "t16", + id: "9416", type: "payment", amount: -60, - description: "支付订单 ord14", + description: "支付订单 6014", createdAt: "2025-02-14T21:00:00Z", }, { - id: "t17", + id: "9417", type: "income", amount: 63.75, - description: "订单 ord1 收入(扣除15%抽成)", + description: "订单 6001 收入(扣除15%抽成)", createdAt: "2025-01-05T22:30:00Z", }, { - id: "t18", + id: "9418", type: "income", amount: 47.52, - description: "订单 ord2 收入(扣除12%抽成)", + description: "订单 6002 收入(扣除12%抽成)", createdAt: "2025-01-08T18:00:00Z", }, { - id: "t19", + id: "9419", type: "withdrawal", amount: -100, description: "提现到银行卡", diff --git a/lib/mock/users.ts b/lib/mock/users.ts index 0292a78..9e07f32 100644 --- a/lib/mock/users.ts +++ b/lib/mock/users.ts @@ -2,8 +2,9 @@ import type { User } from "../types" export const mockUsers: User[] = [ { - id: "u1", + id: "1001", username: "xiao_chen2333", + email: "xiao_chen2333@example.com", nickname: "小陈", avatar: "/avatars/u1.jpg", role: "consumer", @@ -12,8 +13,9 @@ export const mockUsers: User[] = [ createdAt: "2024-07-12T10:23:00Z", }, { - id: "u2", + id: "1002", username: "lingling_up", + email: "lingling_up@example.com", nickname: "玲玲", avatar: "/avatars/u2.jpg", role: "consumer", @@ -22,16 +24,18 @@ export const mockUsers: User[] = [ createdAt: "2024-08-03T15:44:00Z", }, { - id: "u3", + id: "1003", username: "zz_noob99", + email: "zz_noob99@example.com", nickname: "zz", avatar: "/avatars/u3.jpg", role: "consumer", createdAt: "2024-09-20T09:11:00Z", }, { - id: "u4", + id: "1004", username: "MoMo_1107", + email: "MoMo_1107@example.com", nickname: "莫莫", avatar: "/avatars/u4.jpg", role: "consumer", @@ -40,8 +44,9 @@ export const mockUsers: User[] = [ createdAt: "2024-11-05T21:30:00Z", }, { - id: "u5", + id: "1005", username: "ace_junjun", + email: "ace_junjun@example.com", nickname: "俊俊", avatar: "/avatars/u5.jpg", role: "player", @@ -50,8 +55,9 @@ export const mockUsers: User[] = [ createdAt: "2024-06-18T13:00:00Z", }, { - id: "u6", + id: "1006", username: "w1nter_gg", + email: "w1nter_gg@example.com", nickname: "Winter", avatar: "/avatars/u1.jpg", role: "player", @@ -59,8 +65,9 @@ export const mockUsers: User[] = [ createdAt: "2024-07-29T18:55:00Z", }, { - id: "u7", + id: "1007", username: "qiqi_carry", + email: "qiqi_carry@example.com", nickname: "琪琪", avatar: "/avatars/u2.jpg", role: "player", @@ -69,16 +76,18 @@ export const mockUsers: User[] = [ createdAt: "2024-08-14T11:22:00Z", }, { - id: "u8", + id: "1008", username: "darkk_solo", + email: "darkk_solo@example.com", nickname: "暗影", avatar: "/avatars/u3.jpg", role: "player", createdAt: "2024-10-01T08:40:00Z", }, { - id: "u9", + id: "1009", username: "feifei_top1", + email: "feifei_top1@example.com", nickname: "飞飞", avatar: "/avatars/u4.jpg", role: "player", @@ -87,8 +96,9 @@ export const mockUsers: User[] = [ createdAt: "2024-12-09T20:15:00Z", }, { - id: "u10", + id: "1010", username: "boss_laowang", + email: "boss_laowang@example.com", nickname: "老王", avatar: "/avatars/u5.jpg", role: "owner", @@ -97,8 +107,9 @@ export const mockUsers: User[] = [ createdAt: "2024-06-01T09:00:00Z", }, { - id: "u11", + id: "1011", username: "yuki_studio", + email: "yuki_studio@example.com", nickname: "Yuki", avatar: "/avatars/u1.jpg", role: "owner", @@ -107,8 +118,9 @@ export const mockUsers: User[] = [ createdAt: "2024-09-07T14:30:00Z", }, { - id: "u12", + id: "1012", username: "hao_ge_gg", + email: "hao_ge_gg@example.com", nickname: "浩哥", avatar: "/avatars/u2.jpg", role: "owner", diff --git a/lib/types.ts b/lib/types.ts index 8b237c1..8f076c5 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -1,9 +1,13 @@ -export type UserRole = "consumer" | "player" | "owner" +// All `id` fields come from backend snowflake int64. +// Frontend stores them as strings to avoid JS number precision issues. + +export type UserRole = "consumer" | "player" | "owner" | "admin" export type VerificationStatus = "pending" | "approved" | "rejected" export interface User { id: string username: string + email?: string nickname: string avatar: string role: UserRole @@ -29,7 +33,7 @@ export interface PlayerService { title: string description: string price: number - unit: "局" | "星" | "次" + unit: string rankRange?: string availability: string[] } diff --git a/tests/search-catalog.test.ts b/tests/search-catalog.test.ts index 9664245..5e09647 100644 --- a/tests/search-catalog.test.ts +++ b/tests/search-catalog.test.ts @@ -16,33 +16,32 @@ describe("searchCatalog", () => { it("matches player nickname", () => { const res = searchCatalog({ q: "winter", limit: 50 }, data) const playerItems = res.items.filter((i) => i.type === "player") - expect(playerItems.some((i) => i.type === "player" && i.player.id === "u6")).toBe(true) + expect(playerItems.some((i) => i.type === "player" && i.player.id === "1006")).toBe(true) }) it("matches player nickname case-insensitively", () => { const res = searchCatalog({ q: "WINTER", limit: 50 }, data) const playerItems = res.items.filter((i) => i.type === "player") - expect(playerItems.some((i) => i.type === "player" && i.player.id === "u6")).toBe(true) + expect(playerItems.some((i) => i.type === "player" && i.player.id === "1006")).toBe(true) }) it("matches shop name", () => { const res = searchCatalog({ q: "yuki", limit: 50 }, data) const shopItems = res.items.filter((i) => i.type === "shop") - expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "shop2")).toBe(true) + expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "3002")).toBe(true) }) it("matches player game name", () => { const res = searchCatalog({ q: "cs2", limit: 50 }, data) const playerItems = res.items.filter((i) => i.type === "player") - // u8 has CS2 in games - expect(playerItems.some((i) => i.type === "player" && i.player.id === "u8")).toBe(true) + // 1008 has CS2 in games + expect(playerItems.some((i) => i.type === "player" && i.player.id === "1008")).toBe(true) }) it("matches shop derived games", () => { const res = searchCatalog({ q: "cs2", limit: 50 }, data) const shopItems = res.items.filter((i) => i.type === "shop") - // shop1 has CS2 via u5's service s3 - expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "shop1")).toBe(true) + expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "3001")).toBe(true) }) it("returns all items when q is empty", () => { @@ -64,8 +63,7 @@ describe("searchCatalog", () => { it("filters shops by derived games from services", () => { const res = searchCatalog({ selectedGames: ["CS2"], limit: 50 }, data) const shopItems = res.items.filter((i) => i.type === "shop") - // shop1 has CS2 via services - expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "shop1")).toBe(true) + expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "3001")).toBe(true) }) it("uses ANY-match (OR) for multiple games", () => { @@ -93,8 +91,8 @@ describe("searchCatalog", () => { } } // u7 is busy, u9 is offline — they should be excluded - expect(playerItems.some((i) => i.type === "player" && i.player.id === "u7")).toBe(false) - expect(playerItems.some((i) => i.type === "player" && i.player.id === "u9")).toBe(false) + expect(playerItems.some((i) => i.type === "player" && i.player.id === "1007")).toBe(false) + expect(playerItems.some((i) => i.type === "player" && i.player.id === "1009")).toBe(false) }) it("filters shops by hasAvailable (any player available)", () => { @@ -105,10 +103,8 @@ describe("searchCatalog", () => { expect(item.hasAvailable).toBe(true) } } - // shop3 has only u9 (offline) → excluded - expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "shop3")).toBe(false) - // shop1 has u5 (available) → included - expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "shop1")).toBe(true) + expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "3003")).toBe(false) + expect(shopItems.some((i) => i.type === "shop" && i.shop.id === "3001")).toBe(true) }) })