config.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package services
  2. import (
  3. "errors"
  4. "fmt"
  5. "hongze/hongze_cygx/models"
  6. "strconv"
  7. )
  8. // 是否展示限免标签
  9. func GetShowSustainable() (isShowSustainable bool) {
  10. total, err := models.GetShowSustainable()
  11. if err != nil {
  12. fmt.Println("GetShowSustainable Err:", err.Error())
  13. return
  14. }
  15. if total > 0 {
  16. isShowSustainable = true
  17. }
  18. return
  19. }
  20. func GetShowSustainableNew() (isShowSustainable bool, err error) {
  21. total, err := models.GetShowSustainable()
  22. if err != nil {
  23. fmt.Println("GetShowSustainable Err:", err.Error())
  24. return
  25. }
  26. if total > 0 {
  27. isShowSustainable = true
  28. }
  29. return
  30. }
  31. // GetIndustryUserFollowMap 获取用户关注的产业
  32. func GetIndustryUserFollowMap(user *models.WxUserItem) (itemMap map[int]bool, err error) {
  33. condition := ` AND user_id = ` + strconv.Itoa(user.UserId)
  34. listIndustryFllow, e := models.GetCygxIndustryFllowListByUserId(condition)
  35. if e != nil {
  36. err = errors.New("GetCygxIndustryFllowList " + e.Error())
  37. return
  38. }
  39. follwMap := make(map[int]bool)
  40. for _, v := range listIndustryFllow {
  41. follwMap[v.IndustrialManagementId] = true
  42. }
  43. itemMap = follwMap
  44. return
  45. }