This commit is contained in:
lwl0608 2023-12-23 19:34:02 +08:00
parent 2634ad7c17
commit 157eed2d28
2 changed files with 23 additions and 3 deletions

View File

@ -118,6 +118,12 @@ type H5DirectUnlockWechatReq struct {
base.BaseRequest base.BaseRequest
Uid int64 `json:"uid"` // 主播id Uid int64 `json:"uid"` // 主播id
PayType string `json:"pay_type"` // 支付类型 PayType string `json:"pay_type"` // 支付类型
InviterMid int64
} }
type H5DirectUnlockWechatData CreateOrderData type H5DirectUnlockWechatData struct {
CoinEnough int `json:"coin_enough"` // 0:不够(用下面的支付宝参数)1:够
OrderId string `json:"order_id"` // 订单id
AlipayParamStr string `json:"alipay_param_str"` // 支付宝 app支付参数
AlipayH5ParamStr string `json:"alipay_h5_param_str"` // 支付宝 h5支付参数
}

View File

@ -1349,6 +1349,20 @@ func (v *Vas) H5DirectUnlockWechat(ctx *gin.Context, req *vasproto.H5DirectUnloc
return return
} }
// 检查钱包
wallet, _ := v.CheckWalletExist(ctx, req.Mid)
// 金币够不够
if wallet.GetCoins() >= uVas.GetH5WechatCoinPrice() {
v.OneStepUnlockContact(ctx, &vasproto.OneStepUnlockContactReq{
BaseRequest: req.BaseRequest,
ContactProductId: dbstruct.ProductIdH5ContactWechat,
Uid: req.Uid,
InviterMid: req.InviterMid,
})
return
}
// 创建订单 // 创建订单
cData, err := v.CreateOrder(ctx, &vasproto.CreateOrderReq{ cData, err := v.CreateOrder(ctx, &vasproto.CreateOrderReq{
BaseRequest: req.BaseRequest, BaseRequest: req.BaseRequest,