完善充值功能,添加支付宝和微信的充值逻辑及二维码展示

This commit is contained in:
2025-04-18 16:22:50 +08:00
parent c9e65b6617
commit 687c48c1b8
7 changed files with 260 additions and 94 deletions

33
src/actions/user.ts Normal file
View File

@@ -0,0 +1,33 @@
'use server'
import {callByUser} from '@/actions/base'
export async function RechargeByAlipay(props: {
amount: number
}) {
return callByUser<{
trade_no: string
pay_url: string
}>('/api/user/recharge/prepare/alipay', props)
}
export async function RechargeByAlipayConfirm(props: {
trade_no: string
}) {
return callByUser('/api/user/recharge/confirm/alipay', props)
}
export async function RechargeByWechat(props: {
amount: number
}) {
return callByUser<{
trade_no: string
pay_url: string
}>('/api/user/recharge/prepare/wechat', props)
}
export async function RechargeByWechatConfirm(props: {
trade_no: string
}) {
return callByUser('/api/user/recharge/confirm/wechat', props)
}