|
|
@ -167,9 +167,15 @@ func (m *MessageApi) DeleteMsgPhysical(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendMsgReq *msg.SendMsgReq, err error) {
|
|
|
|
func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendMsgReq *msg.SendMsgReq, err error) {
|
|
|
|
var data interface{}
|
|
|
|
var data interface{}
|
|
|
|
|
|
|
|
log.ZDebug(c, "getSendMsgReq", "req", req.Content)
|
|
|
|
switch req.ContentType {
|
|
|
|
switch req.ContentType {
|
|
|
|
case constant.Text:
|
|
|
|
case constant.Text:
|
|
|
|
data = apistruct.TextElem{}
|
|
|
|
text, ok := req.Content["content"].(string)
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return nil, errs.ErrArgs.WithDetail("text is not string")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
data = apistruct.TextContentElem{Content: text}
|
|
|
|
|
|
|
|
log.ZDebug(c, "getSendMsgReq", "data", data)
|
|
|
|
case constant.Picture:
|
|
|
|
case constant.Picture:
|
|
|
|
data = apistruct.PictureElem{}
|
|
|
|
data = apistruct.PictureElem{}
|
|
|
|
case constant.Voice:
|
|
|
|
case constant.Voice:
|
|
|
@ -195,7 +201,7 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM
|
|
|
|
if err := mapstructure.WeakDecode(req.Content, &data); err != nil {
|
|
|
|
if err := mapstructure.WeakDecode(req.Content, &data); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.ZDebug(c, "getSendMsgReq", "data", data)
|
|
|
|
log.ZDebug(c, "getSendMsgReq", "req", req.Content)
|
|
|
|
if err := m.validate.Struct(data); err != nil {
|
|
|
|
if err := m.validate.Struct(data); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|