reply.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "context"
  4. "time"
  5. "go-common/app/job/main/figure/model"
  6. )
  7. // PutReplyInfo handle user reply info chenage message
  8. func (s *Service) PutReplyInfo(c context.Context, info *model.ReplyEvent) (err error) {
  9. switch info.Action {
  10. case model.EventAdd:
  11. // only handle normal state reply
  12. if info.Reply.State == 0 {
  13. s.figureDao.PutReplyAct(c, info.Mid, model.ACColumnReplyAct, int64(1))
  14. }
  15. case model.EventLike:
  16. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnReplyLiked, int64(1))
  17. case model.EventLikeCancel:
  18. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnReplyLiked, int64(-1))
  19. case model.EventHate:
  20. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnReplyHate, int64(1))
  21. case model.EventHateCancel:
  22. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnReplyHate, int64(-1))
  23. case model.EventReportDel:
  24. s.figureDao.PutReplyAct(c, info.Report.Mid, model.ACColumnReplyReoprtPassed, int64(1))
  25. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnPublishReplyDeleted, int64(-1))
  26. s.figureDao.SetWaiteUserCache(c, info.Report.Mid, s.figureDao.Version(time.Now()))
  27. case model.EventReportRecover:
  28. s.figureDao.PutReplyAct(c, info.Report.Mid, model.ACColumnReplyReoprtPassed, int64(-1))
  29. s.figureDao.PutReplyAct(c, info.Reply.Mid, model.ACColumnPublishReplyDeleted, int64(1))
  30. s.figureDao.SetWaiteUserCache(c, info.Report.Mid, s.figureDao.Version(time.Now()))
  31. }
  32. return
  33. }