/** * 和服务器交互的API接口 * */ import { ApiClient } from "../network/client/ApiClient"; import type { Endpoint } from "../network/client/endpoints"; import type { ApiResponse } from "../network/client/types"; import proto from 'db://assets/Scripts/proto/proto.pb.js'; export class PaymentApi { private static _I: PaymentApi | null = null; static get I() { return this._I ?? (this._I = new PaymentApi()); } private constructor(private api = ApiClient.I) {} // 下单 createOrder(req: proto.cs.ICSCreateOrderReq): Promise> { let epData: Endpoint = { path: "api/logic/createOrder", method: "POST", codec: "json", needsAuth: true, }; return this.api.call(epData, req); } // 查询订单 queryOrder(req: proto.cs.ICSQueryOrderReq): Promise> { let epData: Endpoint = { path: "api/logic/queryOrder", method: "POST", codec: "json", needsAuth: true, }; return this.api.call(epData, req); } }