Skip to content

Commit 6c18ad6

Browse files
WalleVWalleMatrix-XAlvinQinwen
authored
Develop (#66)
* feat(miniprogram): add customer service, risk control, service markert struct (#60) * refactor(mini-program): update all request params struct (#62) * fix(payment): add tls http client * refactor(payment): 修改requestSendRedPack 结构体增加json tag * fix(payment): add tls http client * fix(payment): update v2 md5 sign * feat(payment): update Wxappid to WxappID * refactor(go.mod): remove local replace Co-authored-by: Walle <walle@artisan-cloud.com> Co-authored-by: Matrix-X <matrix-x@artisan-cloud.com> Co-authored-by: Alvin <34093484@qq.com>
1 parent e9eef5a commit 6c18ad6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+606
-295
lines changed

Makefile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
test: test-aes test-rsa test-signer
2-
3-
test-aes:
4-
# go test -v src/kernel/Encryptor.go src/kernel/Encryptor_test.go
5-
go test -v src/kernel/support/aes.go src/kernel/support/aes_test.go
6-
7-
test-rsa:
8-
go test -v src/kernel/support/rsa_oaep.go src/kernel/support/rsa_oaep_test.go
9-
10-
test-signer:
11-
go test -v src/kernel/support/signer.go src/kernel/support/signer_test.go
1+
test: test-kernel-support
122

133
test-message:
144
go test -v test/featureUnit/main_test.go test/featureUnit/work_message_test.go
@@ -34,7 +24,10 @@ test-payment:
3424
go test -v test/featureUnit/main_test.go test/featureUnit/payment_redpack_test.go
3525

3626
test-kernel-support:
37-
go test -v src/kernel/support/str.go src/kernel/support/str_test.go
27+
go test -v src/kernel/support/aes.go src/kernel/support/aes_test.go
28+
go test -v src/kernel/support/helper.go src/kernel/support/helper_test.go
29+
go test -v src/kernel/support/rsa_oaep.go src/kernel/support/rsa_oaep_test.go
30+
go test -v src/kernel/support/signer.go src/kernel/support/signer_test.go
3831

3932
build:
4033
go build

go.mod

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ module github.com/ArtisanCloud/PowerWeChat
22

33
go 1.16
44

5-
//replace github.com/ArtisanCloud/PowerLibs => ../PowerLibs
6-
//replace github.com/ArtisanCloud/PowerSocialite => ../PowerSocialite
7-
85
require (
9-
github.com/ArtisanCloud/PowerLibs v1.1.6
10-
github.com/ArtisanCloud/PowerSocialite v1.0.10
6+
github.com/ArtisanCloud/PowerLibs v1.2.0
7+
github.com/ArtisanCloud/PowerSocialite v1.2.0
118
github.com/gin-gonic/gin v1.7.2
129
github.com/go-playground/assert/v2 v2.0.1
1310
github.com/go-playground/validator/v10 v10.6.1 // indirect

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
github.com/ArtisanCloud/PowerLibs v1.1.6 h1:LVudscMtD8wO6+GFt5sH5OHheiuHA7ElbJFd/n2yspA=
21
github.com/ArtisanCloud/PowerLibs v1.1.6/go.mod h1:WFX9eqXpXjLk67xRKFCIY/fALwtoASj9y/FWbHbG+d4=
3-
github.com/ArtisanCloud/PowerSocialite v1.0.10 h1:wM9OWqt2zDAjDuXPMjDLkfhMBYeD04xV16ziAThjlpc=
4-
github.com/ArtisanCloud/PowerSocialite v1.0.10/go.mod h1:WQ2tsvi+vY7xe11CRFFCNexUEpw7cYQkRgDIXGfVOIs=
2+
github.com/ArtisanCloud/PowerLibs v1.2.0 h1:UlPsaX76wh0IgtHy8Z6aWND+671KbI7N07V5d2xhgHg=
3+
github.com/ArtisanCloud/PowerLibs v1.2.0/go.mod h1:WFX9eqXpXjLk67xRKFCIY/fALwtoASj9y/FWbHbG+d4=
4+
github.com/ArtisanCloud/PowerSocialite v1.2.0 h1:Gnit7aBbyFxdJI0C7AJzvhFyGCMvNdsfYGYznoXeZ0o=
5+
github.com/ArtisanCloud/PowerSocialite v1.2.0/go.mod h1:WQ2tsvi+vY7xe11CRFFCNexUEpw7cYQkRgDIXGfVOIs=
56
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
67
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
78
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

src/kernel/support/helper.go

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,43 @@
11
package support
2-
32
import (
4-
"context"
3+
"crypto/hmac"
4+
"crypto/md5"
5+
"crypto/sha256"
6+
"encoding/hex"
57
"fmt"
6-
"github.com/ArtisanCloud/PowerLibs/object"
7-
"time"
8+
"github.com/ArtisanCloud/PowerWeChat/src/kernel/power"
9+
"sort"
10+
"strings"
811
)
912

10-
type GenerateSigner struct {
11-
Method string // 接口提交方法。"GET", "POST"等
12-
CanonicalURL string // 微信支付接口路径。 例如: /v3/pay/transactions/jsapi
13-
SignBody string // 提交的body字符串。 例如; {"amount":{"total":1},"appid":"ww16143ea0101327c7","attach":"自定义数据说明","description":"Image形象店-深圳腾大-QQ公仔","mchid":"1611854986","notify_url":"https://pay.wangchaoyi.com/wx/notify","out_trade_no":"5519778939773395659222199361","payer":{"openid":"oAuaP0TRUMwP169nQfg7XCEAw3HQ"}}
14-
timestamp int64 // 单元测试传入的固定时间戳
15-
nonce string // 单元测试传入的固定随机数
16-
}
17-
18-
func GenerateSign(signer *SHA256WithRSASigner, gs GenerateSigner) (authorization string, err error) {
19-
20-
timestamp := time.Now().Unix()
21-
nonce := object.QuickRandom(32)
22-
23-
// Under ci mode, go fixed value
24-
// 在ci模式下面,走固定值
25-
if gs.timestamp != 0 && gs.nonce != "" {
26-
timestamp = gs.timestamp
27-
nonce = gs.nonce
13+
func PaymentV2ParamsJoin(params *power.StringMap, key string) string {
14+
var arr []string
15+
for k, v := range *params {
16+
if v == "" {
17+
continue
18+
}
19+
arr = append(arr, k)
2820
}
29-
30-
// Splice the string to be signed
31-
// 拼接出需要签名的字符串
32-
message := fmt.Sprintf(SignatureMessageFormat, gs.Method, gs.CanonicalURL, fmt.Sprintf("%d", timestamp), nonce, gs.SignBody)
33-
34-
signatureResult, err := signer.Sign(context.TODO(), message)
35-
if err != nil {
36-
return "", err
21+
sort.Strings(arr)
22+
for i, k := range arr {
23+
arr[i] = fmt.Sprintf("%s=%s", k, (*params)[k])
3724
}
25+
return fmt.Sprintf("%s&key=%s", strings.Join(arr, "&"), key)
26+
}
3827

39-
authorization = fmt.Sprintf(
40-
HeaderAuthorizationFormat,
41-
signer.GetAuthorizationType(),
42-
signatureResult.MchID,
43-
nonce,
44-
timestamp,
45-
signatureResult.CertificateSerialNo,
46-
signatureResult.Signature,
47-
)
48-
49-
return authorization, err
28+
// GenerateSignMD5 适用于微信支付V2 MD5签名算法
29+
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=4_3
30+
func GenerateSignMD5(params *power.StringMap, key string) string {
31+
sign := fmt.Sprintf("%x", md5.Sum([]byte(PaymentV2ParamsJoin(params, key))))
32+
return strings.ToUpper(sign)
5033
}
5134

52-
func GetEncryptMethod(signType string, secretKey string) string {
53-
return ""
35+
// GenerateSignHmacSHA256 适用于微信支付V2 HMAC-SHA256签名算法
36+
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=4_3
37+
func GenerateSignHmacSHA256(params *power.StringMap, key string) string {
38+
h := hmac.New(sha256.New, []byte(key))
39+
h.Write([]byte(PaymentV2ParamsJoin(params, key)))
40+
41+
sign := hex.EncodeToString(h.Sum(nil))
42+
return strings.ToUpper(sign)
5443
}

src/kernel/support/helper_test.go

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,77 @@
11
package support
22

33
import (
4+
"github.com/ArtisanCloud/PowerWeChat/src/kernel/power"
45
"github.com/go-playground/assert/v2"
5-
"log"
66
"testing"
77
)
88

99
// Authorization: WECHATPAY2-SHA256-RSA2048 mchid="1611854986",nonce_str="sacfXg6R9YwKqo3sfPoOVJQd4jPb0KOe",timestamp="1626623583",serial_no="2655A2CD634B06C2A86B28780228A997D047B01C",signature="dvB2r+z5v8JOsKw0goAmXNNTdLtpwmCkZHzuVdAi63kBZIvFugQuYx1nCUiZQckIV7ebq0JkK5/3N2gkmX70RJSnEa/Rjq7n2K//0OahXPGI+2qgFr5qUZ586en66QZjuQVeqoW6aYsaAwHPnszva56uJmopvHnuPPdUzKTTWf8sDNdIph/y+BpDXGTIvgifYR3RnJc2qh5n9eOo1Tqr4Ei6y6HhdPhMWMrr9RXY4bOCjtDkZhQ+mUXEP6aHLPau+5Th2cGlb5dyUY3o/MzgfjvvXjv4JDXhHFuo9BZAwp4XQcs/6jh/XAakf9lHx7ESvoQyT406Sfn30An3Y+p4wg=="
10-
func TestGetEncryptMethod(t *testing.T) {
11-
signer := &SHA256WithRSASigner{
12-
MchID: "161186666",
13-
CertificateSerialNo: "2355A2CD634B06C2A86B28780228A997D017B011",
14-
PrivateKey: getPrivateKey(),
15-
}
10+
//func TestGetEncryptMethod(t *testing.T) {
11+
// signer := &SHA256WithRSASigner{
12+
// MchID: "161186666",
13+
// CertificateSerialNo: "2355A2CD634B06C2A86B28780228A997D017B011",
14+
// PrivateKey: getPrivateKey(),
15+
// }
16+
//
17+
// signBody := "{\"amount\":{\"total\":1},\"appid\":\"ww16143ea0101327c7\",\"attach\":\"自定义数据说明\",\"description\":\"Image形象店-深圳腾大-QQ公仔\",\"mchid\":\"1611854986\",\"notify_url\":\"https://pay.wangchaoyi.com/power/notify\",\"out_trade_no\":\"5519778939773395659222199361\",\"payer\":{\"openid\":\"oAuaP0TRUMwP169nQfg7XCEAw3HQ\"}}"
18+
//
19+
// authorization, err := GenerateSign(signer, GenerateSigner{
20+
// Method: "POST",
21+
// CanonicalURL: "/v3/pay/transactions/jsapi",
22+
// SignBody: signBody,
23+
// timestamp: 1626747079,
24+
// nonce: "W2XLk2c8KYM1aRNBzwmeGBnVqZ3QbvHS",
25+
// })
26+
//
27+
// if err != nil {
28+
// log.Fatalln(err)
29+
// }
30+
//
31+
// expectAuthorization := "WECHATPAY2-SHA256-RSA2048 mchid=\"161186666\",nonce_str=\"W2XLk2c8KYM1aRNBzwmeGBnVqZ3QbvHS\",timestamp=\"1626747079\",serial_no=\"2355A2CD634B06C2A86B28780228A997D017B011\",signature=\"eUF/u5p9UjRtflGwOIk5jXUzD2Aduaj/NLhlwWwkliFPpF2I9jtTtM7gARrMHYuX2tQNS6OfY5Jf350D6OsJ4YKaKK4C8HOQ62maQ90DASJUrcqRI/EA4uyCrkqbUWnl+Xm2dE5wuVpfTSbRaMzOdXQwFB376uZgfUQtnD8C5PUfyqJ07qjxvh6NGi+R1vNCyG2rHhWityYtd66CZX4lBTOG5bJocn4GpOZOnyJO5/paQVQ8rKmQn+Wm7XCSCFL+4QLIa7ATyra/JMy0SLswq8ORfjCV0wFsHNR3h0u0vJo9JFRcqhhr/L6uQRc5x0vAC/wciOiDejAWYWBY90LEnA==\""
32+
//
33+
// assert.Equal(t, authorization, expectAuthorization)
34+
//}
1635

17-
signBody := "{\"amount\":{\"total\":1},\"appid\":\"ww16143ea0101327c7\",\"attach\":\"自定义数据说明\",\"description\":\"Image形象店-深圳腾大-QQ公仔\",\"mchid\":\"1611854986\",\"notify_url\":\"https://pay.wangchaoyi.com/power/notify\",\"out_trade_no\":\"5519778939773395659222199361\",\"payer\":{\"openid\":\"oAuaP0TRUMwP169nQfg7XCEAw3HQ\"}}"
36+
func TestPaymentV2ParamsJoin(t *testing.T) {
37+
params := &power.StringMap{
38+
"appid": "f323",
39+
"c": "12",
40+
"d": "34",
41+
"mch_id": "2323532",
42+
}
43+
key := "HelloPowerWeChat"
44+
expectText := "appid=f323&c=12&d=34&mch_id=2323532&key=HelloPowerWeChat"
45+
text := PaymentV2ParamsJoin(params, key)
1846

19-
authorization, err := GenerateSign(signer, GenerateSigner{
20-
Method: "POST",
21-
CanonicalURL: "/v3/pay/transactions/jsapi",
22-
SignBody: signBody,
23-
timestamp: 1626747079,
24-
nonce: "W2XLk2c8KYM1aRNBzwmeGBnVqZ3QbvHS",
25-
})
47+
assert.Equal(t, expectText, text)
48+
}
2649

27-
if err != nil {
28-
log.Fatalln(err)
50+
func TestGenerateSignMD5(t *testing.T) {
51+
params := &power.StringMap{
52+
"appid": "f323",
53+
"c": "12",
54+
"d": "34",
55+
"mch_id": "2323532",
2956
}
57+
key := "HelloPowerWeChat"
58+
expectSignMD5 := "D18B5A9F4D01EB18CDEFFA39C78EB0F5"
59+
signMD5 := GenerateSignMD5(params, key)
3060

31-
expectAuthorization := "WECHATPAY2-SHA256-RSA2048 mchid=\"161186666\",nonce_str=\"W2XLk2c8KYM1aRNBzwmeGBnVqZ3QbvHS\",timestamp=\"1626747079\",serial_no=\"2355A2CD634B06C2A86B28780228A997D017B011\",signature=\"eUF/u5p9UjRtflGwOIk5jXUzD2Aduaj/NLhlwWwkliFPpF2I9jtTtM7gARrMHYuX2tQNS6OfY5Jf350D6OsJ4YKaKK4C8HOQ62maQ90DASJUrcqRI/EA4uyCrkqbUWnl+Xm2dE5wuVpfTSbRaMzOdXQwFB376uZgfUQtnD8C5PUfyqJ07qjxvh6NGi+R1vNCyG2rHhWityYtd66CZX4lBTOG5bJocn4GpOZOnyJO5/paQVQ8rKmQn+Wm7XCSCFL+4QLIa7ATyra/JMy0SLswq8ORfjCV0wFsHNR3h0u0vJo9JFRcqhhr/L6uQRc5x0vAC/wciOiDejAWYWBY90LEnA==\""
61+
assert.Equal(t, expectSignMD5, signMD5)
62+
}
3263

33-
assert.Equal(t, authorization, expectAuthorization)
64+
func TestGenerateSignHmacSHA256(t *testing.T) {
65+
params := &power.StringMap{
66+
"appid": "f323",
67+
"c": "12",
68+
"d": "34",
69+
"mch_id": "2323532",
70+
}
71+
key := "HelloPowerWeChat"
72+
expectSignHmacSHA256 := "CF3C3C7B038A12682967DC5ABADDAD56CE612FEE9B0E0A885B3B41E9E72B9A10"
73+
signHmacSHA256 := GenerateSignHmacSHA256(params, key)
74+
75+
assert.Equal(t, expectSignHmacSHA256, signHmacSHA256)
3476
}
77+

src/miniProgram/base/client.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package base
33
import (
44
"github.com/ArtisanCloud/PowerLibs/object"
55
"github.com/ArtisanCloud/PowerWeChat/src/kernel"
6+
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/base/request"
67
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/base/response"
78
)
89

@@ -11,17 +12,11 @@ type Client struct {
1112
}
1213

1314
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html
14-
func (comp *Client) GetPaidUnionID(openID string, option *object.StringMap) (*response.ResponseAuthGetPaidUnionID, error) {
15+
func (comp *Client) GetPaidUnionID(options *request.RequestGetPaidUnionID) (*response.ResponseAuthGetPaidUnionID, error) {
1516

1617
result := &response.ResponseAuthGetPaidUnionID{}
1718

18-
params := &object.StringMap{
19-
"openid": openID,
20-
}
21-
22-
params = object.MergeStringMap(params, option)
23-
24-
_, err := comp.HttpGet("wxa/getpaidunionid", params, nil, result)
19+
_, err := comp.HttpGet("wxa/getpaidunionid", options, nil, result)
2520

2621
return result, err
2722
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package request
2+
3+
type RequestGetPaidUnionID struct {
4+
OpenID string `json:"openid"` // 支付用户唯一标识
5+
TransactionID string `json:"transaction_id,omitempty"` // 微信支付订单号
6+
MchID string `json:"mch_id,omitempty"` // 微信支付分配的商户号,和商户订单号配合使用
7+
OutTradeNo string `json:"out_trade_no,omitempty"`
8+
}

src/miniProgram/customerServiceMessage/client.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/ArtisanCloud/PowerWeChat/src/kernel"
77
"github.com/ArtisanCloud/PowerWeChat/src/kernel/power"
88
response2 "github.com/ArtisanCloud/PowerWeChat/src/kernel/response"
9+
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/customerServiceMessage/request"
910
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/customerServiceMessage/response"
1011
response4 "github.com/ArtisanCloud/PowerWeChat/src/work/media/response"
1112
"net/http"
@@ -37,20 +38,33 @@ func (comp *Client) GetTempMedia(mediaID string) (*http.Response, error) {
3738

3839
// 发送客服消息给用户
3940
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.send.html
40-
func (comp *Client) Send(toUser string, msgType string, text *power.HashMap) (*response2.ResponseMiniProgram, error) {
41+
func (comp *Client) Send(toUser string, msgType string, msg interface{}) (*response2.ResponseMiniProgram, error) {
4142

4243
result := &response2.ResponseMiniProgram{}
4344

4445
data := &object.HashMap{
4546
"touser": toUser,
4647
"msgtype": msgType,
47-
"text": text,
48+
msgType: msg,
4849
}
4950

5051
_, err := comp.HttpPostJson("cgi-bin/message/custom/send", data, nil, nil, result)
5152

5253
return result, err
5354
}
55+
func (comp *Client) SendText(toUser string, msg *request.CustomerServiceMsgText) (*response2.ResponseMiniProgram, error) {
56+
return comp.Send(toUser, "text", msg)
57+
}
58+
func (comp *Client) SendImage(toUser string, msg *request.CustomerServiceMsgImage) (*response2.ResponseMiniProgram, error) {
59+
return comp.Send(toUser, "image", msg)
60+
}
61+
func (comp *Client) SendLink(toUser string, msg *request.CustomerServiceMsgLink) (*response2.ResponseMiniProgram, error) {
62+
return comp.Send(toUser, "link", msg)
63+
}
64+
func (comp *Client) SendMiniProgramPage(toUser string, msg *request.CustomerServiceMsgMpPage) (*response2.ResponseMiniProgram, error) {
65+
return comp.Send(toUser, "miniprogrampage", msg)
66+
}
67+
5468

5569
// 下发客服当前输入状态给用户
5670
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.setTyping.html
@@ -84,7 +98,7 @@ func (comp *Client) UploadTempMedia(mediaType string, path string, form *power.H
8498
var formData *object.HashMap
8599
if form != nil {
86100
formData = &object.HashMap{
87-
"name": (*form)["name"],
101+
"name": (*form)["name"],
88102
"value": (*form)["value"],
89103
}
90104
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package request
2+
3+
type CustomerServiceMsgText struct {
4+
Content string `json:"content"`
5+
}
6+
7+
type CustomerServiceMsgImage struct {
8+
MediaID string `json:"media_id"`
9+
}
10+
11+
type CustomerServiceMsgLink struct {
12+
Title string `json:"title"`
13+
Description string `json:"description"`
14+
Url string `json:"url"`
15+
ThumbUrl string `json:"thumb_url"`
16+
}
17+
18+
type CustomerServiceMsgMpPage struct {
19+
Title string `json:"title"`
20+
PagePath string `json:"pagepath"`
21+
ThumbMediaID string `json:"thumb_media_id"`
22+
}

src/miniProgram/dataCube/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dataCube
33
import (
44
"github.com/ArtisanCloud/PowerLibs/object"
55
"github.com/ArtisanCloud/PowerWeChat/src/kernel"
6-
"github.com/ArtisanCloud/PowerWeChat/src/kernel/power"
6+
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/dataCube/request"
77
"github.com/ArtisanCloud/PowerWeChat/src/miniProgram/dataCube/response"
88
)
99

@@ -24,7 +24,7 @@ func (comp *Client) GetDailySummary(from string, to string) (*response.ResponseD
2424

2525
// 获取小程序启动性能,运行性能等数据
2626
// https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/data-analysis/analysis.getPerformanceData.html
27-
func (comp *Client) GetPerformanceData(options *power.HashMap) (*response.ResponseDataCubeGetPerformanceData, error) {
27+
func (comp *Client) GetPerformanceData(options *request.RequestGetPerformanceData) (*response.ResponseDataCubeGetPerformanceData, error) {
2828

2929
result := &response.ResponseDataCubeGetPerformanceData{}
3030

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package request
2+
3+
type RequestGetPerformanceData struct {
4+
Time *GetPerformanceDataTime `json:"time"`
5+
Module string `json:"module"`
6+
Params []*GetPerformanceDataParams `json:"params"`
7+
}
8+
9+
type GetPerformanceDataTime struct {
10+
// int64类型: time.Now().Unix()
11+
BeginTimestamp int64 `json:"begin_timestamp"`
12+
EndTimestamp int64 `json:"end_timestamp"`
13+
}
14+
15+
type GetPerformanceDataParams struct {
16+
Field string `json:"field"`
17+
Value string `json:"value"`
18+
}

0 commit comments

Comments
 (0)