用户注销后禁止再次注册

This commit is contained in:
CaIon
2023-12-27 00:19:11 +08:00
parent 3c52a0991f
commit ad6842da7f
3 changed files with 99 additions and 53 deletions

View File

@@ -152,6 +152,21 @@ func Register(c *gin.Context) {
return
}
}
exist, err := model.CheckUserExistOrDeleted(user.Username, user.Email)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
})
return
}
if exist {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "用户名已存在,或已注销",
})
return
}
affCode := user.AffCode // this code is the inviter's code, not the user's own code
inviterId, _ := model.GetUserIdByAffCode(affCode)
cleanUser := model.User{
@@ -525,7 +540,7 @@ func DeleteUser(c *gin.Context) {
})
return
}
err = model.DeleteUserById(id)
err = model.HardDeleteUserById(id)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": true,