mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
feat: add callback func (#1480)
* feat:add callback func * fix: fix the error * fix: fix the error of repalce * fix: fix the error of repalce
This commit is contained in:
@@ -14,8 +14,10 @@
|
||||
|
||||
package callbackstruct
|
||||
|
||||
import (
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
import "github.com/OpenIMSDK/tools/errs"
|
||||
|
||||
const (
|
||||
Next = 1
|
||||
)
|
||||
|
||||
type CommonCallbackReq struct {
|
||||
@@ -51,14 +53,15 @@ type CallbackResp interface {
|
||||
}
|
||||
|
||||
type CommonCallbackResp struct {
|
||||
ActionCode int `json:"actionCode"`
|
||||
ActionCode int32 `json:"actionCode"`
|
||||
ErrCode int32 `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
ErrDlt string `json:"errDlt"`
|
||||
NextCode int32 `json:"nextCode"`
|
||||
}
|
||||
|
||||
func (c CommonCallbackResp) Parse() error {
|
||||
if c.ActionCode != errs.NoError || c.ErrCode != errs.NoError {
|
||||
if c.ActionCode != errs.NoError || c.NextCode == Next {
|
||||
return errs.NewCodeError(int(c.ErrCode), c.ErrMsg).WithDetail(c.ErrDlt)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user