From ba330445b7bad44ca02ab896881fb52f518e403a Mon Sep 17 00:00:00 2001 From: Jerry <85411418@qq.com> Date: Thu, 9 Mar 2023 23:38:28 +0800 Subject: [PATCH] v1.1.4 --- doc/mini.md | 20 ++++++++++---------- doc/public.md | 36 ++++++++++++++++++------------------ release_note.txt | 3 ++- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/doc/mini.md b/doc/mini.md index 1ef61ab..1b2e1c8 100644 --- a/doc/mini.md +++ b/doc/mini.md @@ -19,9 +19,9 @@ import ( ) // 初始化微信小程序 SDK -// Appid:Appid -// Secret:appSecret -// autoManageToken:是否自动获取并自动维护刷新 AccessToken +// Appid:Appid +// Secret:appSecret +// autoManageToken:是否自动获取并自动维护刷新 AccessToken miniSDK, err := mini.New(Appid, Secret, true) if err != nil { xlog.Error(err) @@ -47,13 +47,13 @@ import ( at := miniSDK.GetMiniAccessToken() // 每次刷新 accessToken 后,此方法回调返回 accessToken 和 有效时间(秒) -miniSDK.SetMiniAccessTokenCallback(func(accessToken string, expireIn int, err error) { - if err != nil { - xlog.Errorf("refresh access token error(%+v)", err) - return - } - xlog.Infof("accessToken: %s", accessToken) - xlog.Infof("expireIn: %d", expireIn) +miniSDK.SetMiniAccessTokenCallback(func(appid, accessToken string, expireIn int, err error) { + if err != nil { + xlog.Errorf("refresh access token error(%+v)", err) + return + } + xlog.Infof("appid:%s, accessToken: %s",appid, accessToken) + xlog.Infof("expireIn: %d", expireIn) }) ``` diff --git a/doc/public.md b/doc/public.md index 0bf5c6b..a85502b 100644 --- a/doc/public.md +++ b/doc/public.md @@ -17,9 +17,9 @@ import ( ) // 初始化微信公众号 SDK -// Appid:Appid -// Secret:appSecret -// autoManageToken:是否自动获取并自动维护刷新 AccessToken +// Appid:Appid +// Secret:appSecret +// autoManageToken:是否自动获取并自动维护刷新 AccessToken publicSDK, err := public.New(Appid, Secret, true) if err != nil { xlog.Error(err) @@ -45,13 +45,13 @@ import ( at := publicSDK.GetPublicAccessToken() // 每次刷新 accessToken 后,此方法回调返回 accessToken 和 有效时间(秒) -publicSDK.SetPublicAccessTokenCallback(func(accessToken string, expireIn int, err error) { - if err != nil { - xlog.Errorf("refresh access token error(%+v)", err) - return - } - xlog.Infof("accessToken: %s", accessToken) - xlog.Infof("expireIn: %d", expireIn) +publicSDK.SetPublicAccessTokenCallback(func(appid, accessToken string, expireIn int, err error) { + if err != nil { + xlog.Errorf("refresh access token error(%+v)", err) + return + } + xlog.Infof("appid:%s, accessToken: %s",appid, accessToken) + xlog.Infof("expireIn: %d", expireIn) }) ``` @@ -62,17 +62,17 @@ publicSDK.SetPublicAccessTokenCallback(func(accessToken string, expireIn int, er body := make(bm.BodyMap) // 临时二维码 body.Set("expire_seconds", 604800). - Set("action_name", "QR_SCENE"). - SetBodyMap("action_info", func(b bm.BodyMap) { - b.SetBodyMap("scene", func(b bm.BodyMap) { - b.Set("scene_id", 123) - }) - }) + Set("action_name", "QR_SCENE"). + SetBodyMap("action_info", func(b bm.BodyMap) { + b.SetBodyMap("scene", func(b bm.BodyMap) { + b.Set("scene_id", 123) + }) + }) rsp, err := publicSDK.QRCodeCreate(ctx, body) if err != nil { - xlog.Error(err) - return + xlog.Error(err) + return } xlog.Infof("rsp:%+v", rsp) ``` diff --git a/release_note.txt b/release_note.txt index c22e3cc..7b9a16d 100644 --- a/release_note.txt +++ b/release_note.txt @@ -1,6 +1,7 @@ -版本号:Release 1.1.3 +版本号:Release 1.1.4 修改记录: (1) 修复开放平台问题,重新设计开放平台相关接口以及token维护机制 + (2) 小程序、公众号平台,AccessToken回调增加 appid 返回 版本号:Release 1.1.1 修改记录: