1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

fix: 企业微信-营销获客更新 (#871)

This commit is contained in:
markwang
2025-12-30 18:00:01 +08:00
committed by GitHub
parent 54f08cbd73
commit 78c00a9124
3 changed files with 59 additions and 10 deletions

View File

@@ -77,6 +77,8 @@ type (
ExpiresIn int `json:"expires_in"` ExpiresIn int `json:"expires_in"`
ChatExpiresIn int `json:"chat_expires_in"` ChatExpiresIn int `json:"chat_expires_in"`
UnionID string `json:"unionid"` UnionID string `json:"unionid"`
IsExclusive bool `json:"is_exclusive"`
MarkSource bool `json:"mark_source"`
Conclusions ConclusionsRequest `json:"conclusions"` Conclusions ConclusionsRequest `json:"conclusions"`
} }
// AddContactWayResponse 配置客户联系「联系我」方式响应 // AddContactWayResponse 配置客户联系「联系我」方式响应
@@ -132,6 +134,7 @@ type (
ExpiresIn int `json:"expires_in"` ExpiresIn int `json:"expires_in"`
ChatExpiresIn int `json:"chat_expires_in"` ChatExpiresIn int `json:"chat_expires_in"`
UnionID string `json:"unionid"` UnionID string `json:"unionid"`
MarkSource bool `json:"mark_source"`
Conclusions ConclusionsResponse `json:"conclusions"` Conclusions ConclusionsResponse `json:"conclusions"`
} }
) )
@@ -168,6 +171,7 @@ type (
ExpiresIn int `json:"expires_in"` ExpiresIn int `json:"expires_in"`
ChatExpiresIn int `json:"chat_expires_in"` ChatExpiresIn int `json:"chat_expires_in"`
UnionID string `json:"unionid"` UnionID string `json:"unionid"`
MarkSource bool `json:"mark_source"`
Conclusions ConclusionsRequest `json:"conclusions"` Conclusions ConclusionsRequest `json:"conclusions"`
} }
// UpdateContactWayResponse 更新企业已配置的「联系我」方式响应 // UpdateContactWayResponse 更新企业已配置的「联系我」方式响应

View File

@@ -25,6 +25,8 @@ const (
customerAcquisitionStatisticURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/statistic?access_token=%s" customerAcquisitionStatisticURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/statistic?access_token=%s"
// customerAcquisitionGetChatInfo 获取成员多次收消息详情 // customerAcquisitionGetChatInfo 获取成员多次收消息详情
customerAcquisitionGetChatInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/get_chat_info?access_token=%s" 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 ( type (
@@ -68,9 +70,10 @@ type (
// GetCustomerAcquisitionResponse 获取获客链接详情响应 // GetCustomerAcquisitionResponse 获取获客链接详情响应
GetCustomerAcquisitionResponse struct { GetCustomerAcquisitionResponse struct {
util.CommonError util.CommonError
Link Link `json:"link"` Link Link `json:"link"`
Range CustomerAcquisitionRange `json:"range"` Range CustomerAcquisitionRange `json:"range"`
SkipVerify bool `json:"skip_verify"` PriorityOption CustomerPriorityOption `json:"priority_option"`
SkipVerify bool `json:"skip_verify"`
} }
// Link 获客链接 // Link 获客链接
Link struct { Link struct {
@@ -78,6 +81,8 @@ type (
LinkName string `json:"link_name"` LinkName string `json:"link_name"`
URL string `json:"url"` URL string `json:"url"`
CreateTime int64 `json:"create_time"` CreateTime int64 `json:"create_time"`
SkipVerify bool `json:"skip_verify"`
MarkSource bool `json:"mark_source"`
} }
// CustomerAcquisitionRange 该获客链接使用范围 // CustomerAcquisitionRange 该获客链接使用范围
@@ -85,6 +90,12 @@ type (
UserList []string `json:"user_list"` UserList []string `json:"user_list"`
DepartmentList []int64 `json:"department_list"` DepartmentList []int64 `json:"department_list"`
} }
// CustomerPriorityOption 该获客链接的优先选项
CustomerPriorityOption struct {
PriorityType int `json:"priority_type"`
PriorityUseridList []string `json:"priority_userid_list"`
}
) )
// GetCustomerAcquisition 获客助手--获取获客链接详情 // GetCustomerAcquisition 获客助手--获取获客链接详情
@@ -109,9 +120,11 @@ func (r *Client) GetCustomerAcquisition(req *GetCustomerAcquisitionRequest) (*Ge
type ( type (
// CreateCustomerAcquisitionLinkRequest 创建获客链接请求 // CreateCustomerAcquisitionLinkRequest 创建获客链接请求
CreateCustomerAcquisitionLinkRequest struct { CreateCustomerAcquisitionLinkRequest struct {
LinkName string `json:"link_name"` LinkName string `json:"link_name"`
Range CustomerAcquisitionRange `json:"range"` Range CustomerAcquisitionRange `json:"range"`
SkipVerify bool `json:"skip_verify"` SkipVerify bool `json:"skip_verify"`
PriorityOption CustomerPriorityOption `json:"priority_option"`
MarkSource bool `json:"mark_source"`
} }
// CreateCustomerAcquisitionLinkResponse 创建获客链接响应 // CreateCustomerAcquisitionLinkResponse 创建获客链接响应
CreateCustomerAcquisitionLinkResponse struct { CreateCustomerAcquisitionLinkResponse struct {
@@ -142,10 +155,12 @@ func (r *Client) CreateCustomerAcquisitionLink(req *CreateCustomerAcquisitionLin
type ( type (
// UpdateCustomerAcquisitionLinkRequest 编辑获客链接请求 // UpdateCustomerAcquisitionLinkRequest 编辑获客链接请求
UpdateCustomerAcquisitionLinkRequest struct { UpdateCustomerAcquisitionLinkRequest struct {
LinkID string `json:"link_id"` LinkID string `json:"link_id"`
LinkName string `json:"link_name"` LinkName string `json:"link_name"`
Range CustomerAcquisitionRange `json:"range"` Range CustomerAcquisitionRange `json:"range"`
SkipVerify bool `json:"skip_verify"` SkipVerify bool `json:"skip_verify"`
PriorityOption CustomerPriorityOption `json:"priority_option"`
MarkSource bool `json:"mark_source"`
} }
// UpdateCustomerAcquisitionLinkResponse 编辑获客链接响应 // UpdateCustomerAcquisitionLinkResponse 编辑获客链接响应
UpdateCustomerAcquisitionLinkResponse struct { UpdateCustomerAcquisitionLinkResponse struct {
@@ -349,3 +364,30 @@ func (r *Client) GetChatInfo(req *GetChatInfoRequest) (*GetChatInfoResponse, err
err = util.DecodeWithError(response, result, "GetChatInfo") err = util.DecodeWithError(response, result, "GetChatInfo")
return result, err 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
}

View File

@@ -19,6 +19,7 @@ type (
RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号当auto_create_room为1时有效 RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号当auto_create_room为1时有效
ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表支持5个。见客户群ID获取方法 ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表支持5个。见客户群ID获取方法
State string `json:"state"` //非必填 企业自定义的state参数用于区分不同的入群渠道。不超过30个UTF-8字符 State string `json:"state"` //非必填 企业自定义的state参数用于区分不同的入群渠道。不超过30个UTF-8字符
MarkSource bool `json:"mark_source"`
} }
// AddJoinWayResponse 添加群配置返回值 // AddJoinWayResponse 添加群配置返回值
@@ -65,6 +66,7 @@ type (
ChatIDList []string `json:"chat_id_list"` ChatIDList []string `json:"chat_id_list"`
QrCode string `json:"qr_code"` QrCode string `json:"qr_code"`
State string `json:"state"` State string `json:"state"`
MarkSource bool `json:"mark_source"`
} }
//GetJoinWayResponse 获取群配置的返回值 //GetJoinWayResponse 获取群配置的返回值
GetJoinWayResponse struct { GetJoinWayResponse struct {
@@ -103,6 +105,7 @@ type UpdateJoinWayRequest struct {
RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号当auto_create_room为1时有效 RoomBaseID int `json:"room_base_id"` //非必填 自动建群的群起始序号当auto_create_room为1时有效
ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表支持5个。见客户群ID获取方法 ChatIDList []string `json:"chat_id_list"` //必填 使用该配置的客户群ID列表支持5个。见客户群ID获取方法
State string `json:"state"` //非必填 企业自定义的state参数用于区分不同的入群渠道。不超过30个UTF-8字符 State string `json:"state"` //非必填 企业自定义的state参数用于区分不同的入群渠道。不超过30个UTF-8字符
MarkSource bool `json:"mark_source"`
} }
// UpdateJoinWay 更新客户群进群方式配置 // UpdateJoinWay 更新客户群进群方式配置