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

客服管理功能添加 (#600)

This commit is contained in:
Wangrong
2022-08-12 23:24:12 -05:00
committed by GitHub
parent a07c50fda7
commit 37f9e981d6
4 changed files with 276 additions and 6 deletions

View File

@@ -17,6 +17,15 @@ func (c *CommonError) Error() string {
return fmt.Sprintf("%s Error , errcode=%d , errmsg=%s", c.apiName, c.ErrCode, c.ErrMsg)
}
// NewCommonError 新建CommonError错误对于无errcode和errmsg的返回也可以返回该通用错误
func NewCommonError(apiName string, code int64, msg string) *CommonError {
return &CommonError{
apiName: apiName,
ErrCode: code,
ErrMsg: msg,
}
}
// DecodeWithCommonError 将返回值按照CommonError解析
func DecodeWithCommonError(response []byte, apiName string) (err error) {
var commError CommonError