77 lines
2.7 KiB
TypeScript
77 lines
2.7 KiB
TypeScript
import type { IGirlService } from "./IGirlService";
|
|
import { HttpGirlService } from "./HttpGirlService";
|
|
import { MockGirlService } from "./MockGirlService";
|
|
import type { ApiResponse } from "../client/types";
|
|
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
|
|
|
// 模拟开关
|
|
const USE_MOCK = false;
|
|
|
|
export class GirlService implements IGirlService {
|
|
private static _I: GirlService | null = null;
|
|
public static get I(): GirlService {
|
|
if (!GirlService._I) GirlService._I = new GirlService();
|
|
return GirlService._I;
|
|
}
|
|
|
|
private impl: IGirlService;
|
|
private constructor() {
|
|
this.impl = USE_MOCK ? new MockGirlService() : new HttpGirlService();
|
|
}
|
|
|
|
/** 可运行期切换 */
|
|
public switch(useMock: boolean) {
|
|
this.impl = useMock ? new MockGirlService() : new HttpGirlService();
|
|
}
|
|
|
|
// 每日推荐
|
|
public async reqDailyRecommend(req: proto.cs.ICSDailyRecommendReq): Promise<ApiResponse<proto.cs.ICSDailyRecommendRes>> {
|
|
return this.impl.reqDailyRecommend(req);
|
|
}
|
|
|
|
// 获取技师列表
|
|
public async reqGetGirlList(req: proto.cs.ICSGetGirlListReq): Promise<ApiResponse<proto.cs.ICSGetGirlListRes>> {
|
|
return this.impl.reqGetGirlList(req);
|
|
}
|
|
|
|
// 获取技师详细信息
|
|
public async reqGetGirlDetail(req: proto.cs.ICSGetGirlDetailReq): Promise<ApiResponse<proto.cs.ICSGetGirlDetailRes>> {
|
|
return this.impl.reqGetGirlDetail(req);
|
|
}
|
|
|
|
// 解锁技师
|
|
public async reqUnlockGirl(req: proto.cs.ICSUnlockGirlReq): Promise<ApiResponse<proto.cs.ICSUnlockGirlRes>> {
|
|
return this.impl.reqUnlockGirl(req);
|
|
}
|
|
|
|
// 解锁资源
|
|
public async reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise<ApiResponse<proto.cs.ICSUnlockResourceRes>> {
|
|
return this.impl.reqUnlockGirlRes(req);
|
|
}
|
|
|
|
// 获取可聊天的技师数据
|
|
public async reqCanChatGirlData(req: proto.cs.ICSGetLastChatListReq): Promise<ApiResponse<proto.cs.ICSGetLastChatListRes>> {
|
|
return this.impl.reqCanChatGirlData(req);
|
|
}
|
|
|
|
// 获取排行榜列表
|
|
public async reqGirlRankData(req: proto.cs.ICSGetRankReq): Promise<ApiResponse<proto.cs.ICSGetRankRes>> {
|
|
return this.impl.reqGirlRankData(req);
|
|
}
|
|
|
|
// 查看图片或者视频上报,用于排行榜
|
|
public async reqViewGirl(req: proto.cs.ICSViewGirlReq): Promise<ApiResponse<proto.cs.ICSViewGirlRes>> {
|
|
return this.impl.reqViewGirl(req);
|
|
}
|
|
|
|
// 收藏技师
|
|
public async reqBookmarkGirl(req: proto.cs.ICSBookmarkReq): Promise<ApiResponse<proto.cs.ICSBookmarkRes>> {
|
|
return this.impl.reqBookmarkGirl(req);
|
|
}
|
|
|
|
// 获取收藏列表
|
|
public async reqBookmarkGirlList(req: proto.cs.ICSGetBookmarkReq): Promise<ApiResponse<proto.cs.ICSGetBookmarkRes>> {
|
|
return this.impl.reqBookmarkGirlList(req);
|
|
}
|
|
}
|