groupCallback

This commit is contained in:
wangchuxiao
2023-01-05 18:32:30 +08:00
parent 635c703535
commit 99fc84aaea
4 changed files with 89 additions and 76 deletions
+21
View File
@@ -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"`