插件-云闪付红包,查询增加请求超时
This commit is contained in:
parent
652297ffcc
commit
55e03af21e
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/wechatpay-apiv3/wechatpay-go/core/option"
|
||||
"github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch"
|
||||
"github.com/wechatpay-apiv3/wechatpay-go/utils"
|
||||
"log"
|
||||
"plugins/utils/weixin"
|
||||
)
|
||||
|
||||
|
@ -22,8 +21,6 @@ func transferBatchApiService(ctx context.Context, c *weixin.Server) (*transferba
|
|||
}
|
||||
|
||||
func transferDetailApiService(ctx context.Context, c *weixin.Server) (*transferbatch.TransferDetailApiService, error) {
|
||||
cl()
|
||||
return nil, fmt.Errorf("----")
|
||||
mchPrivateKey, err := utils.LoadPrivateKeyWithPath(c.PrivateKeyPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("MchID[%s] load merchant private key error:%v", c.MchID, err)
|
||||
|
@ -47,45 +44,6 @@ func transferDetailApiService(ctx context.Context, c *weixin.Server) (*transferb
|
|||
return &svc, nil
|
||||
}
|
||||
|
||||
func cl() {
|
||||
var (
|
||||
mchID string = "1629276485" // 商户号
|
||||
mchCertificateSerialNumber string = "3C7E21B74C04BE6227A690EB44184F219D763F92" // 商户证书序列号
|
||||
mchAPIv3Key string = "ChengDuBale0123456789qwertyuiopa" // 商户APIv3密钥
|
||||
)
|
||||
// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
|
||||
//mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
|
||||
mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/Users/lsxd/code/php/yxxt/market/config/wechatcash/apiclient_key.pem")
|
||||
if err != nil {
|
||||
log.Printf("load merchant private key error:%s", err)
|
||||
return
|
||||
}
|
||||
ctx := context.Background()
|
||||
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
|
||||
opts := []core.ClientOption{
|
||||
option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
|
||||
}
|
||||
client, err := core.NewClient(ctx, opts...)
|
||||
if err != nil {
|
||||
log.Printf("new wechat pay client err:%s", err)
|
||||
return
|
||||
}
|
||||
svc := transferbatch.TransferDetailApiService{Client: client}
|
||||
resp, result, err := svc.GetTransferDetailByNo(ctx,
|
||||
transferbatch.GetTransferDetailByNoRequest{
|
||||
BatchId: core.String("1030000071100999991182020050700019480001"),
|
||||
DetailId: core.String("1040000071100999991182020050700019500100"),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
// 处理错误
|
||||
log.Printf("call GetTransferDetailByNo err:%s", err)
|
||||
} else {
|
||||
// 处理返回结果
|
||||
log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
|
||||
}
|
||||
}
|
||||
|
||||
func verify(ctx context.Context, c *weixin.Server) error {
|
||||
err := c.Verify(ctx, "", "")
|
||||
if err != nil {
|
||||
|
|
|
@ -19,7 +19,6 @@ func config() []byte {
|
|||
MchAPIv3Key: "ChengDuBale0123456789qwertyuiopa",
|
||||
// 商户API私钥
|
||||
PrivateKeyPath: "/Users/lsxd/code/php/yxxt/market/config/wechatcash/apiclient_key.pem",
|
||||
//PrivateKeyPath: "/Users/lsxd/code/go/other/mq/wx/wechat_private_key.pem",
|
||||
}
|
||||
marshal, _ := json.Marshal(c)
|
||||
return marshal
|
||||
|
|
Loading…
Reference in New Issue