26 lines
592 B
Go
26 lines
592 B
Go
|
package aiassistant
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"unicode/utf8"
|
||
|
"wechat-robot/pkg/response"
|
||
|
aiAssistantService "wechat-robot/service/aiassistant"
|
||
|
)
|
||
|
|
||
|
// DeleteById
|
||
|
// @description: 删除AI助手
|
||
|
// @param ctx
|
||
|
func DeleteById(ctx *gin.Context) {
|
||
|
var id = ctx.Param("id")
|
||
|
if utf8.RuneCountInString(id) != 32 {
|
||
|
response.New(ctx).SetMsg("参数错误").Fail()
|
||
|
return
|
||
|
}
|
||
|
// 删除数据
|
||
|
if err := aiAssistantService.DeleteById(id); err != nil {
|
||
|
response.New(ctx).SetMsg("删除失败").SetError(err).Fail()
|
||
|
} else {
|
||
|
response.New(ctx).SetMsg("删除成功").Success()
|
||
|
}
|
||
|
}
|