init_10.4.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package services
  2. import (
  3. "fmt"
  4. "hongze/hongze_cygx/models"
  5. "time"
  6. )
  7. func init213() {
  8. var condition string
  9. var pars []interface{}
  10. var err error
  11. condition += `AND do_fail_type = 0 AND is_meeting = 0`
  12. listSignup, err := models.GetActivitySignuListByUser(condition, pars)
  13. if err != nil {
  14. fmt.Println(err)
  15. }
  16. var items []*models.CygxActivitySignupBreak
  17. var numk int
  18. for _, v := range listSignup {
  19. numk++
  20. item := new(models.CygxActivitySignupBreak)
  21. item.UserId = v.UserId
  22. item.ActivityId = v.ActivityId
  23. item.CreateTime = time.Now()
  24. item.Mobile = v.Mobile
  25. item.Email = v.Email
  26. item.CompanyId = v.CompanyId
  27. item.CompanyName = v.CompanyName
  28. item.RealName = v.RealName
  29. item.SellerName = v.SellerName
  30. items = append(items, item)
  31. if numk%5000 == 0 {
  32. fmt.Println(v)
  33. _, err = models.AddCygxActivitySignupBreakList(items)
  34. if err != nil {
  35. fmt.Println(err)
  36. }
  37. items = make([]*models.CygxActivitySignupBreak, 0)
  38. numk = 0
  39. }
  40. }
  41. if len(items) > 0 {
  42. _, err = models.AddCygxActivitySignupBreakList(items)
  43. }
  44. fmt.Println(len(listSignup))
  45. }