mirror of
https://github.com/silenceper/wechat.git
synced 2026-03-01 00:35:26 +08:00
Compare commits
4 Commits
b12825f83b
...
v2.1.6-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45ad2ab8ca | ||
|
|
5d0e32e2ea | ||
|
|
822cfaa6c8 | ||
|
|
acaab64fe7 |
@@ -40,8 +40,8 @@ type ResCode2Session struct {
|
|||||||
type RspCheckEncryptedData struct {
|
type RspCheckEncryptedData struct {
|
||||||
util.CommonError
|
util.CommonError
|
||||||
|
|
||||||
Vaild bool `json:"vaild"` // 是否是合法的数据
|
Vaild bool `json:"vaild"` // 是否是合法的数据
|
||||||
CreateTime uint `json:"create_time"` // 加密数据生成的时间戳
|
CreateTime uint64 `json:"create_time"` // 加密数据生成的时间戳
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code2Session 登录凭证校验。
|
// Code2Session 登录凭证校验。
|
||||||
|
|||||||
@@ -196,6 +196,14 @@ type MixMessage struct {
|
|||||||
LegalPersonaName string `xml:"legal_persona_name"`
|
LegalPersonaName string `xml:"legal_persona_name"`
|
||||||
ComponentPhone string `xml:"component_phone"`
|
ComponentPhone string `xml:"component_phone"`
|
||||||
} `xml:"info"`
|
} `xml:"info"`
|
||||||
|
ResultInfo struct {
|
||||||
|
APIName string `xml:"api_name"`
|
||||||
|
ApplyTime string `xml:"apply_time"`
|
||||||
|
AuditID string `xml:"audit_id"`
|
||||||
|
AuditTime string `xml:"audit_time"`
|
||||||
|
Reason string `xml:"reason"`
|
||||||
|
Status string `xml:"status"`
|
||||||
|
} `xml:"result_info"`
|
||||||
|
|
||||||
// 卡券相关
|
// 卡券相关
|
||||||
CardID string `xml:"CardId"`
|
CardID string `xml:"CardId"`
|
||||||
@@ -214,6 +222,10 @@ type MixMessage struct {
|
|||||||
TraceID string `xml:"trace_id"`
|
TraceID string `xml:"trace_id"`
|
||||||
StatusCode int `xml:"status_code"`
|
StatusCode int `xml:"status_code"`
|
||||||
|
|
||||||
|
//小程序名称审核结果事件推送
|
||||||
|
Ret int32 `xml:"ret"` //审核结果 2:失败,3:成功
|
||||||
|
NickName string `xml:"nickname"` //小程序昵称
|
||||||
|
|
||||||
// 设备相关
|
// 设备相关
|
||||||
device.MsgDevice
|
device.MsgDevice
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,18 @@ const (
|
|||||||
fetchBatchExternalContactUserDetailURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/batch/get_by_user"
|
fetchBatchExternalContactUserDetailURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/batch/get_by_user"
|
||||||
// updateUserRemarkURL 更新客户备注信息
|
// updateUserRemarkURL 更新客户备注信息
|
||||||
updateUserRemarkURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/remark"
|
updateUserRemarkURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/remark"
|
||||||
|
// listCustomerStrategyURL 获取规则组列表
|
||||||
|
listCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/list?access_token=%s"
|
||||||
|
// getCustomerStrategyURL 获取规则组详情
|
||||||
|
getCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/get?access_token=%s"
|
||||||
|
// getRangeCustomerStrategyURL 获取规则组管理范围
|
||||||
|
getRangeCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/get_range?access_token=%s"
|
||||||
|
// createCustomerStrategyURL 创建新的规则组
|
||||||
|
createCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/create?access_token=%s"
|
||||||
|
// editCustomerStrategyURL 编辑规则组及其管理范围
|
||||||
|
editCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/edit?access_token=%s"
|
||||||
|
// delCustomerStrategyURL 删除规则组
|
||||||
|
delCustomerStrategyURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_strategy/del?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExternalUserListResponse 外部联系人列表响应
|
// ExternalUserListResponse 外部联系人列表响应
|
||||||
@@ -71,7 +83,7 @@ type FollowUser struct {
|
|||||||
UserID string `json:"userid"`
|
UserID string `json:"userid"`
|
||||||
Remark string `json:"remark"`
|
Remark string `json:"remark"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
CreateTime string `json:"create_time"`
|
CreateTime int64 `json:"createtime"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
RemarkCorpName string `json:"remark_corp_name"`
|
RemarkCorpName string `json:"remark_corp_name"`
|
||||||
RemarkMobiles []string `json:"remark_mobiles"`
|
RemarkMobiles []string `json:"remark_mobiles"`
|
||||||
@@ -157,7 +169,7 @@ type FollowInfo struct {
|
|||||||
UserID string `json:"userid"`
|
UserID string `json:"userid"`
|
||||||
Remark string `json:"remark"`
|
Remark string `json:"remark"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
CreateTime int `json:"create_time"`
|
CreateTime int64 `json:"createtime"`
|
||||||
TagID []string `json:"tag_id"`
|
TagID []string `json:"tag_id"`
|
||||||
RemarkCorpName string `json:"remark_corp_name"`
|
RemarkCorpName string `json:"remark_corp_name"`
|
||||||
RemarkMobiles []string `json:"remark_mobiles"`
|
RemarkMobiles []string `json:"remark_mobiles"`
|
||||||
@@ -219,3 +231,236 @@ func (r *Client) UpdateUserRemark(request UpdateUserRemarkRequest) error {
|
|||||||
}
|
}
|
||||||
return util.DecodeWithCommonError(response, "UpdateUserRemark")
|
return util.DecodeWithCommonError(response, "UpdateUserRemark")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListCustomerStrategyRequest 获取规则组列表请求
|
||||||
|
type ListCustomerStrategyRequest struct {
|
||||||
|
Cursor string `json:"cursor"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListCustomerStrategyResponse 获取规则组列表响应
|
||||||
|
type ListCustomerStrategyResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
Strategy []StrategyID `json:"strategy"`
|
||||||
|
NextCursor string `json:"next_cursor"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// StrategyID 规则组ID
|
||||||
|
type StrategyID struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListCustomerStrategy 获取规则组列表
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94883#%E8%8E%B7%E5%8F%96%E8%A7%84%E5%88%99%E7%BB%84%E5%88%97%E8%A1%A8
|
||||||
|
func (r *Client) ListCustomerStrategy(req *ListCustomerStrategyRequest) (*ListCustomerStrategyResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(listCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &ListCustomerStrategyResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "ListCustomerStrategy"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCustomerStrategyRequest 获取规则组详情请求
|
||||||
|
type GetCustomerStrategyRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCustomerStrategyResponse 获取规则组详情响应
|
||||||
|
type GetCustomerStrategyResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
Strategy Strategy `json:"strategy"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strategy 规则组
|
||||||
|
type Strategy struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
ParentID int `json:"parent_id"`
|
||||||
|
StrategyName string `json:"strategy_name"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
AdminList []string `json:"admin_list"`
|
||||||
|
Privilege Privilege `json:"privilege"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Privilege 权限
|
||||||
|
type Privilege struct {
|
||||||
|
ViewCustomerList bool `json:"view_customer_list"`
|
||||||
|
ViewCustomerData bool `json:"view_customer_data"`
|
||||||
|
ViewRoomList bool `json:"view_room_list"`
|
||||||
|
ContactMe bool `json:"contact_me"`
|
||||||
|
JoinRoom bool `json:"join_room"`
|
||||||
|
ShareCustomer bool `json:"share_customer"`
|
||||||
|
OperResignCustomer bool `json:"oper_resign_customer"`
|
||||||
|
OperResignGroup bool `json:"oper_resign_group"`
|
||||||
|
SendCustomerMsg bool `json:"send_customer_msg"`
|
||||||
|
EditWelcomeMsg bool `json:"edit_welcome_msg"`
|
||||||
|
ViewBehaviorData bool `json:"view_behavior_data"`
|
||||||
|
ViewRoomData bool `json:"view_room_data"`
|
||||||
|
SendGroupMsg bool `json:"send_group_msg"`
|
||||||
|
RoomDeduplication bool `json:"room_deduplication"`
|
||||||
|
RapidReply bool `json:"rapid_reply"`
|
||||||
|
OnjobCustomerTransfer bool `json:"onjob_customer_transfer"`
|
||||||
|
EditAntiSpamRule bool `json:"edit_anti_spam_rule"`
|
||||||
|
ExportCustomerList bool `json:"export_customer_list"`
|
||||||
|
ExportCustomerData bool `json:"export_customer_data"`
|
||||||
|
ExportCustomerGroupList bool `json:"export_customer_group_list"`
|
||||||
|
ManageCustomerTag bool `json:"manage_customer_tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCustomerStrategy 获取规则组详情
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94883#%E8%8E%B7%E5%8F%96%E8%A7%84%E5%88%99%E7%BB%84%E8%AF%A6%E6%83%85
|
||||||
|
func (r *Client) GetCustomerStrategy(req *GetCustomerStrategyRequest) (*GetCustomerStrategyResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetCustomerStrategyResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "GetCustomerStrategy"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRangeCustomerStrategyRequest 获取规则组管理范围请求
|
||||||
|
type GetRangeCustomerStrategyRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
Cursor string `json:"cursor"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRangeCustomerStrategyResponse 获取规则组管理范围响应
|
||||||
|
type GetRangeCustomerStrategyResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
Range []Range `json:"range"`
|
||||||
|
NextCursor string `json:"next_cursor"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range 管理范围节点
|
||||||
|
type Range struct {
|
||||||
|
Type int `json:"type"`
|
||||||
|
UserID string `json:"userid,omitempty"`
|
||||||
|
PartyID int `json:"partyid,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRangeCustomerStrategy 获取规则组管理范围
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94883#%E8%8E%B7%E5%8F%96%E8%A7%84%E5%88%99%E7%BB%84%E7%AE%A1%E7%90%86%E8%8C%83%E5%9B%B4
|
||||||
|
func (r *Client) GetRangeCustomerStrategy(req *GetRangeCustomerStrategyRequest) (*GetRangeCustomerStrategyResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getRangeCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetRangeCustomerStrategyResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "GetRangeCustomerStrategy"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateCustomerStrategyRequest 创建新的规则组请求
|
||||||
|
type CreateCustomerStrategyRequest struct {
|
||||||
|
ParentID int `json:"parent_id"`
|
||||||
|
StrategyName string `json:"strategy_name"`
|
||||||
|
AdminList []string `json:"admin_list"`
|
||||||
|
Privilege Privilege `json:"privilege"`
|
||||||
|
Range []Range `json:"range"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateCustomerStrategyResponse 创建新的规则组响应
|
||||||
|
type CreateCustomerStrategyResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateCustomerStrategy 创建新的规则组
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94883#%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E8%A7%84%E5%88%99%E7%BB%84
|
||||||
|
func (r *Client) CreateCustomerStrategy(req *CreateCustomerStrategyRequest) (*CreateCustomerStrategyResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(createCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &CreateCustomerStrategyResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "CreateCustomerStrategy"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditCustomerStrategyRequest 编辑规则组及其管理范围请求
|
||||||
|
type EditCustomerStrategyRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
StrategyName string `json:"strategy_name"`
|
||||||
|
AdminList []string `json:"admin_list"`
|
||||||
|
Privilege Privilege `json:"privilege"`
|
||||||
|
RangeAdd []Range `json:"range_add"`
|
||||||
|
RangeDel []Range `json:"range_del"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditCustomerStrategy 编辑规则组及其管理范围
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94883#%E7%BC%96%E8%BE%91%E8%A7%84%E5%88%99%E7%BB%84%E5%8F%8A%E5%85%B6%E7%AE%A1%E7%90%86%E8%8C%83%E5%9B%B4
|
||||||
|
func (r *Client) EditCustomerStrategy(req *EditCustomerStrategyRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(editCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "EditCustomerStrategy")
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelCustomerStrategyRequest 删除规则组请求
|
||||||
|
type DelCustomerStrategyRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelCustomerStrategy 删除规则组
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94883#%E5%88%A0%E9%99%A4%E8%A7%84%E5%88%99%E7%BB%84
|
||||||
|
func (r *Client) DelCustomerStrategy(req *DelCustomerStrategyRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(delCustomerStrategyURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "DelCustomerStrategy")
|
||||||
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ type (
|
|||||||
ChatID string `json:"chat_id"` //客户群ID
|
ChatID string `json:"chat_id"` //客户群ID
|
||||||
Name string `json:"name"` //群名
|
Name string `json:"name"` //群名
|
||||||
Owner string `json:"owner"` //群主ID
|
Owner string `json:"owner"` //群主ID
|
||||||
CreateTime int `json:"create_time"` //群的创建时间
|
CreateTime int64 `json:"create_time"` //群的创建时间
|
||||||
Notice string `json:"notice"` //群公告
|
Notice string `json:"notice"` //群公告
|
||||||
MemberList []GroupChatMember `json:"member_list"` //群成员列表
|
MemberList []GroupChatMember `json:"member_list"` //群成员列表
|
||||||
AdminList []GroupChatAdmin `json:"admin_list"` //群管理员列表
|
AdminList []GroupChatAdmin `json:"admin_list"` //群管理员列表
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ func (r *Client) AddMsgTemplate(req *AddMsgTemplateRequest) (*AddMsgTemplateResp
|
|||||||
// GetGroupMsgListV2Request 获取群发记录列表请求
|
// GetGroupMsgListV2Request 获取群发记录列表请求
|
||||||
type GetGroupMsgListV2Request struct {
|
type GetGroupMsgListV2Request struct {
|
||||||
ChatType string `json:"chat_type"`
|
ChatType string `json:"chat_type"`
|
||||||
StartTime int `json:"start_time"`
|
StartTime int64 `json:"start_time"`
|
||||||
EndTime int `json:"end_time"`
|
EndTime int64 `json:"end_time"`
|
||||||
Creator string `json:"creator,omitempty"`
|
Creator string `json:"creator,omitempty"`
|
||||||
FilterType int `json:"filter_type"`
|
FilterType int `json:"filter_type"`
|
||||||
Limit int `json:"limit"`
|
Limit int `json:"limit"`
|
||||||
@@ -130,7 +130,7 @@ type GetGroupMsgListV2Response struct {
|
|||||||
type GroupMsg struct {
|
type GroupMsg struct {
|
||||||
MsgID string `json:"msgid"`
|
MsgID string `json:"msgid"`
|
||||||
Creator string `json:"creator"`
|
Creator string `json:"creator"`
|
||||||
CreateTime int `json:"create_time"`
|
CreateTime int64 `json:"create_time"`
|
||||||
CreateType int `json:"create_type"`
|
CreateType int `json:"create_type"`
|
||||||
Text MsgText `json:"text"`
|
Text MsgText `json:"text"`
|
||||||
Attachments []*Attachment `json:"attachments"`
|
Attachments []*Attachment `json:"attachments"`
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ const (
|
|||||||
delCropTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag"
|
delCropTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag"
|
||||||
// markCropTagURL 为客户打上、删除标签
|
// markCropTagURL 为客户打上、删除标签
|
||||||
markCropTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/mark_tag"
|
markCropTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/mark_tag"
|
||||||
|
// getStrategyTagListURL 获取指定规则组下的企业客户标签
|
||||||
|
getStrategyTagListURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_strategy_tag_list?access_token=%s"
|
||||||
|
// addStrategyTagURL 为指定规则组创建企业客户标签
|
||||||
|
addStrategyTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_strategy_tag?access_token=%s"
|
||||||
|
// editStrategyTagURL 编辑指定规则组下的企业客户标签
|
||||||
|
editStrategyTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/edit_strategy_tag?access_token=%s"
|
||||||
|
// delStrategyTagURL 删除指定规则组下的企业客户标签
|
||||||
|
delStrategyTagURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_strategy_tag?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetCropTagRequest 获取企业标签请求
|
// GetCropTagRequest 获取企业标签请求
|
||||||
@@ -36,7 +44,7 @@ type GetCropTagListResponse struct {
|
|||||||
type TagGroup struct {
|
type TagGroup struct {
|
||||||
GroupID string `json:"group_id"`
|
GroupID string `json:"group_id"`
|
||||||
GroupName string `json:"group_name"`
|
GroupName string `json:"group_name"`
|
||||||
CreateTime int `json:"create_time"`
|
CreateTime int64 `json:"create_time"`
|
||||||
GroupOrder int `json:"group_order"`
|
GroupOrder int `json:"group_order"`
|
||||||
Deleted bool `json:"deleted"`
|
Deleted bool `json:"deleted"`
|
||||||
Tag []TagGroupTagItem `json:"tag"`
|
Tag []TagGroupTagItem `json:"tag"`
|
||||||
@@ -46,7 +54,7 @@ type TagGroup struct {
|
|||||||
type TagGroupTagItem struct {
|
type TagGroupTagItem struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CreateTime int `json:"create_time"`
|
CreateTime int64 `json:"create_time"`
|
||||||
Order int `json:"order"`
|
Order int `json:"order"`
|
||||||
Deleted bool `json:"deleted"`
|
Deleted bool `json:"deleted"`
|
||||||
}
|
}
|
||||||
@@ -201,3 +209,161 @@ func (r *Client) MarkTag(request MarkTagRequest) error {
|
|||||||
}
|
}
|
||||||
return util.DecodeWithCommonError(response, "MarkTag")
|
return util.DecodeWithCommonError(response, "MarkTag")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStrategyTagListRequest 获取指定规则组下的企业客户标签请求
|
||||||
|
type GetStrategyTagListRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
TagID []string `json:"tag_id"`
|
||||||
|
GroupID []string `json:"group_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStrategyTagListResponse 获取指定规则组下的企业客户标签响应
|
||||||
|
type GetStrategyTagListResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
TagGroup []StrategyTagGroup `json:"tag_group"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// StrategyTagGroup 规则组下的企业标签组
|
||||||
|
type StrategyTagGroup struct {
|
||||||
|
GroupID string `json:"group_id"`
|
||||||
|
GroupName string `json:"group_name"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
Tag []StrategyTag `json:"tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// StrategyTag 规则组下的企业标签
|
||||||
|
type StrategyTag struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStrategyTagList 获取指定规则组下的企业客户标签
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94882#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E8%A7%84%E5%88%99%E7%BB%84%E4%B8%8B%E7%9A%84%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%88%B7%E6%A0%87%E7%AD%BE
|
||||||
|
func (r *Client) GetStrategyTagList(req *GetStrategyTagListRequest) (*GetStrategyTagListResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getStrategyTagListURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetStrategyTagListResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "GetStrategyTagList"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTagRequest 为指定规则组创建企业客户标签请求
|
||||||
|
type AddStrategyTagRequest struct {
|
||||||
|
StrategyID int `json:"strategy_id"`
|
||||||
|
GroupID string `json:"group_id"`
|
||||||
|
GroupName string `json:"group_name"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
Tag []AddStrategyTagRequestItem `json:"tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTagRequestItem 为指定规则组创建企业客户标签请求条目
|
||||||
|
type AddStrategyTagRequestItem struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTagResponse 为指定规则组创建企业客户标签响应
|
||||||
|
type AddStrategyTagResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
TagGroup AddStrategyTagResponseTagGroup `json:"tag_group"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTagResponseTagGroup 为指定规则组创建企业客户标签响应标签组
|
||||||
|
type AddStrategyTagResponseTagGroup struct {
|
||||||
|
GroupID string `json:"group_id"`
|
||||||
|
GroupName string `json:"group_name"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
Tag []AddStrategyTagResponseItem `json:"tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTagResponseItem 标签组内的标签列表
|
||||||
|
type AddStrategyTagResponseItem struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStrategyTag 为指定规则组创建企业客户标签
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/94882#%E4%B8%BA%E6%8C%87%E5%AE%9A%E8%A7%84%E5%88%99%E7%BB%84%E5%88%9B%E5%BB%BA%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%88%B7%E6%A0%87%E7%AD%BE
|
||||||
|
func (r *Client) AddStrategyTag(req *AddStrategyTagRequest) (*AddStrategyTagResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(addStrategyTagURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &AddStrategyTagResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "AddStrategyTag"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditStrategyTagRequest 编辑指定规则组下的企业客户标签请求
|
||||||
|
type EditStrategyTagRequest struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Order int `json:"order"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditStrategyTag 编辑指定规则组下的企业客户标签
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94882#%E7%BC%96%E8%BE%91%E6%8C%87%E5%AE%9A%E8%A7%84%E5%88%99%E7%BB%84%E4%B8%8B%E7%9A%84%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%88%B7%E6%A0%87%E7%AD%BE
|
||||||
|
func (r *Client) EditStrategyTag(req *EditStrategyTagRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(editStrategyTagURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "EditStrategyTag")
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelStrategyTagRequest 删除指定规则组下的企业客户标签请求
|
||||||
|
type DelStrategyTagRequest struct {
|
||||||
|
TagID []string `json:"tag_id"`
|
||||||
|
GroupID []string `json:"group_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelStrategyTag 删除指定规则组下的企业客户标签
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94882#%E5%88%A0%E9%99%A4%E6%8C%87%E5%AE%9A%E8%A7%84%E5%88%99%E7%BB%84%E4%B8%8B%E7%9A%84%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%88%B7%E6%A0%87%E7%AD%BE
|
||||||
|
func (r *Client) DelStrategyTag(req *DelStrategyTagRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(delStrategyTagURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "DelStrategyTag")
|
||||||
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ type callbackOriginMessage struct {
|
|||||||
// CallbackMessage 微信客服回调消息
|
// CallbackMessage 微信客服回调消息
|
||||||
type CallbackMessage struct {
|
type CallbackMessage struct {
|
||||||
ToUserName string `json:"to_user_name" xml:"ToUserName"` // 微信客服组件ID
|
ToUserName string `json:"to_user_name" xml:"ToUserName"` // 微信客服组件ID
|
||||||
CreateTime int `json:"create_time" xml:"CreateTime"` // 消息创建时间,unix时间戳
|
CreateTime int64 `json:"create_time" xml:"CreateTime"` // 消息创建时间,unix时间戳
|
||||||
MsgType string `json:"msgtype" xml:"MsgType"` // 消息的类型,此时固定为 event
|
MsgType string `json:"msgtype" xml:"MsgType"` // 消息的类型,此时固定为 event
|
||||||
Event string `json:"event" xml:"Event"` // 事件的类型,此时固定为 kf_msg_or_event
|
Event string `json:"event" xml:"Event"` // 事件的类型,此时固定为 kf_msg_or_event
|
||||||
Token string `json:"token" xml:"Token"` // 调用拉取消息接口时,需要传此token,用于校验请求的合法性
|
Token string `json:"token" xml:"Token"` // 调用拉取消息接口时,需要传此token,用于校验请求的合法性
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ type CollectMessage struct {
|
|||||||
Collect struct {
|
Collect struct {
|
||||||
RoomName string `json:"room_name,omitempty"` // 填表消息所在的群名称。
|
RoomName string `json:"room_name,omitempty"` // 填表消息所在的群名称。
|
||||||
Creator string `json:"creator,omitempty"` // 创建者在群中的名字
|
Creator string `json:"creator,omitempty"` // 创建者在群中的名字
|
||||||
CreateTime string `json:"create_time,omitempty"` // 创建的时间
|
CreateTime int64 `json:"create_time,omitempty"` // 创建的时间
|
||||||
Details []CollectDetails `json:"details,omitempty"` // 表内容
|
Details []CollectDetails `json:"details,omitempty"` // 表内容
|
||||||
} `json:"collect,omitempty"`
|
} `json:"collect,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ var (
|
|||||||
oauthUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=%s&code=%s"
|
oauthUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=%s&code=%s"
|
||||||
// oauthQrContentTargetURL 构造独立窗口登录二维码
|
// oauthQrContentTargetURL 构造独立窗口登录二维码
|
||||||
oauthQrContentTargetURL = "https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid=%s&agentid=%s&redirect_uri=%s&state=%s"
|
oauthQrContentTargetURL = "https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid=%s&agentid=%s&redirect_uri=%s&state=%s"
|
||||||
|
// getUserInfoURL 获取访问用户身份&获取用户登录身份
|
||||||
|
getUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=%s&code=%s"
|
||||||
|
// getUserDetailURL 获取访问用户敏感信息
|
||||||
|
getUserDetailURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewOauth new init oauth
|
// NewOauth new init oauth
|
||||||
@@ -93,3 +97,73 @@ func (ctr *Oauth) UserFromCode(code string) (result ResUserInfo, err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserInfoResponse 获取访问用户身份&获取用户登录身份响应
|
||||||
|
type GetUserInfoResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
UserTicket string `json:"user_ticket"`
|
||||||
|
OpenID string `json:"openid"`
|
||||||
|
ExternalUserID string `json:"external_userid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserInfo 获取访问用户身份&获取用户登录身份
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/90213 获取访问用户身份
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/98176 获取用户登录身份
|
||||||
|
func (ctr *Oauth) GetUserInfo(code string) (*GetUserInfoResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = ctr.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.HTTPGet(fmt.Sprintf(getUserInfoURL, accessToken, code)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetUserInfoResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "GetUserInfo"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDetailRequest 获取访问用户敏感信息请求
|
||||||
|
type GetUserDetailRequest struct {
|
||||||
|
UserTicket string `json:"user_ticket"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDetailResponse 获取访问用户敏感信息响应
|
||||||
|
type GetUserDetailResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
Gender string `json:"gender"`
|
||||||
|
Avatar string `json:"avatar"`
|
||||||
|
QrCode string `json:"qr_code"`
|
||||||
|
Mobile string `json:"mobile"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
BizMail string `json:"biz_mail"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserDetail 获取访问用户敏感信息
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/95833
|
||||||
|
func (ctr *Oauth) GetUserDetail(req *GetUserDetailRequest) (*GetUserDetailResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = ctr.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getUserDetailURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetUserDetailResponse{}
|
||||||
|
if err = util.DecodeWithError(response, result, "GetUserDetail"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user