feed.go 560 B

1234567891011121314151617181920212223242526
  1. package controller
  2. import (
  3. "github.com/RaymondCode/simple-demo/api"
  4. "github.com/RaymondCode/simple-demo/dao"
  5. "github.com/gin-gonic/gin"
  6. "net/http"
  7. "time"
  8. )
  9. type FeedResponse struct {
  10. api.Response
  11. VideoList []api.Video `json:"video_list,omitempty"`
  12. NextTime int64 `json:"next_time,omitempty"`
  13. }
  14. // Feed same demo video list for every request
  15. func Feed(c *gin.Context) {
  16. c.JSON(http.StatusOK, FeedResponse{
  17. Response: api.Response{StatusCode: 0},
  18. //VideoList: DemoVideos,
  19. VideoList: dao.GetList(),
  20. NextTime: time.Now().Unix(),
  21. })
  22. }