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:
Brabem
2023-11-28 15:26:46 +08:00
committed by GitHub
parent 100926da0e
commit 02142c55b2
21 changed files with 801 additions and 164 deletions
+7 -4
View File
@@ -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