Files
18xchat/assets/Scripts/chat18x/network/services/HttpChatService.ts
T

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2025-08-29 16:39:41 +08:00
import { ApiClient } from "../client/ApiClient";
import type { Endpoint } from "../client/endpoints";
import type { ApiResponse } from "../client/types";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import type { IChatService } from "./IChatService";
export class HttpChatService implements IChatService {
constructor(private api = ApiClient.I) {}
2025-09-21 19:41:49 +08:00
2025-09-08 19:44:45 +08:00
// 上报聊天数据
async reqChatMsg(req: proto.cs.ICSChatMsgReq): Promise<ApiResponse<proto.cs.ICSChatMsgRes>> {
const ep: Endpoint<proto.cs.ICSChatMsgReq, proto.cs.ICSChatMsgRes> = {
path: "api/logic/chatMsg",
2025-08-29 16:39:41 +08:00
method: "POST",
codec: "json",
needsAuth: true,
};
return this.api.call(ep, req);
}
2025-09-08 19:44:45 +08:00
// 获取聊天数据
async reqGetChatMsg(req: proto.cs.ICSGetChatMsgReq): Promise<ApiResponse<proto.cs.ICSGetChatMsgRes>> {
const ep: Endpoint<proto.cs.ICSGetChatMsgReq, proto.cs.ICSGetChatMsgRes> = {
path: "api/logic/getChatMsg",
method: "POST",
codec: "json",
needsAuth: true,
};
return this.api.call(ep, req);
}
// 获取技师聊天次数
async reqChatCountData(req: proto.cs.ICSGetChatRemainCountReq): Promise<ApiResponse<proto.cs.ICSGetChatRemainCountRes>> {
const ep: Endpoint<proto.cs.ICSGetChatRemainCountReq, proto.cs.ICSGetChatRemainCountRes> = {
path: "api/logic/getChatRemainCount",
method: "POST",
codec: "json",
needsAuth: true,
};
return this.api.call(ep, req);
}
2025-08-29 16:39:41 +08:00
}