mirror of
https://github.com/xxjwxc/public.git
synced 2025-09-26 20:01:19 +08:00
1
This commit is contained in:
@@ -72,3 +72,21 @@ func New(info WxInfo) (WxTools, error) {
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// New 新建及 初始化配置信息
|
||||
func NewWithCertFile(info WxInfo, certFileLoc, keyFileLoc, rootcaFileLoc string) (WxTools, error) {
|
||||
t := &wxTools{
|
||||
wxInfo: info,
|
||||
certFile: certFileLoc,
|
||||
keyFile: keyFileLoc,
|
||||
rootcaFile: rootcaFileLoc,
|
||||
client: wxpay.NewClient(info.AppID, info.MchID, info.APIKey),
|
||||
cache: mycache.NewCache(_cacheToken),
|
||||
}
|
||||
err := t.client.WithCert(t.certFile, t.keyFile, t.rootcaFile)
|
||||
if err != nil {
|
||||
mylog.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user