修复不能删除注销用户的问题

This commit is contained in:
CaIon
2023-12-27 16:46:18 +08:00
parent 14592f9758
commit e8bcf60f0a
2 changed files with 19 additions and 3 deletions

View File

@@ -647,7 +647,7 @@ func ManageUser(c *gin.Context) {
Username: req.Username,
}
// Fill attributes
model.DB.Where(&user).First(&user)
model.DB.Unscoped().Where(&user).First(&user)
if user.Id == 0 {
c.JSON(http.StatusOK, gin.H{
"success": false,
@@ -683,7 +683,7 @@ func ManageUser(c *gin.Context) {
})
return
}
if err := user.Delete(); err != nil {
if err := user.HardDelete(); err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),