Skip to content

Commit 88fd83d

Browse files
author
Matrix-X
committed
update
1 parent 3a91aed commit 88fd83d

File tree

7 files changed

+11
-16
lines changed

7 files changed

+11
-16
lines changed

src/basicService/jssdk/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"errors"
77
"fmt"
88
"github.com/ArtisanCloud/go-libs/object"
9-
"github.com/ArtisanCloud/go-libs/str"
109
kernel2 "github.com/ArtisanCloud/power-wechat/src/kernel"
1110
"github.com/ArtisanCloud/power-wechat/src/payment/kernel"
1211
"net/http"
@@ -96,7 +95,7 @@ func (comp *Client) ConfigSignature(url string, nonce string, timestamp time.Tim
9695
url = comp.GetUrl()
9796
}
9897
if nonce != "" {
99-
nonce = str.QuickRandom(10)
98+
nonce = object.QuickRandom(10)
10099
}
101100
if timestamp.IsZero() {
102101
timestamp = time.Now()

src/kernel/support/helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package support
33
import (
44
"context"
55
"fmt"
6-
"github.com/ArtisanCloud/go-libs/str"
6+
"github.com/ArtisanCloud/go-libs/object"
77
"time"
88
)
99

@@ -18,7 +18,7 @@ type GenerateSigner struct {
1818
func GenerateSign(signer *SHA256WithRSASigner, gs GenerateSigner) (authorization string, err error) {
1919

2020
timestamp := time.Now().Unix()
21-
nonce := str.QuickRandom(32)
21+
nonce := object.QuickRandom(32)
2222

2323
// Under ci mode, go fixed value
2424
// 在ci模式下面,走固定值

src/kernel/support/signer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"encoding/base64"
1010
"encoding/pem"
1111
"fmt"
12-
"github.com/ArtisanCloud/go-libs/str"
12+
"github.com/ArtisanCloud/go-libs/object"
1313
"io/ioutil"
1414
"strings"
1515
"time"
@@ -48,7 +48,7 @@ type RequestSignChain struct {
4848

4949
func (s *SHA256WithRSASigner) GenerateRequestSign(signChain *RequestSignChain) (authorization string, err error) {
5050
timestamp := time.Now().Unix()
51-
nonce := str.QuickRandom(32)
51+
nonce := object.QuickRandom(32)
5252

5353
// Under ci mode, go fixed value
5454
// 在ci模式下面,走固定值

src/payment/application.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"errors"
55
"fmt"
66
"github.com/ArtisanCloud/go-libs/object"
7-
"github.com/ArtisanCloud/go-libs/str"
87
"github.com/ArtisanCloud/power-wechat/src/kernel"
98
"github.com/ArtisanCloud/power-wechat/src/kernel/providers"
109
"github.com/ArtisanCloud/power-wechat/src/payment/base"
@@ -116,7 +115,7 @@ func (app *Payment) Scheme(productID string) string {
116115
"appid": appID,
117116
"mch_id": mchID,
118117
"time_stamp": fmt.Sprintf("%d", time.Now().Nanosecond()),
119-
"nonce_str": str.UniqueID(""),
118+
"nonce_str": object.UniqueID(""),
120119
"product_id": productID,
121120
}
122121

src/payment/jssdk/client.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"github.com/ArtisanCloud/go-libs/object"
8-
"github.com/ArtisanCloud/go-libs/str"
98
"github.com/ArtisanCloud/power-wechat/src/basicService/jssdk"
109
"github.com/ArtisanCloud/power-wechat/src/payment/kernel"
1110
"net/url"
@@ -32,7 +31,7 @@ func (comp *Client) BridgeConfig(prepayId string, isJson bool) (interface{}, err
3231
options := &object.StringMap{
3332
"appId": appID,
3433
"timeStamp": fmt.Sprintf("%d", time.Now().Unix()),
35-
"nonceStr": str.QuickRandom(32),
34+
"nonceStr": object.QuickRandom(32),
3635
"package": fmt.Sprintf("prepay_id=%s", prepayId),
3736
"signType": "RSA",
3837
}
@@ -77,7 +76,7 @@ func (comp *Client) AppConfig(prepayId string) (*object.StringMap, error) {
7776
"appid": appID,
7877
"partnerid": mchID,
7978
"prepayid": prepayId,
80-
"noncestr": str.UniqueID(""),
79+
"noncestr": object.UniqueID(""),
8180
"timestamp": fmt.Sprintf("%d", time.Now().Unix()),
8281
"package": "Sign=WXPay",
8382
}
@@ -96,7 +95,7 @@ func (comp *Client) ShareAddressConfig(accessToken string, isJson bool) (interfa
9695
"appId": appID,
9796
"scope": "jsapi_address",
9897
"timeStamp": fmt.Sprintf("%d", time.Now().Unix()),
99-
"nonceStr": str.UniqueID(""),
98+
"nonceStr": object.UniqueID(""),
10099
"signType": "SHA1",
101100
}
102101

src/payment/kernel/baseClient.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"github.com/ArtisanCloud/go-libs/http/request"
55
"github.com/ArtisanCloud/go-libs/http/response"
66
"github.com/ArtisanCloud/go-libs/object"
7-
str2 "github.com/ArtisanCloud/go-libs/str"
87
"github.com/ArtisanCloud/power-wechat/src/kernel/support"
98

109
http2 "net/http"
@@ -69,7 +68,7 @@ func (client *BaseClient) Request(endpoint string, params *object.StringMap, met
6968

7069
// check need sign body or not
7170
signBody := ""
72-
if "get" != str2.Lower(method){
71+
if "get" != object.Lower(method){
7372
signBody, err = object.JsonEncode(options)
7473
if err != nil {
7574
return nil, err

src/payment/notify/scanned.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package notify
22

33
import (
44
"github.com/ArtisanCloud/go-libs/object"
5-
"github.com/ArtisanCloud/go-libs/str"
65
"github.com/ArtisanCloud/power-wechat/src/payment/kernel"
76
"net/http"
87
"reflect"
@@ -48,7 +47,7 @@ func (comp *Scanned) Handle(closure func(message *object.HashMap, content *objec
4847
config := (*comp.App).GetConfig()
4948
(*attributes)["appid"] = config.GetString("app_id", "")
5049
(*attributes)["mch_id"] = config.GetString("mch_id", "")
51-
(*attributes)["nonce_str"] = str.UniqueID("")
50+
(*attributes)["nonce_str"] = object.UniqueID("")
5251
(*attributes)["prepay_id"] = result.(string)
5352
}
5453

0 commit comments

Comments
 (0)