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

66 lines
1.9 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 (
2023-01-05 20:04:11 +08:00
"Open_IM/pkg/common/constant"
2023-01-05 18:32:30 +08:00
"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 {
2023-01-05 20:04:11 +08:00
Parse() (err error)
2023-01-05 18:32:30 +08:00
}
2022-02-28 17:57:03 +08:00
type CommonCallbackResp struct {
2022-03-14 18:33:00 +08:00
ActionCode int `json:"actionCode"`
2023-01-05 20:04:11 +08:00
ErrCode int32 `json:"errCode"`
2022-03-14 18:33:00 +08:00
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 20:04:11 +08:00
func (c *CommonCallbackResp) Parse() (err error) {
if c.ActionCode != constant.NoError || c.ErrCode != constant.NoError {
newErr := constant.ErrCallback
newErr.ErrCode = c.ErrCode
newErr.DetailErrMsg = fmt.Sprintf("callback response error actionCode is %d, errCode is %d, errMsg is %s", c.ActionCode, c.ErrCode, c.ErrMsg)
err = newErr
return
2023-01-05 18:32:30 +08:00
}
2023-01-05 20:04:11 +08:00
return
2023-01-05 18:32:30 +08:00
}
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"`
}