mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
fix: picture cheer
This commit is contained in:
parent
7f1933ccc2
commit
809765722f
@ -413,7 +413,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
|
|
||||||
robotics := "5078764102"
|
robotics := "5078764102"
|
||||||
if req.SendID == robotics || req.ContentType != 101 {
|
if req.SendID == robotics || req.ContentType != constant.Text || req.ContentType != constant.Picture {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,34 +462,32 @@ func (m *MessageApi) CallbackExample(c *gin.Context) {
|
|||||||
content := make(map[string]any, 1)
|
content := make(map[string]any, 1)
|
||||||
log.ZDebug(c, "CallbackExample Content Content Content Content Content Content Content Content Content Content", "req.Content", req.Content)
|
log.ZDebug(c, "CallbackExample Content Content Content Content Content Content Content Content Content Content", "req.Content", req.Content)
|
||||||
|
|
||||||
//{"operationID": "2390e1ce-7e66-4e70-b37e-4be483f22c3f", "content": "{\"content\":\"java\"}"}
|
var con any
|
||||||
//"content":"{\"content\":\"钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱钱\"}"
|
if req.ContentType == constant.Text {
|
||||||
type text struct {
|
con = apistruct.TextElem{}
|
||||||
OperationID string `json:"operationID"`
|
} else {
|
||||||
apistruct.TextElem
|
con = apistruct.PictureElem{}
|
||||||
}
|
}
|
||||||
|
|
||||||
te := &apistruct.TextElem{}
|
err = json.Unmarshal([]byte(req.Content), &con)
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(req.Content), te)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(c, "CallbackExample unmarshal failed", err)
|
log.ZError(c, "CallbackExample unmarshal failed", err)
|
||||||
apiresp.GinError(c, errs.ErrInternalServer.WithDetail(err.Error()).Wrap())
|
apiresp.GinError(c, errs.ErrInternalServer.WithDetail(err.Error()).Wrap())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.ZDebug(c, "CallbackExample Te Te Te Te Te Te Te Te Te Te Te Te Te ", "te", te)
|
log.ZDebug(c, "CallbackExample TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT ", con)
|
||||||
|
|
||||||
str := &text{}
|
if req.ContentType == constant.Text {
|
||||||
err = json.Unmarshal([]byte(req.Content), str)
|
content["content"] = con.(apistruct.TextElem).Content
|
||||||
if err != nil {
|
} else {
|
||||||
log.ZError(c, "CallbackExample unmarshal failed", err)
|
err := json.Unmarshal([]byte(req.Content), &content)
|
||||||
apiresp.GinError(c, errs.ErrInternalServer.WithDetail(err.Error()).Wrap())
|
if err != nil {
|
||||||
return
|
log.ZError(c, "picktureStruct unmarshal failed", err)
|
||||||
|
apiresp.GinError(c, errs.ErrInternalServer.WithDetail(err.Error()).Wrap())
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.ZDebug(c, "CallbackExample TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT ", str)
|
|
||||||
|
|
||||||
content["content"] = te.Content
|
|
||||||
input := &apistruct.SendMsgReq{
|
input := &apistruct.SendMsgReq{
|
||||||
RecvID: req.SendID,
|
RecvID: req.SendID,
|
||||||
SendMsg: apistruct.SendMsg{
|
SendMsg: apistruct.SendMsg{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user