feat: 支付订单
This commit is contained in:
46
src/services/orderService.ts
Normal file
46
src/services/orderService.ts
Normal 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()
|
||||
Reference in New Issue
Block a user