From 58a08d78d5ef32f49ee6ef98e9aa13aad6dc7b7c Mon Sep 17 00:00:00 2001 From: deloz Date: Mon, 17 Jun 2024 15:42:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=9C=8D?= =?UTF-8?q?=E5=B8=90=E5=8F=B7=E9=93=BE=E6=8E=A5=20scene=20=E5=8F=AF?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/work/accountService/client.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/work/accountService/client.go b/src/work/accountService/client.go index 881e520f..2cb5af03 100644 --- a/src/work/accountService/client.go +++ b/src/work/accountService/client.go @@ -2,7 +2,9 @@ package accountService import ( "context" + "github.com/ArtisanCloud/PowerLibs/v3/object" + "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel" response2 "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/response" "github.com/ArtisanCloud/PowerWeChat/v3/src/work/accountService/request" @@ -82,9 +84,17 @@ func (comp *Client) AddContactWay(ctx context.Context, openKFID string, scene st result := &response.ResponseAccountServiceAddContactWay{} - options := &object.HashMap{ - "open_kfid": openKFID, - "scene": scene, + var options *object.HashMap + + if scene == "" { + options = &object.HashMap{ + "open_kfid": openKFID, + } + } else { + options = &object.HashMap{ + "open_kfid": openKFID, + "scene": scene, + } } _, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/kf/add_contact_way", options, nil, nil, result) From 38aee148ae4d4d49bc3843f1e0950501ffc62889 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 10 Dec 2024 19:48:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(wework):=20=E8=8E=B7=E5=8F=96=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E5=B8=90=E5=8F=B7=E9=93=BE=E6=8E=A5=20scene=20?= =?UTF-8?q?=E5=8F=AF=E9=80=89;=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D-=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF-=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=BF=94=E5=9B=9E=E5=AE=A2=E6=88=B748?= =?UTF-8?q?=E5=B0=8F=E6=97=B6=E5=86=85=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=BC=9A=E8=AF=9D=E7=9A=84=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/work/accountService/client.go | 15 +++++---------- src/work/accountService/customer/client.go | 5 +++-- .../customer/response/responseCustomerBatchGet.go | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/work/accountService/client.go b/src/work/accountService/client.go index 2cb5af03..c59493bd 100644 --- a/src/work/accountService/client.go +++ b/src/work/accountService/client.go @@ -85,16 +85,11 @@ func (comp *Client) AddContactWay(ctx context.Context, openKFID string, scene st result := &response.ResponseAccountServiceAddContactWay{} var options *object.HashMap - - if scene == "" { - options = &object.HashMap{ - "open_kfid": openKFID, - } - } else { - options = &object.HashMap{ - "open_kfid": openKFID, - "scene": scene, - } + options = &object.HashMap{ + "open_kfid": openKFID, + } + if scene != "" { + (*options)["scene"] = scene } _, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/kf/add_contact_way", options, nil, nil, result) diff --git a/src/work/accountService/customer/client.go b/src/work/accountService/customer/client.go index 83ded8e8..c062ab04 100644 --- a/src/work/accountService/customer/client.go +++ b/src/work/accountService/customer/client.go @@ -26,12 +26,13 @@ func NewClient(app kernel.ApplicationInterface) (*Client, error) { // 读取消息 // https://developer.work.weixin.qq.com/document/path/94670 -func (comp *Client) BatchGet(ctx context.Context, externalUserIDList []string) (*response.ResponseCustomerBatchGet, error) { +func (comp *Client) BatchGet(ctx context.Context, externalUserIDList []string, needEnterSessionContext int8) (*response.ResponseCustomerBatchGet, error) { result := &response.ResponseCustomerBatchGet{} options := &object.HashMap{ - "external_userid_list": externalUserIDList, + "external_userid_list": externalUserIDList, + "need_enter_session_context": needEnterSessionContext, } _, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/kf/customer/batchget", options, nil, nil, result) diff --git a/src/work/accountService/customer/response/responseCustomerBatchGet.go b/src/work/accountService/customer/response/responseCustomerBatchGet.go index a51b31a4..b2b75ac9 100644 --- a/src/work/accountService/customer/response/responseCustomerBatchGet.go +++ b/src/work/accountService/customer/response/responseCustomerBatchGet.go @@ -9,5 +9,5 @@ type ResponseCustomerBatchGet struct { response.ResponseWork CustomerList []*power.HashMap `json:"customer_list"` - InvalidExternalUserID []*string `json:"invalid_external_userid"` + InvalidExternalUserID []string `json:"invalid_external_userid,omitempty"` } From 2c067235fb156dbb6fff036971d187a3b25958b6 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 10 Dec 2024 19:49:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(wework):=20=E8=8E=B7=E5=8F=96=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E5=B8=90=E5=8F=B7=E9=93=BE=E6=8E=A5=20scene=20?= =?UTF-8?q?=E5=8F=AF=E9=80=89;=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D-=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF-=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=BF=94=E5=9B=9E=E5=AE=A2=E6=88=B748?= =?UTF-8?q?=E5=B0=8F=E6=97=B6=E5=86=85=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=BC=9A=E8=AF=9D=E7=9A=84=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/work/accountService/client.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/work/accountService/client.go b/src/work/accountService/client.go index c59493bd..bd3cd5dd 100644 --- a/src/work/accountService/client.go +++ b/src/work/accountService/client.go @@ -2,9 +2,7 @@ package accountService import ( "context" - "github.com/ArtisanCloud/PowerLibs/v3/object" - "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel" response2 "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/response" "github.com/ArtisanCloud/PowerWeChat/v3/src/work/accountService/request" From 47a1f0f6c42ccbc6ceb01a07a611beb086cd4a26 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Wed, 11 Dec 2024 14:54:38 +0800 Subject: [PATCH 4/4] fix(wework): ResponseTemplateSend MsgID type --- .../templateMessage/response/responseTemplateSetIndustry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/officialAccount/templateMessage/response/responseTemplateSetIndustry.go b/src/officialAccount/templateMessage/response/responseTemplateSetIndustry.go index 3398787e..e5e20b54 100644 --- a/src/officialAccount/templateMessage/response/responseTemplateSetIndustry.go +++ b/src/officialAccount/templateMessage/response/responseTemplateSetIndustry.go @@ -38,5 +38,5 @@ type ResponseTemplateGetPrivate struct { type ResponseTemplateSend struct { response.ResponseOfficialAccount - MsgID int `json:"msgid"` + MsgID int64 `json:"msgid"` }