mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-30 23:33:06 +08:00
groupCallback
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package call_back_struct
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type CommonCallbackReq struct {
|
||||
SendID string `json:"sendID"`
|
||||
CallbackCommand string `json:"callbackCommand"`
|
||||
@@ -20,6 +25,10 @@ type CommonCallbackReq struct {
|
||||
Ex string `json:"ex"`
|
||||
}
|
||||
|
||||
type CallbackResp interface {
|
||||
Parse() (IsPass bool, err error)
|
||||
}
|
||||
|
||||
type CommonCallbackResp struct {
|
||||
ActionCode int `json:"actionCode"`
|
||||
ErrCode int `json:"errCode"`
|
||||
@@ -27,6 +36,18 @@ type CommonCallbackResp struct {
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
|
||||
func (c *CommonCallbackResp) Parse() (isPass bool, err error) {
|
||||
if c.ActionCode != 0 {
|
||||
err = errors.New(fmt.Sprintf("callback response error actionCode is %d, errCode is %d, errMsg is %s", c.ActionCode, c.ErrCode, c.ErrMsg))
|
||||
return false, err
|
||||
}
|
||||
if c.ErrCode != 0 {
|
||||
err = errors.New(fmt.Sprintf("callback response error actionCode is %d, errCode is %d, errMsg is %s", c.ActionCode, c.ErrCode, c.ErrMsg))
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
type UserStatusBaseCallback struct {
|
||||
CallbackCommand string `json:"callbackCommand"`
|
||||
OperationID string `json:"operationID"`
|
||||
|
||||
Reference in New Issue
Block a user