model.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package app
  2. type Response struct {
  3. ApiBaseOutputHead ApiBaseOutputHead `json:"apiBaseOutputHead"`
  4. // 数据集
  5. Data interface{} `json:"data"`
  6. }
  7. type ApiBaseOutputHead struct {
  8. Code string `json:"code" example:"200"`
  9. Msg string `json:"msg"`
  10. }
  11. type Page struct {
  12. List interface{} `json:"tourList"`
  13. Count int `json:"count"`
  14. PageIndex int `json:"pageIndex"`
  15. PageSize int `json:"pageSize"`
  16. //BrowseTotal int64 `json:"browseTotal"` //浏览总数
  17. //ToGoTotal int64 `json:"toGoTotal"` //意向单总数
  18. }
  19. type UserDynamicPage struct {
  20. List interface{} `json:"tourList"`
  21. Count int `json:"count"`
  22. PageIndex int `json:"pageIndex"`
  23. PageSize int `json:"pageSize"`
  24. BrowseTotal int64 `json:"browseTotal"` //浏览总数
  25. ToGoTotal int64 `json:"toGoTotal"` //意向单总数
  26. }
  27. type PageResponse struct {
  28. ApiBaseOutputHead ApiBaseOutputHead `json:"apiBaseOutputHead"`
  29. //Data interface{} `json:"data"`
  30. // 代码
  31. //Code int `json:"code" example:"200"`
  32. // 数据集
  33. Data Page `json:"tourData"`
  34. // 消息
  35. //Msg string `json:"msg"`
  36. }
  37. type UserDynamicPageResponse struct {
  38. ApiBaseOutputHead ApiBaseOutputHead `json:"apiBaseOutputHead"`
  39. //Data interface{} `json:"data"`
  40. // 代码
  41. //Code int `json:"code" example:"200"`
  42. // 数据集
  43. Data UserDynamicPage `json:"tourData"`
  44. // 消息
  45. //Msg string `json:"msg"`
  46. }
  47. func (res *Response) ReturnOK() *Response {
  48. res.ApiBaseOutputHead.Code = "200"
  49. return res
  50. }
  51. func (res *Response) ReturnError(code string) *Response {
  52. res.ApiBaseOutputHead.Code = code
  53. return res
  54. }
  55. func (res *PageResponse) ReturnOK() *PageResponse {
  56. res.ApiBaseOutputHead.Code = "200"
  57. return res
  58. }
  59. func (res *UserDynamicPageResponse) ReturnOK() *UserDynamicPageResponse {
  60. res.ApiBaseOutputHead.Code = "200"
  61. return res
  62. }