Files
open-im-server/pkg/call_back_struct/common.go
T

67 lines
2.0 KiB
Go
Raw Normal View History

2022-02-24 14:47:21 +08:00
package call_back_struct
2022-02-28 17:57:03 +08:00
2023-01-05 18:32:30 +08:00
import (
"errors"
"fmt"
)
2022-02-28 17:57:03 +08:00
type CommonCallbackReq struct {
2022-06-30 18:50:10 +08:00
SendID string `json:"sendID"`
CallbackCommand string `json:"callbackCommand"`
ServerMsgID string `json:"serverMsgID"`
ClientMsgID string `json:"clientMsgID"`
OperationID string `json:"operationID"`
SenderPlatformID int32 `json:"senderPlatformID"`
SenderNickname string `json:"senderNickname"`
SessionType int32 `json:"sessionType"`
MsgFrom int32 `json:"msgFrom"`
ContentType int32 `json:"contentType"`
Status int32 `json:"status"`
CreateTime int64 `json:"createTime"`
Content string `json:"content"`
2022-08-08 17:42:06 +08:00
Seq uint32 `json:"seq"`
2022-06-30 18:50:10 +08:00
AtUserIDList []string `json:"atUserList"`
SenderFaceURL string `json:"faceURL"`
Ex string `json:"ex"`
2022-02-28 17:57:03 +08:00
}
2023-01-05 18:32:30 +08:00
type CallbackResp interface {
Parse() (IsPass bool, err error)
}
2022-02-28 17:57:03 +08:00
type CommonCallbackResp struct {
2022-03-14 18:33:00 +08:00
ActionCode int `json:"actionCode"`
ErrCode int `json:"errCode"`
ErrMsg string `json:"errMsg"`
2022-02-28 17:57:03 +08:00
OperationID string `json:"operationID"`
}
2022-05-26 18:02:00 +08:00
2023-01-05 18:32:30 +08:00
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
}
2022-07-29 14:36:07 +08:00
type UserStatusBaseCallback struct {
2022-05-26 18:02:00 +08:00
CallbackCommand string `json:"callbackCommand"`
OperationID string `json:"operationID"`
PlatformID int32 `json:"platformID"`
Platform string `json:"platform"`
}
2022-07-29 14:36:07 +08:00
type UserStatusCallbackReq struct {
UserStatusBaseCallback
UserID string `json:"userID"`
}
type UserStatusBatchCallbackReq struct {
UserStatusBaseCallback
UserIDList []string `json:"userIDList"`
}