MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / DeleteSelf

Function DeleteSelf

controller/user.go:597–619  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

595}
596
597func 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
621func CreateUser(c *gin.Context) {
622 var user model.User

Callers

nothing calls this directly

Calls 3

GetUserByIdFunction · 0.92
DeleteUserByIdFunction · 0.92
ApiErrorFunction · 0.92

Tested by

no test coverage detected