mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-04 11:22:17 +08:00
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package control
|
|
|
|
import (
|
|
"call-back-http/model"
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
func CallbackBeforeSendSingleMsgCommand(c *gin.Context) {
|
|
var req model.CallbackBeforeSendSingleMsgReq
|
|
if err := c.BindJSON(&req); err != nil {
|
|
fmt.Printf("err:%v", err)
|
|
return
|
|
}
|
|
fmt.Printf("CallbackBeforeSendSingleMsgCommand received:%#v\n", req)
|
|
str := "callback return message"
|
|
byte, err := json.Marshal(str)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, &model.CallbackBeforeSendSingleMsgResp{
|
|
CommonCallbackResp: model.CommonCallbackResp{
|
|
ActionCode: 500,
|
|
ErrCode: 5001,
|
|
ErrMsg: "callback error",
|
|
ErrDlt: err.Error(),
|
|
NextCode: 2,
|
|
},
|
|
})
|
|
}
|
|
resp := &model.CallbackBeforeSendSingleMsgResp{
|
|
CommonCallbackResp: model.CommonCallbackResp{
|
|
ActionCode: 0,
|
|
ErrCode: 2000,
|
|
ErrMsg: "Success",
|
|
ErrDlt: "Successful",
|
|
NextCode: 2,
|
|
},
|
|
Content: byte,
|
|
}
|
|
fmt.Printf("CallbackBeforeSendSingleMsgCommand return:%#v\n", resp)
|
|
c.JSON(http.StatusOK, resp)
|
|
}
|