go-wxhelper/api/admin/aiassistant/save.go

26 lines
612 B
Go
Raw Permalink Normal View History

2024-02-02 17:30:11 +08:00
package aiassistant
import (
"github.com/gin-gonic/gin"
"wechat-robot/model/param/aiassistant"
"wechat-robot/pkg/response"
aiAssistantService "wechat-robot/service/aiassistant"
)
// Save
// @description: 保存AI助手
// @param ctx
func Save(ctx *gin.Context) {
var p aiassistant.Save
if err := ctx.ShouldBind(&p); err != nil {
response.New(ctx).SetMsg("参数错误").SetError(err).Fail()
return
}
// 保存数据
if err := aiAssistantService.Save(p); err != nil {
response.New(ctx).SetMsg("保存失败").SetError(err).Fail()
return
}
response.New(ctx).SetMsg("保存成功").Success()
}