import type { ApiResponse } from "../client/types"; import proto from "db://assets/Scripts/proto/proto.pb.js"; import type { IChatService } from "./IChatService"; export class MockChatService implements IChatService { private delay(ms = 160) { return new Promise(r => setTimeout(r, ms)); } // 按你们项目的 ApiResponse 结构调整这里即可 private ok(data: T): ApiResponse { return ({ ok: true, data } as unknown) as ApiResponse; } // private err(message = "mock buyChat error"): ApiResponse { // return ({ ok: false, error: { message } } as unknown) as ApiResponse; // } async reqBuyChat(_req: proto.cs.ICSBuyChatReq): Promise> { await this.delay(); // CSBuyChatRes 在 proto 中为空消息,这里返回 {} const res: proto.cs.ICSBuyChatRes = {}; return this.ok(res); } }