init12.8.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package services
  2. import (
  3. "fmt"
  4. "hongze/hongze_cygx/models"
  5. "hongze/hongze_cygx/utils"
  6. )
  7. func init11() {
  8. var condition string
  9. var pars []interface{}
  10. list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, 0, 9999)
  11. if tmpErr != nil {
  12. fmt.Println(tmpErr)
  13. return
  14. }
  15. for _, v := range list {
  16. fmt.Println(v.UserId)
  17. UdpateYanxuanSpecialauthorArticleNum(v.UserId)
  18. }
  19. }
  20. func init77() {
  21. var condition string
  22. var pars []interface{}
  23. //condition = " AND is_del = 0 AND company_id > 1 AND article_id IN (SELECT article_id FROM cygx_article) "
  24. //total, err := models.GetCygxArticleHistoryRecordAllCountBycondition(condition, pars)
  25. //
  26. //if err != nil {
  27. // fmt.Println(err)
  28. // return
  29. //}
  30. //for i := 0; i <= total/2000; i++ {
  31. // allList, err := models.GetCygxArticleHistoryRecordAllList(condition, pars, 2000*i, 2000)
  32. // if err != nil {
  33. // fmt.Println("GetCygxArticleHistoryRecordByCompanyListNew Err:", err.Error())
  34. //
  35. // }
  36. // var items []*models.CygxArticleAndYanxuanRecord
  37. // fmt.Println(len(allList))
  38. // for _, v := range allList {
  39. // item := new(models.CygxArticleAndYanxuanRecord)
  40. // item.SourceId = v.ArticleId
  41. // item.Source = utils.CYGX_OBJ_ARTICLE
  42. // item.UserId = v.UserId
  43. // item.RealName = v.RealName
  44. // item.Mobile = v.Mobile
  45. // item.Email = v.Email
  46. // item.CompanyId = v.CompanyId
  47. // item.CompanyName = v.CompanyName
  48. // item.CompanyId = v.CompanyId
  49. // item.CreateTime = v.CreateTime
  50. // item.ModifyTime = v.ModifyTime
  51. // item.StopTime = v.StopTime
  52. //
  53. // if v.Source == "CELUE" {
  54. // item.RegisterPlatform = 3
  55. // } else if v.Source == "WEB" {
  56. // item.RegisterPlatform = 2
  57. // } else {
  58. // item.RegisterPlatform = 1
  59. // }
  60. //
  61. // items = append(items, item)
  62. // }
  63. //
  64. // err = models.AddCygxArticleAndYanxuanRecordMulti(items)
  65. // if err != nil {
  66. // fmt.Println(err)
  67. // }
  68. //
  69. //}
  70. condition = " AND yanxuan_special_id IN (SELECT id FROM cygx_yanxuan_special ) "
  71. list, err := models.GetCygxYanxuanSpecialRecordRespList(condition, pars, 0, 99999)
  72. if err != nil {
  73. fmt.Println("GetCygxArticleHistoryRecordByCompanyListNew Err:", err.Error())
  74. }
  75. var items []*models.CygxArticleAndYanxuanRecord
  76. fmt.Println(len(list))
  77. for _, v := range list {
  78. item := new(models.CygxArticleAndYanxuanRecord)
  79. item.SourceId = v.YanxuanSpecialId
  80. item.Source = utils.CYGX_OBJ_YANXUANSPECIAL
  81. item.UserId = v.UserId
  82. item.RealName = v.RealName
  83. item.Mobile = v.Mobile
  84. item.Email = v.Email
  85. item.CompanyId = v.CompanyId
  86. item.CompanyName = v.CompanyName
  87. item.CompanyId = v.CompanyId
  88. item.CreateTime = v.CreateTime
  89. item.ModifyTime = v.ModifyTime
  90. item.StopTime = v.StopTime
  91. item.RegisterPlatform = v.RegisterPlatform
  92. items = append(items, item)
  93. }
  94. fmt.Println(len(items))
  95. //return
  96. err = models.AddCygxArticleAndYanxuanRecordMulti(items)
  97. if err != nil {
  98. fmt.Println(err)
  99. }
  100. }