(c *gin.Context)
| 595 | } |
| 596 | |
| 597 | func DeleteSelf(c *gin.Context) { |
| 598 | id := c.GetInt("id") |
| 599 | user, _ := model.GetUserById(id, false) |
| 600 | |
| 601 | if user.Role == common.RoleRootUser { |
| 602 | c.JSON(http.StatusOK, gin.H{ |
| 603 | "success": false, |
| 604 | "message": "不能删除超级管理员账户", |
| 605 | }) |
| 606 | return |
| 607 | } |
| 608 | |
| 609 | err := model.DeleteUserById(id) |
| 610 | if err != nil { |
| 611 | common.ApiError(c, err) |
| 612 | return |
| 613 | } |
| 614 | c.JSON(http.StatusOK, gin.H{ |
| 615 | "success": true, |
| 616 | "message": "", |
| 617 | }) |
| 618 | return |
| 619 | } |
| 620 | |
| 621 | func CreateUser(c *gin.Context) { |
| 622 | var user model.User |
nothing calls this directly
no test coverage detected