package roadshow import ( "context" "hongze/hongze_task/models/roadshow" "hongze/hongze_task/utils" "sync" "time" ) var lock sync.Mutex func ModifyRsCalendarResearcherStatus(cont context.Context) (err error) { lock.Lock() nowDate := time.Now().Format(utils.FormatDate) nowTime := time.Now().Format(utils.FormatTime) list, err := roadshow.GetRsCalendarResearcher(nowDate, nowTime) if err != nil { return err } for _, v := range list { err = roadshow.ModifyRsCalendarResearcherStatus(v.RsCalendarResearcherId) if err != nil { return err } } mattersList, err := roadshow.GetRsMatters(nowDate, nowTime) if err != nil { return err } for _, v := range mattersList { err = roadshow.ModifyRsMattersStatus(v.RsMattersId) if err != nil { return err } } lock.Unlock() return err }