refactor:Optimization of text messages when accepting message req (#981)

pull/992/head
pluto 1 year ago committed by GitHub
parent d7532347ad
commit 687614d3f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -170,12 +170,7 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM
log.ZDebug(c, "getSendMsgReq", "req", req.Content)
switch req.ContentType {
case constant.Text:
text, ok := req.Content["text"].(string)
if !ok {
return nil, errs.ErrArgs.WithDetail("text is not string")
}
data = apistruct.TextContentElem{Content: text}
log.ZDebug(c, "getSendMsgReq", "data", data)
data = apistruct.TextElem{}
case constant.Picture:
data = apistruct.PictureElem{}
case constant.Voice:

@ -72,11 +72,8 @@ type CustomElem struct {
Description string `mapstructure:"description"`
Extension string `mapstructure:"extension"`
}
type TextElem struct {
Text string `mapstructure:"text" validate:"required"`
}
type TextContentElem struct {
type TextElem struct {
Content string `json:"content" validate:"required"`
}

Loading…
Cancel
Save