rpc2.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package server
  2. import (
  3. "go-common/app/service/main/archive/api"
  4. "go-common/app/service/main/archive/model/archive"
  5. "go-common/library/net/rpc/context"
  6. )
  7. // Types2 get all types
  8. func (r *RPC) Types2(c context.Context, a *struct{}, res *map[int16]*archive.ArcType) (err error) {
  9. *res = r.s.AllTypes(c)
  10. return
  11. }
  12. // Videoshot2 get vidoshot info data.
  13. func (r *RPC) Videoshot2(c context.Context, a *archive.ArgCid2, res *archive.Videoshot) (err error) {
  14. var (
  15. v *archive.Videoshot
  16. )
  17. if v, err = r.s.Videoshot(c, a.Aid, a.Cid); err == nil {
  18. *res = *v
  19. }
  20. return
  21. }
  22. // UpCount2 up count.
  23. func (r *RPC) UpCount2(c context.Context, a *archive.ArgUpCount2, count *int) (err error) {
  24. *count, err = r.s.UpperCount(c, a.Mid)
  25. return
  26. }
  27. // UpsPassed2 ups pass aid and ptime
  28. func (r *RPC) UpsPassed2(c context.Context, a *archive.ArgUpsArcs2, res *map[int64][]*archive.AidPubTime) (err error) {
  29. *res, err = r.s.UppersAidPubTime(c, a.Mids, a.Pn, a.Ps)
  30. return
  31. }
  32. // UpVideo2 up video by aid & cid.
  33. func (r *RPC) UpVideo2(c context.Context, a *archive.ArgVideo2, res *struct{}) (err error) {
  34. return r.s.UpVideo(c, a.Aid, a.Cid)
  35. }
  36. // DelVideo2 delete video by aid & cid.
  37. func (r *RPC) DelVideo2(c context.Context, a *archive.ArgVideo2, res *struct{}) (err error) {
  38. return r.s.DelVideo(c, a.Aid, a.Cid)
  39. }
  40. // Description2 get description by aid.
  41. func (r *RPC) Description2(c context.Context, a *archive.ArgAid, reDes *string) (err error) {
  42. *reDes, err = r.s.Description(c, a.Aid)
  43. return
  44. }
  45. // RanksTopCount2 top region count.
  46. func (r *RPC) RanksTopCount2(c context.Context, a *archive.ArgRankTopsCount2, res *map[int16]int) (err error) {
  47. *res, err = r.s.RegionTopCount(c, a.ReIDs)
  48. return
  49. }
  50. // ArcsStat2 archive stat.
  51. // func (r *RPC) ArcsStat2(c context.Context, a *archive.ArgAids2, res *map[int64]*archive.Stat) (err error) {
  52. // *res, err = r.s.Stats(c, a.Aids)
  53. // return
  54. // }
  55. // ArcCache2 update archive cache.
  56. func (r *RPC) ArcCache2(c context.Context, a *archive.ArgCache2, res *struct{}) (err error) {
  57. err = r.s.CacheUpdate(c, a.Aid, a.Tp, a.OldMid)
  58. return
  59. }
  60. // ArcFieldCache2 update archive by field changed.
  61. func (r *RPC) ArcFieldCache2(c context.Context, a *archive.ArgFieldCache2, res *struct{}) (err error) {
  62. err = r.s.FieldCacheUpdate(c, a.Aid, a.OldTypeID, a.TypeID)
  63. return
  64. }
  65. // SetStat2 set all stat cache(redis)
  66. func (r *RPC) SetStat2(c context.Context, a *api.Stat, res *struct{}) (err error) {
  67. err = r.s.SetStat(c, a)
  68. return
  69. }