resource.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/web/model"
  5. resmdl "go-common/app/service/main/resource/model"
  6. "go-common/library/log"
  7. )
  8. const (
  9. _kvID = 2326
  10. )
  11. var _emptyAssi = make([]*model.Kv, 0)
  12. // Kv get baidu kv
  13. func (s *Service) Kv(c context.Context) (res []*model.Kv, err error) {
  14. var tmp *resmdl.Resource
  15. if tmp, err = s.res.Resource(c, &resmdl.ArgRes{ResID: _kvID}); err != nil {
  16. log.Error("s.res.Resource(%d) error(%v)", _kvID, err)
  17. return
  18. }
  19. if len(tmp.Assignments) == 0 {
  20. res = _emptyAssi
  21. return
  22. }
  23. for _, assi := range tmp.Assignments {
  24. res = append(res, &model.Kv{ID: assi.ID, Name: assi.Name, Pic: assi.Pic, URL: assi.URL, ResID: assi.ResID, STime: assi.STime, ETime: assi.STime})
  25. }
  26. return
  27. }
  28. // CmtBox get live dm box
  29. func (s *Service) CmtBox(c context.Context, id int64) (res *resmdl.Cmtbox, err error) {
  30. if res, err = s.res.Cmtbox(c, &resmdl.ArgCmtbox{ID: id}); err != nil {
  31. log.Error("s.res.Cmtbox(%d) error(%v)", id, err)
  32. }
  33. return
  34. }
  35. // AbServer get ab server info.
  36. func (s *Service) AbServer(c context.Context, mid int64, platform int, channel, buvid string) (data model.AbServer, err error) {
  37. return s.dao.AbServer(c, mid, platform, channel, buvid)
  38. }