完善删除图标功能

This commit is contained in:
Sun
2023-11-10 13:02:27 +08:00
parent 211c3071dc
commit 0a81db157b
6 changed files with 49 additions and 16 deletions
+17
View File
@@ -98,3 +98,20 @@ func (a *ItemIcon) GetListByGroupId(c *gin.Context) {
apiReturn.SuccessListData(c, itemIcons, 0)
}
func (a *ItemIcon) Deletes(c *gin.Context) {
req := commonApiStructs.RequestDeleteIds[uint]{}
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
apiReturn.ErrorParamFomat(c, err.Error())
return
}
userInfo, _ := base.GetCurrentUserInfo(c)
if err := global.Db.Debug().Delete(&models.ItemIcon{}, "id in ? AND user_id=?", req.Ids, userInfo.ID).Error; err != nil {
apiReturn.ErrorDatabase(c, err.Error())
return
}
apiReturn.Success(c)
}