网络层

This commit is contained in:
chen wei bo
2025-08-15 00:36:54 +08:00
parent 80dcd70415
commit 9c67163cfd
28 changed files with 21014 additions and 1382 deletions
@@ -0,0 +1,25 @@
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';
export class AuthService {
private static _I: AuthService | null = null;
public static get I(): AuthService {
if (!AuthService._I) AuthService._I = new AuthService();
return AuthService._I;
}
private constructor(private api = ApiClient.I) {}
private EP_LOGIN: Endpoint<proto.ProtoMsg.ILoginReq, proto.ProtoMsg.ILoginRsp> = {
path: "login",
method: "POST",
codec: "json",
needsAuth: false
};
// 登录
public async login(req: proto.ProtoMsg.ILoginReq): Promise<ApiResponse<proto.ProtoMsg.ILoginRsp>> {
return this.api.call(this.EP_LOGIN, req);
}
}