calendar.go 816 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package roadshow
  2. import (
  3. "context"
  4. "hongze/hongze_task/models/roadshow"
  5. "hongze/hongze_task/utils"
  6. "sync"
  7. "time"
  8. )
  9. var lock sync.Mutex
  10. func ModifyRsCalendarResearcherStatus(cont context.Context) (err error) {
  11. lock.Lock()
  12. nowDate := time.Now().Format(utils.FormatDate)
  13. nowTime := time.Now().Format(utils.FormatTime)
  14. list, err := roadshow.GetRsCalendarResearcher(nowDate, nowTime)
  15. if err != nil {
  16. return err
  17. }
  18. for _, v := range list {
  19. err = roadshow.ModifyRsCalendarResearcherStatus(v.RsCalendarResearcherId)
  20. if err != nil {
  21. return err
  22. }
  23. }
  24. mattersList, err := roadshow.GetRsMatters(nowDate, nowTime)
  25. if err != nil {
  26. return err
  27. }
  28. for _, v := range mattersList {
  29. err = roadshow.ModifyRsMattersStatus(v.RsMattersId)
  30. if err != nil {
  31. return err
  32. }
  33. }
  34. lock.Unlock()
  35. return err
  36. }