123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- 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
- }
- }
|