Skip to content

Commit

Permalink
feat: 完善微信客服常用的错误类型
Browse files Browse the repository at this point in the history
  • Loading branch information
NICEXAI committed Sep 24, 2021
1 parent 748adca commit 7177901
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ const (
SDKInvalidCorpID Error = "无效的 CorpID"
// SDKAccessTokenInvalid 错误码:40014
SDKAccessTokenInvalid Error = "AccessToken 无效"
// SDKValidateSignatureFailed 错误码:40015
SDKValidateSignatureFailed Error = "校验签名错误"
// SDKDecryptMSGFailed 错误码:40016
SDKDecryptMSGFailed Error = "消息解密失败"
// SDKMediaIDExceedMinLength 错误码:40058
SDKMediaIDExceedMinLength Error = "media_id 小于最小长度 1"
// SDKContentContainsSensitiveInformation 错误码:40201
SDKContentContainsSensitiveInformation Error = "当前客服账号由于涉及敏感信息,已被封禁,请联系企业微信客服处理"
// SDKAccessTokenMissing 错误码:41001
SDKAccessTokenMissing Error = "缺少AccessToken参数"
// SDKAccessTokenExpired 错误码:42001
Expand Down Expand Up @@ -69,8 +75,14 @@ func NewSDKErr(code int, msgList ...string) Error {
return SDKInvalidCorpID
case 40014:
return SDKAccessTokenInvalid
case 40015:
return SDKValidateSignatureFailed
case 40016:
return SDKDecryptMSGFailed
case 40058:
return SDKMediaIDExceedMinLength
case 40201:
return SDKContentContainsSensitiveInformation
case 45009:
return SDKApiFreqOutOfLimit
case 48002:
Expand Down
2 changes: 1 addition & 1 deletion sendmsg/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Menu struct {
MsgMenu struct {
HeadContent string `json:"head_content"` // 消息内容,不多于1024字节
List []interface{} `json:"list"` // 菜单项配置,不能多余10个
TailContent string `json:"tail_content"` // 结束文本, 不多于1024字
TailContent string `json:"tail_content"` // 结束文本, 不多于1024字
} `json:"msgmenu"`
}

Expand Down
2 changes: 1 addition & 1 deletion sendmsgonevent/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Menu struct {
MsgMenu struct {
HeadContent string `json:"head_content"` // 消息内容,不多于1024字节
List []interface{} `json:"list"` // 菜单项配置,不能多余10个
TailContent string `json:"tail_content"` // 结束文本, 不多于1024字
TailContent string `json:"tail_content"` // 结束文本, 不多于1024字
} `json:"msgmenu"`
}

Expand Down
2 changes: 1 addition & 1 deletion syncmsg/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type EnterSessionEvent struct {
ExternalUserID string `json:"external_userid"` // 客户UserID
Scene string `json:"scene"` // 进入会话的场景值,获取客服帐号链接开发者自定义的场景值
SceneParam string `json:"scene_param"` // 进入会话的自定义参数,获取客服帐号链接返回的url,开发者按规范拼接的scene_param参数
WelcomeCode string `json:"welcome_code"` // 如果满足发送欢迎语条件(条件为:1. 企业没有在管理端配置了原生欢迎语;2. 用户在过去48小时里未收过欢迎语,且未向该用户发过消息),会返回该字段。可用该welcome_code调用发送事件响应消息接口给客户发送欢迎语。
WelcomeCode string `json:"welcome_code"` // 如果满足发送欢迎语条件(条件为:1. 企业没有在管理端配置了原生欢迎语;2. 用户在过去48小时里未收过欢迎语,且未向该用户发过消息),会返回该字段。可用该welcome_code调用发送事件响应消息接口给客户发送欢迎语。
} `json:"event"` // 事件消息
}

Expand Down

0 comments on commit 7177901

Please sign in to comment.