-
Notifications
You must be signed in to change notification settings - Fork 7
/
feed.go
36 lines (32 loc) · 806 Bytes
/
feed.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* @Author: alexander.huang
* @Date: 2022-05-25 02:53:50
* @Last Modified by: alexander.huang
* @Last Modified time: 2022-05-25 02:53:50
*/
package app
import (
"github.com/Anzz-bot/DouYin_demo/app/common/request"
"github.com/Anzz-bot/DouYin_demo/app/services"
"net/http"
"github.com/Anzz-bot/DouYin_demo/utils"
"github.com/gin-gonic/gin"
"time"
)
func Feed(c *gin.Context) {
var form request.Feed
latestTime := utils.StrToInt64(c.Query("latest_time"))
if latestTime == 0 {
latestTime = time.Now().UnixMilli()
}
token := c.Query("token")
form = request.Feed{
LatestTime: latestTime,
Token: token,
}
if err, feedresponse := services.FeedService.Feed(form); err != nil {
c.JSON(http.StatusBadRequest, feedresponse)
} else {
c.JSON(http.StatusOK, feedresponse)
}
}