From 78c00a91244920bb3277b492ebf37df33f502a29 Mon Sep 17 00:00:00 2001 From: markwang <617514823@qq.com> Date: Tue, 30 Dec 2025 18:00:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1-?= =?UTF-8?q?=E8=90=A5=E9=94=80=E8=8E=B7=E5=AE=A2=E6=9B=B4=E6=96=B0=20(#871)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- work/externalcontact/contact_way.go | 4 ++ work/externalcontact/customer_acquisition.go | 62 ++++++++++++++++---- work/externalcontact/join_way.go | 3 + 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/work/externalcontact/contact_way.go b/work/externalcontact/contact_way.go index 6420006..2a06cff 100644 --- a/work/externalcontact/contact_way.go +++ b/work/externalcontact/contact_way.go @@ -77,6 +77,8 @@ type ( ExpiresIn int `json:"expires_in"` ChatExpiresIn int `json:"chat_expires_in"` UnionID string `json:"unionid"` + IsExclusive bool `json:"is_exclusive"` + MarkSource bool `json:"mark_source"` Conclusions ConclusionsRequest `json:"conclusions"` } // AddContactWayResponse 配置客户联系「联系我」方式响应 @@ -132,6 +134,7 @@ type ( ExpiresIn int `json:"expires_in"` ChatExpiresIn int `json:"chat_expires_in"` UnionID string `json:"unionid"` + MarkSource bool `json:"mark_source"` Conclusions ConclusionsResponse `json:"conclusions"` } ) @@ -168,6 +171,7 @@ type ( ExpiresIn int `json:"expires_in"` ChatExpiresIn int `json:"chat_expires_in"` UnionID string `json:"unionid"` + MarkSource bool `json:"mark_source"` Conclusions ConclusionsRequest `json:"conclusions"` } // UpdateContactWayResponse 更新企业已配置的「联系我」方式响应 diff --git a/work/externalcontact/customer_acquisition.go b/work/externalcontact/customer_acquisition.go index 6befc88..4b0bf6d 100644 --- a/work/externalcontact/customer_acquisition.go +++ b/work/externalcontact/customer_acquisition.go @@ -25,6 +25,8 @@ const ( customerAcquisitionStatisticURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/statistic?access_token=%s" // customerAcquisitionGetChatInfo 获取成员多次收消息详情 customerAcquisitionGetChatInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/get_chat_info?access_token=%s" + // customerAcquisitionGetPermitURL 获取客户可建联成员 + customerAcquisitionGetPermitURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition_app/get_permit?access_token=%s" ) type ( @@ -68,9 +70,10 @@ type ( // GetCustomerAcquisitionResponse 获取获客链接详情响应 GetCustomerAcquisitionResponse struct { util.CommonError - Link Link `json:"link"` - Range CustomerAcquisitionRange `json:"range"` - SkipVerify bool `json:"skip_verify"` + Link Link `json:"link"` + Range CustomerAcquisitionRange `json:"range"` + PriorityOption CustomerPriorityOption `json:"priority_option"` + SkipVerify bool `json:"skip_verify"` } // Link 获客链接 Link struct { @@ -78,6 +81,8 @@ type ( LinkName string `json:"link_name"` URL string `json:"url"` CreateTime int64 `json:"create_time"` + SkipVerify bool `json:"skip_verify"` + MarkSource bool `json:"mark_source"` } // CustomerAcquisitionRange 该获客链接使用范围 @@ -85,6 +90,12 @@ type ( UserList []string `json:"user_list"` DepartmentList []int64 `json:"department_list"` } + + // CustomerPriorityOption 该获客链接的优先选项 + CustomerPriorityOption struct { + PriorityType int `json:"priority_type"` + PriorityUseridList []string `json:"priority_userid_list"` + } ) // GetCustomerAcquisition 获客助手--获取获客链接详情 @@ -109,9 +120,11 @@ func (r *Client) GetCustomerAcquisition(req *GetCustomerAcquisitionRequest) (*Ge type ( // CreateCustomerAcquisitionLinkRequest 创建获客链接请求 CreateCustomerAcquisitionLinkRequest struct { - LinkName string `json:"link_name"` - Range CustomerAcquisitionRange `json:"range"` - SkipVerify bool `json:"skip_verify"` + LinkName string `json:"link_name"` + Range CustomerAcquisitionRange `json:"range"` + SkipVerify bool `json:"skip_verify"` + PriorityOption CustomerPriorityOption `json:"priority_option"` + MarkSource bool `json:"mark_source"` } // CreateCustomerAcquisitionLinkResponse 创建获客链接响应 CreateCustomerAcquisitionLinkResponse struct { @@ -142,10 +155,12 @@ func (r *Client) CreateCustomerAcquisitionLink(req *CreateCustomerAcquisitionLin type ( // UpdateCustomerAcquisitionLinkRequest 编辑获客链接请求 UpdateCustomerAcquisitionLinkRequest struct { - LinkID string `json:"link_id"` - LinkName string `json:"link_name"` - Range CustomerAcquisitionRange `json:"range"` - SkipVerify bool `json:"skip_verify"` + LinkID string `json:"link_id"` + LinkName string `json:"link_name"` + Range CustomerAcquisitionRange `json:"range"` + SkipVerify bool `json:"skip_verify"` + PriorityOption CustomerPriorityOption `json:"priority_option"` + MarkSource bool `json:"mark_source"` } // UpdateCustomerAcquisitionLinkResponse 编辑获客链接响应 UpdateCustomerAcquisitionLinkResponse struct { @@ -349,3 +364,30 @@ func (r *Client) GetChatInfo(req *GetChatInfoRequest) (*GetChatInfoResponse, err err = util.DecodeWithError(response, result, "GetChatInfo") return result, err } + +// GetPermitResponse 获取客户可建联成员响应 +type GetPermitResponse struct { + util.CommonError + UserList []string `json:"user_list"` + DepartmentList []int `json:"department_list"` + TagList []int `json:"tag_list"` +} + +// GetPermit 获取客户可建联成员 +// see https://developer.work.weixin.qq.com/document/path/101146 +func (r *Client) GetPermit() (*GetPermitResponse, error) { + var ( + accessToken string + err error + ) + if accessToken, err = r.GetAccessToken(); err != nil { + return nil, err + } + var response []byte + if response, err = util.HTTPGet(fmt.Sprintf(customerAcquisitionGetPermitURL, accessToken)); err != nil { + return nil, err + } + result := &GetPermitResponse{} + err = util.DecodeWithError(response, result, "CustomerAcquisitionGetPermit") + return result, err +} diff --git a/work/externalcontact/join_way.go b/work/externalcontact/join_way.go index b9c1140..66561f8 100644 --- a/work/externalcontact/join_way.go +++ b/work/externalcontact/join_way.go @@ -19,6 +19,7 @@ type ( RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号,当auto_create_room为1时有效 ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表,支持5个。见客户群ID获取方法 State string `json:"state"` //非必填 企业自定义的state参数,用于区分不同的入群渠道。不超过30个UTF-8字符 + MarkSource bool `json:"mark_source"` } // AddJoinWayResponse 添加群配置返回值 @@ -65,6 +66,7 @@ type ( ChatIDList []string `json:"chat_id_list"` QrCode string `json:"qr_code"` State string `json:"state"` + MarkSource bool `json:"mark_source"` } //GetJoinWayResponse 获取群配置的返回值 GetJoinWayResponse struct { @@ -103,6 +105,7 @@ type UpdateJoinWayRequest struct { RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号,当auto_create_room为1时有效 ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表,支持5个。见客户群ID获取方法 State string `json:"state"` //非必填 企业自定义的state参数,用于区分不同的入群渠道。不超过30个UTF-8字符 + MarkSource bool `json:"mark_source"` } // UpdateJoinWay 更新客户群进群方式配置