package data import ( "eta/eta_task/models/data_manage" "fmt" ) // SetChartEdbEndDate 设置图表中,指标的最新日期 func SetChartEdbEndDate() { var err error defer func() { if err != nil { fmt.Println("SetChartEdbEndDate err:" + err.Error()) } }() allList, err := data_manage.GetAllChartInfo() if err != nil { return } allMap := make(map[int]*data_manage.ChartInfo) for _, v := range allList { allMap[v.ChartInfoId] = v } list, err := data_manage.GetChartInfoEdbEndDate() if err != nil { return } for _, sv := range list { if findItem, ok := allMap[sv.ChartInfoId]; ok { if findItem.EdbEndDate != sv.EdbEndDate { err = data_manage.ModifyChartInfoEdbEndDate(sv.ChartInfoId, sv.EdbEndDate) if err != nil { return } } } } }