admin.go 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package controllers
  2. import (
  3. "eta/eta_hub/models"
  4. "eta/eta_hub/models/system"
  5. "eta/eta_hub/utils"
  6. )
  7. // 系统用户
  8. type SysAdminController struct {
  9. BaseAuthController
  10. }
  11. // Add
  12. // @Title 用户详情信息
  13. // @Description 用户详情信息
  14. // @Param request body system.SysuserAddReq true "type json string"
  15. // @Success 200 新增成功
  16. // @router /sysuser/check [get]
  17. func (this *SysAdminController) Detail() {
  18. br := new(models.BaseResponse).Init()
  19. defer func() {
  20. this.Data["json"] = br
  21. this.ServeJSON()
  22. }()
  23. var resp system.UserCheckResp
  24. userCode := this.GetString("authCode")
  25. adminName := utils.DesBase64Decrypt([]byte(userCode), utils.DesKeySalt)
  26. admin, err := system.GetSysUserByAdminName(string(adminName))
  27. if err != nil && err.Error() != utils.ErrNoRow(){
  28. br.Msg = "获取失败"
  29. br.ErrMsg = "获取失败" + err.Error()
  30. return
  31. }
  32. if admin != nil {
  33. resp.IsUser = true
  34. resp.AdminInfo = admin
  35. }
  36. br.Data = resp
  37. br.Ret = 200
  38. br.Msg = "获取成功"
  39. }