mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-09 23:22:27 +08:00
feat:暴露接待人员ID到消息列表 (#461)
* 添加微信客服SDK * polish:优化签名函数 * polish:优化注释内容 * polish:复用已有的Token以及CommonError,移除无用的输出 * polish:复用已有的消息加解密 * fix:修复错误信息被覆盖的问题 * polish:go fmt 文件 * polish:客服链接支持自定义参数并更新注释文档内容 * feat:支持微信客服回调请求的校验和消息的解析,复用原有的Signature和DecryptMsg方法 * feat:对外暴露SDKApiForbidden等错误 可以通过调用升级服务相关接口然后根据该错误判断微信客服配置来源 * feat:添加无效的open_kfid错误信息 * fix: 添加SDKApiNotOpen 错误信息 目前主要用于判断客户是否关闭了API授权,如果客户关闭了API功能导致服务异常,则可以引导用户执行相应的操作重新开启改功能 * feat:暴露接待人员ID到消息列表 无需对消息进行序列化即可直接获取接待人员ID,便于处理接待人员的相关业务,例如:统计接待人员当天应答次数 * feat: 添加SDKNotUseInWeCom错误信息 如果SDK输出当前错误,则说明用户在企业微信后台关闭了微信客服功能,需引导用户重新开启该功能 Co-authored-by: Afeyer <afeyer@h5base.cn>
This commit is contained in:
@@ -39,6 +39,8 @@ const (
|
|||||||
SDKOpenKFIDNotExist Error = "open_kfid 不存在"
|
SDKOpenKFIDNotExist Error = "open_kfid 不存在"
|
||||||
// SDKWeWorkAlready 错误码:95011
|
// SDKWeWorkAlready 错误码:95011
|
||||||
SDKWeWorkAlready Error = "已在企业微信使用微信客服"
|
SDKWeWorkAlready Error = "已在企业微信使用微信客服"
|
||||||
|
// SDKNotUseInWeCom 错误码:95012
|
||||||
|
SDKNotUseInWeCom Error = "未在企业微信使用微信客服"
|
||||||
// SDKApiNotOpen 错误码:95017
|
// SDKApiNotOpen 错误码:95017
|
||||||
SDKApiNotOpen Error = "API 功能没有被开启"
|
SDKApiNotOpen Error = "API 功能没有被开启"
|
||||||
)
|
)
|
||||||
@@ -79,6 +81,8 @@ func NewSDKErr(code int64, msgList ...string) Error {
|
|||||||
return SDKOpenKFIDNotExist
|
return SDKOpenKFIDNotExist
|
||||||
case 95011:
|
case 95011:
|
||||||
return SDKWeWorkAlready
|
return SDKWeWorkAlready
|
||||||
|
case 95012:
|
||||||
|
return SDKNotUseInWeCom
|
||||||
case 95017:
|
case 95017:
|
||||||
return SDKApiNotOpen
|
return SDKApiNotOpen
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const (
|
|||||||
// ReceptionistOptions 添加接待人员请求参数
|
// ReceptionistOptions 添加接待人员请求参数
|
||||||
type ReceptionistOptions struct {
|
type ReceptionistOptions struct {
|
||||||
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
||||||
UserIDList []string `json:"userid_list"` // 接待人员userid列表
|
UserIDList []string `json:"userid_list"` // 接待人员userid列表。第三方应用填密文userid,即open_userid 可填充个数:1 ~ 100。超过100个需分批调用。
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReceptionistSchema 添加接待人员响应内容
|
// ReceptionistSchema 添加接待人员响应内容
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ import "encoding/json"
|
|||||||
|
|
||||||
// Message 同步的消息内容
|
// Message 同步的消息内容
|
||||||
type Message struct {
|
type Message struct {
|
||||||
MsgID string `json:"msgid"` // 消息ID
|
MsgID string `json:"msgid"` // 消息ID
|
||||||
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
||||||
ExternalUserID string `json:"external_userid"` // 客户UserID
|
ExternalUserID string `json:"external_userid"` // 客户UserID
|
||||||
SendTime uint64 `json:"send_time"` // 消息发送时间
|
ReceptionistUserID string `json:"servicer_userid"` // 接待客服userID
|
||||||
Origin uint32 `json:"origin"` // 消息来源。3-客户回复的消息 4-系统推送的消 息
|
SendTime uint64 `json:"send_time"` // 消息发送时间
|
||||||
MsgType string `json:"msgtype"` // 消息类型
|
Origin uint32 `json:"origin"` // 消息来源。3-客户回复的消息 4-系统推送的消 息
|
||||||
EventType string `json:"event_type"` // 事件类型
|
MsgType string `json:"msgtype"` // 消息类型
|
||||||
OriginData []byte `json:"origin_data"` // 原始数据内容
|
EventType string `json:"event_type"` // 事件类型
|
||||||
|
OriginData []byte `json:"origin_data"` // 原始数据内容
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOriginMessage 获取原始消息
|
// GetOriginMessage 获取原始消息
|
||||||
|
|||||||
Reference in New Issue
Block a user