diff --git a/api/proto/vas/proto/pay.go b/api/proto/vas/proto/pay.go index c1c95eb6..75ab2cfb 100644 --- a/api/proto/vas/proto/pay.go +++ b/api/proto/vas/proto/pay.go @@ -116,8 +116,14 @@ type QueryWechatData struct { // h5直接解锁微信 type H5DirectUnlockWechatReq struct { base.BaseRequest - Uid int64 `json:"uid"` // 主播id - PayType string `json:"pay_type"` // 支付类型 + Uid int64 `json:"uid"` // 主播id + 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支付参数 +} diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 7bbfc7d1..f56c9d29 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -1349,6 +1349,20 @@ func (v *Vas) H5DirectUnlockWechat(ctx *gin.Context, req *vasproto.H5DirectUnloc 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{ BaseRequest: req.BaseRequest,