archive.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/admin/main/search/dao"
  6. "go-common/app/admin/main/search/model"
  7. "go-common/library/ecode"
  8. )
  9. // ArchiveCheck gets archive check.
  10. func (s *Service) ArchiveCheck(c context.Context, sp *model.ArchiveCheckParams) (res *model.SearchResult, err error) {
  11. if res, err = s.dao.ArchiveCheck(c, sp); err != nil {
  12. dao.PromError(fmt.Sprintf("es:%s 搜索archivecheck失败", sp.Bsp.AppID), "s.dao.SearchArchiveCheck(%v) error(%v) ", sp, err)
  13. err = ecode.SearchArchiveCheckFailed
  14. }
  15. return
  16. }
  17. // Video gets video relation.
  18. func (s *Service) Video(c context.Context, sp *model.VideoParams) (res *model.SearchResult, err error) {
  19. if res, err = s.dao.Video(c, sp); err != nil {
  20. dao.PromError(fmt.Sprintf("es:%s 搜索video失败", sp.Bsp.AppID), "s.dao.Video(%v) error(%v) ", sp, err)
  21. err = ecode.SearchVideoFailed
  22. }
  23. return
  24. }
  25. // TaskQa .
  26. func (s *Service) TaskQa(c context.Context, sp *model.TaskQa) (res *model.SearchResult, err error) {
  27. if res, err = s.dao.TaskQa(c, sp); err != nil {
  28. dao.PromError(fmt.Sprintf("es:%s 搜索TaskQa失败", sp.Bsp.AppID), "s.dao.TaskQa(%v) error(%v) ", sp, err)
  29. err = ecode.SearchVideoFailed
  30. }
  31. return
  32. }
  33. // ArchiveCommerce .
  34. func (s *Service) ArchiveCommerce(c context.Context, sp *model.ArchiveCommerce) (res *model.SearchResult, err error) {
  35. if res, err = s.dao.ArchiveCommerce(c, sp); err != nil {
  36. dao.PromError(fmt.Sprintf("es:%s 搜索ArchiveCommerce失败", sp.Bsp.AppID), "s.dao.TaskQa(%v) error(%v) ", sp, err)
  37. err = ecode.SearchVideoFailed
  38. }
  39. return
  40. }