Browse Source

add Reverse:for v1.0.4

tags/v1.0.4
huangjuajun 2 years ago
parent
commit
aa9f80c7f0
4 changed files with 18 additions and 22 deletions
  1. +1
    -5
      go.mod
  2. +7
    -7
      lib/local_alipay/api.go
  3. +6
    -6
      pay/pay_by_own.go
  4. +4
    -4
      pay/pay_config.go

+ 1
- 5
go.mod View File

@@ -3,13 +3,9 @@ module code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git
go 1.16

require (
code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git v1.0.3
github.com/go-pay/gopay v1.5.78 // indirect
github.com/go-redis/redis v6.15.9+incompatible // indirect
code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git v1.0.7
github.com/go-sql-driver/mysql v1.6.0
github.com/iGoogle-ink/gopay v1.5.36
go.uber.org/zap v1.13.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
xorm.io/builder v0.3.10 // indirect
xorm.io/xorm v1.3.0
)

+ 7
- 7
lib/local_alipay/api.go View File

@@ -2,7 +2,7 @@ package local_alipay

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils/logx"
zhios_tool_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils/logx"
"fmt"
"github.com/iGoogle-ink/gopay"
"github.com/iGoogle-ink/gopay/alipay"
@@ -86,7 +86,7 @@ func TradeAppPay(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS str
//手机APP支付参数请求
payParam, err := client.TradeAppPay(body)
if err != nil {
return "", logx.Warn(err)
return "", zhios_tool_logx.Warn(err)
}
return payParam, nil
}
@@ -165,7 +165,7 @@ func TradeWapPay(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS, pa
//手机网站支付请求
payUrl, err := client.TradeWapPay(body)
if err != nil {
return "", logx.Warn(err)
return "", zhios_tool_logx.Warn(err)

}
return payUrl, nil
@@ -238,7 +238,7 @@ func TradeCreate(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS str
// 2、client.SystemOauthToken() 返回取值:aliRsp.SystemOauthTokenResponse.UserId
buyer_id, err := client.SystemOauthToken(body)
if err != nil {
return nil, logx.Warn(err)
return nil, zhios_tool_logx.Warn(err)
}
body.Set("buyer_id", buyer_id)
body.Set("out_trade_no", orderID)
@@ -247,10 +247,10 @@ func TradeCreate(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS str
aliRsp, err := client.TradeCreate(body)

if err != nil {
return nil, logx.Warn(err)
return nil, zhios_tool_logx.Warn(err)
}
logx.Warn("aliRsp:", *aliRsp)
logx.Warn("aliRsp.TradeNo:", aliRsp.Response.TradeNo)
zhios_tool_logx.Warn("aliRsp:", *aliRsp)
zhios_tool_logx.Warn("aliRsp.TradeNo:", aliRsp.Response.TradeNo)
return aliRsp, nil

}

+ 6
- 6
pay/pay_by_own.go View File

@@ -3,8 +3,8 @@ package pay
import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/lib/local_alipay"
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/e"
"code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils"
zhios_tool_e "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/e"
zhios_tool_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils"
"fmt"
"xorm.io/xorm"
)
@@ -21,7 +21,7 @@ func Alipay(eg *xorm.Engine, args map[string]string) (string, error) {
WxAppletFilepathUrl: args["wx_applet_filepath_url"],
}
if args["private_key"] == "" || args["app_id"] == "" {
return "", e.NewErr(400, "请在后台正确配置支付宝")
return "", zhios_tool_e.NewErr(400, "请在后台正确配置支付宝")
}
var param interface{}
var err error
@@ -33,14 +33,14 @@ func Alipay(eg *xorm.Engine, args map[string]string) (string, error) {
case md.PLATFORM_ANDROID, md.PLATFORM_IOS:
param, err = local_alipay.TradeAppPay(args["app_id"], args["private_key"], args["subject"], args["ord_id"], args["amount"], args["notify_url"], args["rsa"], args["pkcs"], paySet)
default:
return "", e.NewErr(400, "支付平台不存在")
return "", zhios_tool_e.NewErr(400, "支付平台不存在")
}
if err != nil {
fmt.Println("支付宝错误日志")
fmt.Println(param)
fmt.Println(err)
return "", e.NewErr(400, "支付宝订单创建失败")
return "", zhios_tool_e.NewErr(400, "支付宝订单创建失败")
}
return utils.AnyToString(param), nil
return zhios_tool_utils.AnyToString(param), nil

}

+ 4
- 4
pay/pay_config.go View File

@@ -3,8 +3,8 @@ package pay
import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db"
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/db/model"
"code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/e"
"code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils/cache"
zhios_tool_e "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/e"
cache "code.fnuoos.com/go_rely_warehouse/zyos_go_tools.git/utils/cache"
"xorm.io/xorm"
)

@@ -16,10 +16,10 @@ func JudgePayChannel(mid, paySceneIdentifier string) (model.PayChannelMaster, er
return payChannelMaster, err
}
if !res {
return payChannelMaster, e.NewErr(400, "查询数据失败")
return payChannelMaster, zhios_tool_e.NewErr(400, "查询数据失败")
}
if payChannelMaster.ChannelId == 0 {
return payChannelMaster, e.NewErr(400, "请联系服务商绑定支付渠道")
return payChannelMaster, zhios_tool_e.NewErr(400, "请联系服务商绑定支付渠道")
}
return payChannelMaster, nil
}


Loading…
Cancel
Save