official.go 568 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package model
  2. // official role const.
  3. const (
  4. OfficialRoleUnauth = iota
  5. OfficialRoleUp
  6. OfficialRoleIdentify
  7. OfficialRoleBusiness
  8. OfficialRoleGov
  9. OfficialRoleMedia
  10. OfficialRoleOther
  11. )
  12. // Official is.
  13. type Official struct {
  14. Role int8 `json:"role"`
  15. Title string `json:"title"`
  16. Desc string `json:"desc"`
  17. }
  18. // FromCert is.
  19. func FromCert(v *MemberVerify) Official {
  20. of := Official{}
  21. switch v.Type {
  22. case -1:
  23. of.Role = 0
  24. of.Title = ""
  25. case 0:
  26. of.Role = 2
  27. of.Title = v.Desc
  28. case 1:
  29. of.Role = 3
  30. of.Title = v.Desc
  31. }
  32. of.Desc = ""
  33. return of
  34. }