25 lines
833 B
TypeScript
25 lines
833 B
TypeScript
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 ShopService {
|
|
private static _I: ShopService | null = null;
|
|
public static get I(): ShopService {
|
|
if (!ShopService._I) ShopService._I = new ShopService();
|
|
return ShopService._I;
|
|
}
|
|
private constructor(private api = ApiClient.I) {}
|
|
|
|
// 获取商品列表
|
|
public async reqShopList(req: proto.cs.ICSGetShopReq): Promise<ApiResponse<proto.cs.ICSGetShopRes>> {
|
|
let epData: Endpoint<proto.cs.ICSGetShopReq, proto.cs.ICSGetShopRes> = {
|
|
path: "api/logic/shop",
|
|
method: "POST",
|
|
codec: "json",
|
|
needsAuth: true
|
|
};
|
|
return this.api.call(epData, req);
|
|
}
|
|
}
|