admin.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package services
  2. import (
  3. "hongze/hongze_cygx/models"
  4. "hongze/hongze_cygx/utils"
  5. )
  6. func GetAdminMobileMap() (mapItem map[string]string, err error) {
  7. adminList, e := models.GetAdminByRole()
  8. if e != nil {
  9. err = e
  10. return
  11. }
  12. mapMobile := make(map[string]string)
  13. for _, v := range adminList {
  14. mapMobile[v.Mobile] = v.Mobile
  15. }
  16. mapItem = mapMobile
  17. return
  18. }
  19. func GetActivityCcustomerTypeList() (mapItem map[int]string, err error) {
  20. list, e := models.GetActivityCcustomerTypeList()
  21. if e != nil {
  22. err = e
  23. return
  24. }
  25. mapUserType := make(map[int]string)
  26. for _, v := range list {
  27. mapUserType[v.CustomerTypeId] = v.PermissionValue
  28. }
  29. mapUserType[0] = "0"
  30. mapItem = mapUserType
  31. return
  32. }
  33. // GetRaiAdminMobileMap 获取权益内部人员手机号
  34. func GetRaiAdminMobileMap() (mapItem map[string]string) {
  35. var err error
  36. defer func() {
  37. if err != nil {
  38. go utils.SendAlarmMsg("获取权益内部人员手机号失败 ErrMsg:"+err.Error(), 2)
  39. }
  40. }()
  41. adminList, e := models.GetRaiAdmin()
  42. if e != nil {
  43. err = e
  44. return
  45. }
  46. mapMobile := make(map[string]string)
  47. for _, v := range adminList {
  48. mapMobile[v.Mobile] = v.Mobile
  49. }
  50. mapItem = mapMobile
  51. return
  52. }
  53. // 根据手机号判断是否属于权益
  54. func GetBelongingRai(mobile string) (isBelong bool) {
  55. mapItem := GetRaiAdminMobileMap()
  56. if mapItem[mobile] != "" {
  57. isBelong = true
  58. }
  59. return
  60. }