elec.go 917 B

123456789101112131415161718192021222324252627282930313233
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/web/model"
  5. arcmdl "go-common/app/service/main/archive/api"
  6. "go-common/app/service/main/archive/model/archive"
  7. "go-common/library/ecode"
  8. "go-common/library/log"
  9. )
  10. // ElecShow elec show.
  11. func (s *Service) ElecShow(c context.Context, mid, aid, loginID int64) (rs *model.ElecShow, err error) {
  12. var arcReply *arcmdl.ArcReply
  13. if arcReply, err = s.arcClient.Arc(c, &arcmdl.ArcRequest{Aid: aid}); err != nil {
  14. log.Error("s.arcClient.Arc(%d) error(%v)", aid, err)
  15. return
  16. }
  17. arc := arcReply.Arc
  18. if arc.Copyright != int32(archive.CopyrightOriginal) || !arc.IsNormal() {
  19. err = ecode.ElecDenied
  20. return
  21. }
  22. if _, ok := s.elecShowTypeIds[arc.TypeID]; !ok {
  23. err = ecode.ElecDenied
  24. return
  25. }
  26. if rs, err = s.dao.ElecShow(c, mid, aid, loginID); err != nil {
  27. log.Error("s.dao.ElecShow(%d,%d,%d) error(%v)", mid, aid, loginID, err)
  28. }
  29. return
  30. }