Skip to content

Commit

Permalink
feat: modify redis version to v8.11.5 (#582)
Browse files Browse the repository at this point in the history
* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session)

* [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html)

* upgrade json error

* upgrade json error

* [feature] Wallet Transfer returns the pointer object

* feat:Adaptation of new go-redis components

* improve code

* feat:upgrade golangci-lint-action version

* fix

* test ci

* fix

* test ci

* fix

* test

* improve code

* feat:GetPhoneNumber return ptr

* fix: ptr Elem() error

* improve code

* improve code

* improve code

* improve code

* upgrade go version v1.15

* improve .golangci.yml

* feat:modify redis version v8.11.5

Co-authored-by: houseme <houseme@outlook.com>
  • Loading branch information
houseme and housemecn authored Jul 20, 2022
1 parent ded5a10 commit adf142d
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 140 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
golangci:
strategy:
matrix:
go-version: [1.15.x,1.16.x]
go-version: [1.15.x,1.16.x,1.17.x]
name: golangci-lint
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
# strategy set
strategy:
matrix:
go: ["1.14","1.15", "1.16", "1.17", "1.18"]
go: ["1.15", "1.16", "1.17", "1.18"]

steps:
- uses: actions/checkout@v2
Expand Down
21 changes: 13 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ linters:
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
include:
- EXC0002 # disable excluding of issues about comments from golint
exclude-rules:
- linters:
- stylecheck
text: "ST1000:"
# Excluding configuration per-path, per-linter, per-text and per-source
- path: _test\.go
linters:
- gomnd
Expand All @@ -52,10 +57,10 @@ linters-settings:
lines: 66
statements: 40

issues:
include:
- EXC0002 # disable excluding of issues about comments from golint
exclude-rules:
- linters:
- stylecheck
text: "ST1000:"
#issues:
# include:
# - EXC0002 # disable excluding of issues about comments from golint
# exclude-rules:
# - linters:
# - stylecheck
# text: "ST1000:"
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,35 @@ import "github.com/silenceper/wechat/v2"
以下是一个微信公众号处理消息接收以及回复的例子:

```go
//使用memcache保存access_token,也可选择redis或自定义cache
// 使用memcache保存access_token,也可选择redis或自定义cache
wc := wechat.NewWechat()
memory := cache.NewMemory()
cfg := &offConfig.Config{
AppID: "xxx",
AppSecret: "xxx",
Token: "xxx",
//EncodingAESKey: "xxxx",
// EncodingAESKey: "xxxx",
Cache: memory,
}
officialAccount := wc.GetOfficialAccount(cfg)

// 传入request和responseWriter
server := officialAccount.GetServer(req, rw)
//设置接收消息的处理方法
// 设置接收消息的处理方法
server.SetMessageHandler(func(msg *message.MixMessage) *message.Reply {

//回复消息:演示回复用户发送的消息
// 回复消息:演示回复用户发送的消息
text := message.NewText(msg.Content)
return &message.Reply{MsgType: message.MsgTypeText, MsgData: text}
})

//处理消息接收以及回复
// 处理消息接收以及回复
err := server.Serve()
if err != nil {
fmt.Println(err)
return
}
//发送回复的消息
// 发送回复的消息
server.Send()

```
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/silenceper/wechat/v2

go 1.14
go 1.15

require (
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d
github.com/fatih/structs v1.1.0
github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc
github.com/sirupsen/logrus v1.8.1
github.com/go-redis/redis/v8 v8.11.5
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cast v1.4.1
github.com/stretchr/testify v1.7.1
github.com/tidwall/gjson v1.14.1
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d
gopkg.in/h2non/gock.v1 v1.1.2
)
32 changes: 15 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc h1:jZY+lpZB92nvBo2f31oPC/ivGll6NcsnEOORm8Fkr4M=
github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc/go.mod h1:25mL1NKxbJhB63ihiK8MnNeTRd+xAizd6bOdydrTLUQ=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
Expand Down Expand Up @@ -48,22 +48,23 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc=
github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ=
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
Expand All @@ -76,18 +77,17 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -96,7 +96,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -105,15 +104,14 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
Expand Down
2 changes: 1 addition & 1 deletion miniprogram/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (
// Config .config for 小程序
type Config struct {
AppID string `json:"app_id"` // appid
AppSecret string `json:"app_secret"` // appsecret
AppSecret string `json:"app_secret"` // appSecret
Cache cache.Cache
}
1 change: 0 additions & 1 deletion pay/notify/refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type RefundedResp struct {

// DecryptReqInfo 对退款结果进行解密
func (notify *Notify) DecryptReqInfo(result *RefundedResult) (*RefundedReqInfo, error) {
var err error
if result == nil || result.ReqInfo == nil {
return nil, errors.New("empty refunded_result or req_info")
}
Expand Down
4 changes: 2 additions & 2 deletions pay/order/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (o *Order) BridgeConfig(p *Params) (cfg Config, err error) {
// BridgeAppConfig get app bridge config
func (o *Order) BridgeAppConfig(p *Params) (cfg ConfigForApp, err error) {
var (
timestamp = strconv.FormatInt(time.Now().Unix(), 10)
timestamp = strconv.FormatInt(util.GetCurrTS(), 10)
noncestr = util.RandomStr(32)
_package = "Sign=WXPay"
)
Expand Down Expand Up @@ -273,7 +273,7 @@ func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error) {
return
}

// PrePayID will request wechat merchant api and request for a pre payment order id
// PrePayID will request wechat merchant api and request for a pre-payment order id
func (o *Order) PrePayID(p *Params) (prePayID string, err error) {
order, err := o.PrePayOrder(p)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pay/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func (pay *Pay) GetOrder() *order.Order {
return order.NewOrder(pay.cfg)
}

// GetNotify 通知
// GetNotify 通知
func (pay *Pay) GetNotify() *notify.Notify {
return notify.NewNotify(pay.cfg)
}

// GetRefund 退款
// GetRefund 退款
func (pay *Pay) GetRefund() *refund.Refund {
return refund.NewRefund(pay.cfg)
}
Expand Down
5 changes: 2 additions & 3 deletions pay/transfer/transfer_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/silenceper/wechat/v2/util"
)

// 付款到零钱
// walletTransferGateway 付款到零钱
// https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
var walletTransferGateway = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"

Expand All @@ -20,8 +20,7 @@ type Transfer struct {

// NewTransfer return an instance of Transfer package
func NewTransfer(cfg *config.Config) *Transfer {
transfer := Transfer{cfg}
return &transfer
return &Transfer{cfg}
}

// Params 调用参数
Expand Down
4 changes: 2 additions & 2 deletions util/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, e
}

// PostFile 上传文件
func PostFile(fieldname, filename, uri string) ([]byte, error) {
func PostFile(fieldName, filename, uri string) ([]byte, error) {
fields := []MultipartFormField{
{
IsFile: true,
Fieldname: fieldname,
Fieldname: fieldName,
Filename: filename,
},
}
Expand Down
4 changes: 2 additions & 2 deletions wechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func NewWechat() *Wechat {
}

// SetCache 设置cache
func (wc *Wechat) SetCache(cahce cache.Cache) {
wc.cache = cahce
func (wc *Wechat) SetCache(cache cache.Cache) {
wc.cache = cache
}

// GetOfficialAccount 获取微信公众号实例
Expand Down
6 changes: 1 addition & 5 deletions work/externalcontact/external_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type ExternalUserListResponse struct {
// GetExternalUserList 获取客户列表
// @see https://developer.work.weixin.qq.com/document/path/92113
func (r *Client) GetExternalUserList(userID string) ([]string, error) {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
Expand Down Expand Up @@ -98,7 +97,6 @@ type WechatChannel struct {

// GetExternalUserDetail 获取外部联系人详情
func (r *Client) GetExternalUserDetail(externalUserID string, nextCursor ...string) (*ExternalUser, error) {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
Expand Down Expand Up @@ -130,7 +128,6 @@ type ExternalUserDetailListResponse struct {

// BatchGetExternalUserDetails 批量获取外部联系人详情
func (r *Client) BatchGetExternalUserDetails(request BatchGetExternalUserDetailsRequest) ([]ExternalUser, error) {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
Expand All @@ -157,12 +154,11 @@ type UpdateUserRemarkRequest struct {
Description string `json:"description"`
RemarkCompany string `json:"remark_company"`
RemarkMobiles []string `json:"remark_mobiles"`
RemarkPicMediaid string `json:"remark_pic_mediaid"`
RemarkPicMediaID string `json:"remark_pic_mediaid"`
}

// UpdateUserRemark 修改客户备注信息
func (r *Client) UpdateUserRemark(request UpdateUserRemarkRequest) error {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return err
Expand Down
5 changes: 2 additions & 3 deletions work/externalcontact/follow_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ type followerUserResponse struct {
FollowUser []string `json:"follow_user"`
}

//GetFollowUserList 获取配置了客户联系功能的成员列表
//@see https://developer.work.weixin.qq.com/document/path/92571
// GetFollowUserList 获取配置了客户联系功能的成员列表
// @see https://developer.work.weixin.qq.com/document/path/92571
func (r *Client) GetFollowUserList() ([]string, error) {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
Expand Down
4 changes: 0 additions & 4 deletions work/externalcontact/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ type TagGroupTagItem struct {
// GetCropTagList 获取企业标签库
// @see https://developer.work.weixin.qq.com/document/path/92117
func (r *Client) GetCropTagList(req GetCropTagRequest) ([]TagGroup, error) {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
Expand Down Expand Up @@ -127,7 +126,6 @@ type EditCropTagRequest struct {
// EditCropTag 修改企业客户标签
// @see https://developer.work.weixin.qq.com/document/path/92117
func (r *Client) EditCropTag(req EditCropTagRequest) error {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return err
Expand All @@ -151,7 +149,6 @@ type DeleteCropTagRequest struct {
// DeleteCropTag 删除企业客户标签
// @see https://developer.work.weixin.qq.com/document/path/92117
func (r *Client) DeleteCropTag(req DeleteCropTagRequest) error {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return err
Expand All @@ -177,7 +174,6 @@ type MarkTagRequest struct {
// MarkTag 为客户打上标签
// @see https://developer.work.weixin.qq.com/document/path/92118
func (r *Client) MarkTag(request MarkTagRequest) error {
var accessToken string
accessToken, err := r.GetAccessToken()
if err != nil {
return err
Expand Down
Loading

0 comments on commit adf142d

Please sign in to comment.