commit8d3548006dAuthor: chen wei bo <1025839511@qq.com> Date: Fri Sep 12 16:00:29 2025 +0800 更新语言表 commit0d66f72c61Author: chen wei bo <1025839511@qq.com> Date: Fri Sep 12 15:19:32 2025 +0800 支付相关 commit8372d3b489Author: chen wei bo <1025839511@qq.com> Date: Fri Sep 12 11:29:11 2025 +0800 登录之后获取全局数据
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { ApiResponse } from "../client/types";
|
|
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
|
import type { ICommonService } from "./ICommonService";
|
|
import { HttpCommonService } from "./HttpCommonService";
|
|
import { MockCommonService } from "./MockCommonService";
|
|
|
|
// 模拟开关
|
|
const USE_MOCK = false;
|
|
|
|
export class CommonService implements ICommonService {
|
|
private static _I: CommonService | null = null;
|
|
public static get I(): CommonService {
|
|
if (!CommonService._I) CommonService._I = new CommonService();
|
|
return CommonService._I;
|
|
}
|
|
|
|
private impl: ICommonService;
|
|
|
|
private constructor() {
|
|
this.impl = USE_MOCK ? new MockCommonService() : new HttpCommonService();
|
|
}
|
|
|
|
/** 运行期切换 */
|
|
public switch(useMock: boolean) {
|
|
this.impl = useMock ? new MockCommonService() : new HttpCommonService();
|
|
}
|
|
|
|
// 获取配置
|
|
public async reqResConfig(req: proto.cs.ICSGetResConfigReq): Promise<ApiResponse<proto.cs.ICSGetResConfigRes>> {
|
|
return this.impl.reqResConfig(req);
|
|
}
|
|
}
|