package services

import (
	"fmt"
	"hongze/hongze_cygx/models"
	"time"
)

func init213() {
	var condition string
	var pars []interface{}
	var err error
	condition += `AND do_fail_type = 0 AND  is_meeting = 0`
	listSignup, err := models.GetActivitySignuListByUser(condition, pars)
	if err != nil {
		fmt.Println(err)
	}
	var items []*models.CygxActivitySignupBreak
	var numk int
	for _, v := range listSignup {
		numk++
		item := new(models.CygxActivitySignupBreak)
		item.UserId = v.UserId
		item.ActivityId = v.ActivityId
		item.CreateTime = time.Now()
		item.Mobile = v.Mobile
		item.Email = v.Email
		item.CompanyId = v.CompanyId
		item.CompanyName = v.CompanyName
		item.RealName = v.RealName
		item.SellerName = v.SellerName
		items = append(items, item)
		if numk%5000 == 0 {
			fmt.Println(v)
			_, err = models.AddCygxActivitySignupBreakList(items)
			if err != nil {
				fmt.Println(err)
			}
			items = make([]*models.CygxActivitySignupBreak, 0)
			numk = 0
		}
	}
	if len(items) > 0 {
		_, err = models.AddCygxActivitySignupBreakList(items)
	}
	fmt.Println(len(listSignup))
}
