package services import ( "fmt" "hongze/hongze_cygx/models" "hongze/hongze_cygx/utils" ) func init11() { var condition string var pars []interface{} list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, 0, 9999) if tmpErr != nil { fmt.Println(tmpErr) return } for _, v := range list { fmt.Println(v.UserId) UdpateYanxuanSpecialauthorArticleNum(v.UserId) } } func init8882228() { var condition string var pars []interface{} list, tmpErr := models.GetYanxuanSpecialList(0, condition, pars, 0, 99999) fmt.Println(len(list)) fmt.Println(tmpErr) for _, v := range list { fmt.Println(v.Id) EsAddYanxuanSpecial(v.Id) } } func init77() { var condition string var pars []interface{} //condition = " AND is_del = 0 AND company_id > 1 AND article_id IN (SELECT article_id FROM cygx_article) " //total, err := models.GetCygxArticleHistoryRecordAllCountBycondition(condition, pars) // //if err != nil { // fmt.Println(err) // return //} //for i := 0; i <= total/2000; i++ { // allList, err := models.GetCygxArticleHistoryRecordAllList(condition, pars, 2000*i, 2000) // if err != nil { // fmt.Println("GetCygxArticleHistoryRecordByCompanyListNew Err:", err.Error()) // // } // var items []*models.CygxArticleAndYanxuanRecord // fmt.Println(len(allList)) // for _, v := range allList { // item := new(models.CygxArticleAndYanxuanRecord) // item.SourceId = v.ArticleId // item.Source = utils.CYGX_OBJ_ARTICLE // item.UserId = v.UserId // item.RealName = v.RealName // item.Mobile = v.Mobile // item.Email = v.Email // item.CompanyId = v.CompanyId // item.CompanyName = v.CompanyName // item.CompanyId = v.CompanyId // item.CreateTime = v.CreateTime // item.ModifyTime = v.ModifyTime // item.StopTime = v.StopTime // // if v.Source == "CELUE" { // item.RegisterPlatform = 3 // } else if v.Source == "WEB" { // item.RegisterPlatform = 2 // } else { // item.RegisterPlatform = 1 // } // // items = append(items, item) // } // // err = models.AddCygxArticleAndYanxuanRecordMulti(items) // if err != nil { // fmt.Println(err) // } // //} condition = " AND yanxuan_special_id IN (SELECT id FROM cygx_yanxuan_special ) " list, err := models.GetCygxYanxuanSpecialRecordRespList(condition, pars, 0, 99999) if err != nil { fmt.Println("GetCygxArticleHistoryRecordByCompanyListNew Err:", err.Error()) } var items []*models.CygxArticleAndYanxuanRecord fmt.Println(len(list)) for _, v := range list { item := new(models.CygxArticleAndYanxuanRecord) item.SourceId = v.YanxuanSpecialId item.Source = utils.CYGX_OBJ_YANXUANSPECIAL item.UserId = v.UserId item.RealName = v.RealName item.Mobile = v.Mobile item.Email = v.Email item.CompanyId = v.CompanyId item.CompanyName = v.CompanyName item.CompanyId = v.CompanyId item.CreateTime = v.CreateTime item.ModifyTime = v.ModifyTime item.StopTime = v.StopTime item.RegisterPlatform = v.RegisterPlatform items = append(items, item) } fmt.Println(len(items)) //return err = models.AddCygxArticleAndYanxuanRecordMulti(items) if err != nil { fmt.Println(err) } } // 更新文章收藏数量 func initcc() { var condition string var pars []interface{} list, e := models.GetYanxuanSpecialListBycondition(condition, pars, 0, 9999) if e != nil && e.Error() != utils.ErrNoRow() { fmt.Println(e) return } for _, v := range list { fmt.Println(v.Id) UdpateYanxuanSpecialCollect(v.Id) } } // 更新作者粉丝数量 func initFansNum() { var condition string var pars []interface{} list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, 0, 9999) if tmpErr != nil { fmt.Println(tmpErr) return } for _, v := range list { fmt.Println(v.UserId) UdpateYanxuanSpecialFansNum(v.UserId) } } // 专栏Pv func initPv() { var condition string var pars []interface{} list, tmpErr := models.GetYanxuanSpecialList(0, condition, pars, 0, 99999) fmt.Println(len(list)) fmt.Println(tmpErr) for _, v := range list { condition = "" pars = make([]interface{}, 0) condition = " AND company_id != 16 AND user_id > 0 AND yanxuan_special_id = ? " pars = append(pars, v.Id) totalYanxuanSpecial, err := models.GetCygxYanxuanSpecialRecordCount(condition, pars) if err != nil { fmt.Println(err) return } totalYanxuanSpecialUv, err := models.GetCygxYanxuanSpecialRecordCountGroup(condition, pars) if err != nil { fmt.Println(err) return } fmt.Println(totalYanxuanSpecial, "____", totalYanxuanSpecialUv) err = models.UpdateYanxuanSpecialPvNUm(totalYanxuanSpecial, v.Id) if err != nil { fmt.Println(err) return } err = models.UpdateYanxuanSpecialUvUm(totalYanxuanSpecialUv, v.Id) if err != nil { fmt.Println(err) return } } } // 作者Pv func inituser() { var condition string var pars []interface{} list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, 0, 9999) fmt.Println(len(list)) fmt.Println(tmpErr) for _, v := range list { condition = "" pars = make([]interface{}, 0) condition = " AND company_id != 16 AND user_id > 0 AND yanxuan_special_id IN ( SELECT id FROM cygx_yanxuan_special WHERE user_id = ? ) " pars = append(pars, v.UserId) totalYanxuanSpecial, err := models.GetCygxYanxuanSpecialRecordCount(condition, pars) if err != nil { fmt.Println(err) return } totalYanxuanSpecialUv, err := models.GetCygxYanxuanSpecialRecordCountGroup(condition, pars) if err != nil { fmt.Println(err) return } fmt.Println(totalYanxuanSpecial, "____", totalYanxuanSpecialUv) err = models.UpdateYanxuanSpecialauthorPvNUm(totalYanxuanSpecial, v.UserId) if err != nil { fmt.Println(err) return } err = models.UpdateYanxuanSpecialauthorUvUm(totalYanxuanSpecialUv, v.UserId) if err != nil { fmt.Println(err) return } } } func initbug111() { var condition string var pars []interface{} condition = " AND company_id = 5593 AND mobile != '' GROUP BY mobile ORDER BY mobile DESC LIMIT 0,5000 " signUpDetailList, err := models.GetSignupDetailList(condition, pars) if err != nil && err.Error() != utils.ErrNoRow() { fmt.Println(err) return } var mobiles []string for _, v := range signUpDetailList { mobiles = append(mobiles, v.Mobile) } listUser, e := models.GetWxUserByMobiles(mobiles) if e != nil { fmt.Println(e) return } mapMobile := make(map[string]int) var itemsUpdate []*models.CygxActivitySignupDetail for _, v := range listUser { if v.Mobile == "" { continue } mapMobile[v.Mobile] = v.UserId var itemDetail = new(models.CygxActivitySignupDetail) itemDetail.Mobile = v.Mobile itemDetail.UserId = v.UserId itemsUpdate = append(itemsUpdate, itemDetail) } fmt.Println(len(itemsUpdate)) err = models.UpdateActivitySignupDetailMultiUserId(itemsUpdate) if err != nil { fmt.Println(err) return } }