config.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. }
  46. func init1231() {
  47. var condition string
  48. var pars []interface{}
  49. condition += ` AND t.id < 10000 `
  50. list, err := models.GetCygxActivitySpecialTripListinit(condition, pars)
  51. if err != nil {
  52. fmt.Println(err)
  53. return
  54. }
  55. for _, v := range list {
  56. //流水记录表
  57. itemBill := new(models.CygxActivitySpecialTripBill)
  58. itemBill.UserId = v.UserId
  59. itemBill.ActivityId = v.ActivityId
  60. itemBill.CreateTime = v.CreateTime
  61. itemBill.Mobile = v.Mobile
  62. itemBill.Email = v.Email
  63. itemBill.CompanyId = v.CompanyId
  64. itemBill.CompanyName = v.CompanyName
  65. itemBill.RealName = v.RealName
  66. itemBill.Source = 1
  67. itemBill.DoType = 1
  68. itemBill.BillDetailed = -1 // 流水减一
  69. itemBill.RegisterPlatform = 1
  70. itemBill.ChartPermissionId = v.ChartPermissionId
  71. go models.AddCygxActivitySpecialTripBill(itemBill)
  72. }
  73. }