feat: 支付订单

This commit is contained in:
2025-09-06 18:55:07 +08:00
parent c78be00ded
commit 25e9b310a6
4 changed files with 222 additions and 101 deletions

View File

@@ -0,0 +1,46 @@
import httpService from './httpService'
import type { ApiResponse } from './httpService'
import { requestPayment } from '@tarojs/taro'
export interface SignType {
/** 仅在微信支付 v2 版本接口适用 */
MD5
/** 仅在微信支付 v2 版本接口适用 */
'HMAC-SHA256'
/** 仅在微信支付 v3 版本接口适用 */
RSA
}
export interface PayMentParams {
order_id: number,
order_no: string,
status: number,
appId: string,
timeStamp: string,
nonceStr: string,
package: string,
signType: keyof SignType,
paySign: string
}
// 用户接口
export interface OrderResponse {
participant_id: number,
payment_required: boolean,
payment_params: PayMentParams
}
// 发布球局类
class OrderService {
// 用户登录
async createOrder(game_id: number): Promise<ApiResponse<OrderResponse>> {
return httpService.post('/payment/create_order', { game_id }, {
showLoading: true,
})
}
// async getOrderInfo()
}
// 导出认证服务实例
export default new OrderService()