package services

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

//10.3版本上线需要更新的数据

func init51111() {
	var condition string
	var pars []interface{}
	var err error
	fmt.Print()
	//处理上周纪要汇总
	condition = ` AND  visible_range = 1  `
	listresearchsummary, err := models.GetReportSelectionListHome(condition, "cygx_minutes_summary", pars, 0, 100000)
	if err != nil {
		fmt.Println(err)
	}
	condition = ` AND source = 'minutessummary'  `
	err = models.DeleteResourceDataList(condition, pars)
	if err != nil {
		fmt.Println(err)
	}
	for _, v := range listresearchsummary {
		go UpdateResourceData(v.ArticleId, "minutessummary", "add", v.PublishDate)
	}

	fmt.Println(listresearchsummary)
}

func init2222() {
	var condition string
	var pars []interface{}
	var err error
	fmt.Print()
	//处理本周纪要汇总
	condition = ` AND  visible_range = 1  `
	listresearchsummary, err := models.GetReportSelectionListHome(condition, "cygx_research_summary", pars, 0, 100000)
	if err != nil {
		fmt.Println(err)
	}
	condition = ` AND source = 'researchsummary'  `
	err = models.DeleteResourceDataList(condition, pars)
	if err != nil {
		fmt.Println(err)
	}
	for _, v := range listresearchsummary {
		go UpdateResourceData(v.ArticleId, "researchsummary", "add", v.PublishDate)
	}

	fmt.Println(listresearchsummary)
}

func init333() {
	var condition string
	var pars []interface{}
	var err error
	fmt.Print()
	//处理晨会精华
	listrMeet, err := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
	if err != nil {
		fmt.Println(err)
	}
	condition = ` AND source = 'meetingreviewchapt'  `
	err = models.DeleteResourceDataList(condition, pars)
	if err != nil {
		fmt.Println(err)
	}
	for _, v := range listrMeet {
		go UpdateResourceData(v.Id, "meetingreviewchapt", "add", v.PublishTime)
	}
	fmt.Println(listrMeet)
}

func init444() {
	listMap, err := models.GetCygxXzsChooseCategoryMapList()
	if err != nil {
		fmt.Println(err)
	}
	mapReport := make(map[int]int)
	for _, v := range listMap {
		mapReport[v.CategoryId] = v.Id
	}

	list, err := models.GetCygxXzsChooseCategoryWhithIdCygxList()
	if err != nil {
		fmt.Println(err)
	}
	for _, v := range list {
		fmt.Println(mapReport[v.CategoryId])
		err = models.UpdateCygxXzsChooseCategory(mapReport[v.CategoryId], v.Id)
		if err != nil {
			fmt.Println(err)
		}
	}
}
