go-wxhelper/api/admin/robot/delete.go

26 lines
569 B
Go
Raw Normal View History

package robot
import (
"github.com/gin-gonic/gin"
"unicode/utf8"
"wechat-robot/pkg/response"
robotService "wechat-robot/service/robot"
)
// DeleteById
// @description: 删除机器人
// @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 := robotService.DeleteById(id); err != nil {
response.New(ctx).SetMsg("删除失败").SetError(err).Fail()
} else {
response.New(ctx).SetMsg("删除成功").Success()
}
}