archive.go 834 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/openplatform/article/dao"
  5. "go-common/app/service/main/archive/api"
  6. "go-common/app/service/main/archive/model/archive"
  7. "go-common/library/log"
  8. )
  9. // Archives gets archives by aids.
  10. func (s *Service) Archives(c context.Context, aids []int64, ip string) (arcs map[int64]*api.Arc, err error) {
  11. arg := &archive.ArgAids2{
  12. Aids: aids,
  13. RealIP: ip,
  14. }
  15. if arcs, err = s.arcRPC.Archives3(c, arg); err != nil {
  16. dao.PromError("rpc:获取视频稿件信息")
  17. log.Error("s.arcRPC.Archives(%v) error(%+v)", aids, err)
  18. return
  19. }
  20. fmtArcs(arcs)
  21. return
  22. }
  23. func fmtArcs(arcs map[int64]*api.Arc) {
  24. for id, v := range arcs {
  25. if !v.IsNormal() {
  26. delete(arcs, id)
  27. continue
  28. }
  29. // 会员可见 不展示播放数
  30. if v.Access >= 10000 {
  31. v.Stat.View = -1
  32. }
  33. }
  34. }