This commit is contained in:
邹宗楠
2023-05-19 18:26:23 +08:00
parent 7c7def7436
commit 20cda2be44
4 changed files with 31 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ import (
"git.rosy.net.cn/jx-callback/globals/api"
)
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID, code string) (orderPay *model.OrderPay, err error) {
// if order.FromStoreID != 0 {
// result, _ := orderman.GetMatterStoreOrderCount(nil, order.FromStoreID)
// if !result.Flag {
@@ -45,6 +45,14 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
param.Acct = authInfo.GetAuthID()
}
if code != "" {
appAuth := strings.Split(code, "_")
sessionInfo, err := weixin.GetAPI(appAuth[0]).SNSCode2Session(appAuth[1])
if err != nil {
return nil, err
}
param.Acct = sessionInfo.OpenID
}
}
if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {