前端传递的数据 :
后端的代码:
func Delete(c *gin.Context) {
var idInts []int
if err := c.BindJSON(&idInts); err != nil {
response.FailWithMessage("数据绑定失败", c)
return
}
var home system.SysHome
if err := global.GVA_DB.Where("id IN (?)", idInts).Delete(&home).Error; err != nil {
response.FailWithMessage("删除失败", c)
return
}
// 如果没有错误,返回成功响应
response.OkWithDetailed(gin.H{}, "删除成功", c)
}