read.go 513 B

123456789101112131415161718192021222324
  1. package service
  2. import (
  3. "context"
  4. "go-common/library/ecode"
  5. )
  6. // ReadPing 处理用户阅读心跳
  7. func (s *Service) ReadPing(c context.Context, buvid string, aid int64, mid int64, ip string, cur int64, source string) (err error) {
  8. var last int64
  9. if last, err = s.dao.GetsetReadPing(c, buvid, aid, cur); err != nil {
  10. err = ecode.RequestErr
  11. return
  12. }
  13. if last != 0 {
  14. return
  15. }
  16. if s.dao.AddReadPingSet(c, buvid, aid, mid, ip, cur, source); err != nil {
  17. err = ecode.RequestErr
  18. return
  19. }
  20. return
  21. }