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

32 lines
1.1 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 { IShopService } from "./IShopService";
export class HttpShopService implements IShopService {
constructor(private api = ApiClient.I) {}
// 获取商品列表
2025-09-08 19:44:45 +08:00
async reqShopList(req: proto.cs.ICSGetPurchaseReq): Promise<ApiResponse<proto.cs.ICSGetPurchaseRes>> {
const ep: Endpoint<proto.cs.ICSGetPurchaseReq, proto.cs.ICSGetPurchaseRes> = {
path: "api/logic/getPurchase",
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 reqBuyGood(req: proto.cs.ICSBuyGoodReq): Promise<ApiResponse<proto.cs.ICSBuyGoodRes>> {
const ep: Endpoint<proto.cs.ICSBuyGoodReq, proto.cs.ICSBuyGoodRes> = {
path: "api/logic/buyGood",
method: "POST",
codec: "json",
needsAuth: true,
};
return this.api.call(ep, req);
}
2025-08-29 16:39:41 +08:00
}