favorite.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package model
  2. import (
  3. arcwar "go-common/app/service/main/archive/api"
  4. )
  5. // FormFav is the form validation for favorites display
  6. type FormFav struct {
  7. AccessKey string `form:"access_key" validate:"required"`
  8. Pn int `form:"pn" default:"1"`
  9. }
  10. // ReqFav is request for favorites function
  11. type ReqFav struct {
  12. MID int64
  13. Pn int
  14. }
  15. // ToReq def.
  16. func (f *FormFav) ToReq(mid int64) *ReqFav {
  17. return &ReqFav{
  18. MID: mid,
  19. Pn: f.Pn,
  20. }
  21. }
  22. // FormFavAct is the form validation for favorite action
  23. type FormFavAct struct {
  24. AccessKey string `form:"access_key" validate:"required"`
  25. AID int64 `form:"aid" validate:"required"`
  26. Action int `form:"action" validate:"min=1,max=2"`
  27. }
  28. // ReqFavAct is request for favorites action ( add/del ) function
  29. type ReqFavAct struct {
  30. MID int64
  31. AID int64 // resource id ( ugc avid )
  32. Action int // 1=add,2=delete
  33. }
  34. // ToReq def.
  35. func (f *FormFavAct) ToReq(mid int64) *ReqFavAct {
  36. return &ReqFavAct{
  37. MID: mid,
  38. AID: f.AID,
  39. Action: f.Action,
  40. }
  41. }
  42. // FavMList def.
  43. type FavMList struct {
  44. Page struct {
  45. Num int `json:"num"`
  46. Size int `json:"size"`
  47. Count int `json:"count"`
  48. } `json:"page"`
  49. List []*arcwar.Arc `json:"list"`
  50. }
  51. // RespFavAct is response strure for favorite actions
  52. type RespFavAct struct {
  53. Code int `json:"code"`
  54. Message string `json:"message"`
  55. }