user.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package services
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "hongze/hongze_yb_en_api/models/english_report_email"
  5. )
  6. type LoginReq struct {
  7. Account string `description:"账号"`
  8. CountryCode string `description:"区号"`
  9. Type int `description:"类型 1:邮箱 2:手机"`
  10. Password string `description:"密码"`
  11. }
  12. type LoginResp struct {
  13. Authorization string
  14. AdminName string `description:"系统用户名称"`
  15. RealName string `description:"系统用户姓名"`
  16. RoleName string `description:"角色名称"`
  17. RoleTypeCode string `description:"角色类型编码"`
  18. SysRoleTypeCode string `description:"角色类型编码"`
  19. AdminId int `description:"系统用户id"`
  20. ProductName string `description:"产品名称:admin,ficc,权益"`
  21. Authority int `description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,4:ficc销售组长"`
  22. }
  23. type RegisterReq struct {
  24. Password string
  25. Name string //客户名称
  26. CompanyName string //公司名称
  27. Email string //邮箱地址
  28. SmsCode string //验证码
  29. }
  30. type ModifyPwdReq struct {
  31. OldPwd string `description:"旧密码"`
  32. NewPwd string `description:"新密码"`
  33. }
  34. type UserInfo struct {
  35. english_report_email.Email
  36. LoginToken string
  37. }
  38. // GetInfoByClaims 从Claims中获取用户信息
  39. func GetInfoByClaims(c *gin.Context) (userInfo UserInfo) {
  40. //获取jwt数据失败
  41. claims, exist := c.Get("userInfo")
  42. if exist {
  43. userInfo = claims.(UserInfo)
  44. }
  45. return
  46. }
  47. type BindMobileReq struct {
  48. CountryCode string `description:"区号"`
  49. Mobile string
  50. SmsCode string //验证码
  51. }
  52. type ForgetPwdReq struct {
  53. Type int `description:"类型 1:邮箱 2:手机"`
  54. CountryCode string `description:"区号"`
  55. Account string `description:"账号"`
  56. Password string `description:"密码"`
  57. SmsCode string
  58. }
  59. type ModifyMobile struct {
  60. CountryCode string `description:"区号"`
  61. OldMobile string
  62. NewMobile string
  63. SmsCode string
  64. }