JM-WechatMini/api/v1/app/ai_kefu.go

31 lines
668 B
Go
Raw Normal View History

2023-11-10 09:30:29 +08:00
package app
import (
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"miniapp/global"
"miniapp/model/app/request"
r "miniapp/model/common/response"
)
type AiKefuApi struct{}
// SendMessage 发送消息
func (a *AiKefuApi) SendMessage(ctx *gin.Context) {
var p request.Msg
if err := ctx.ShouldBind(&p); err != nil {
global.GVA_LOG.Error("参数校验失败", zap.Error(err))
r.FailWithMessage("参数校验失败", ctx)
return
}
kf, err := aiKefuService.MatchKeywordReplyContent(p)
if err != nil {
global.GVA_LOG.Error("查询失败", zap.Error(err))
r.FailWithMessage("查询失败", ctx)
return
}
r.OkWithDetailed(kf, "查询成功", ctx)
}