修改初始返回为最新的视频列表,修改返回delay的数据信息。
This commit is contained in:
parent
ec9fbc940b
commit
08e5118d80
|
|
@ -59,9 +59,10 @@ func FindVideoByID(id, auth_id int) Video {
|
|||
return video
|
||||
}
|
||||
|
||||
// 根据用户id查找视频列表,返回最新30条
|
||||
func FindVideoListsByAuthID(auth_id int) []Video {
|
||||
var videos []Video
|
||||
DB.Debug().Where("auth_id = ?", auth_id).Where("isdelete = ?", 0).Limit(30).Find(&videos)
|
||||
DB.Debug().Where("auth_id = ? and isdelete =? ", auth_id, 0).Order("create_time DESC").Limit(30).Find(&videos)
|
||||
return videos
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
"videoplayer/service"
|
||||
)
|
||||
|
|
@ -174,9 +175,9 @@ func DelayVideo(c *gin.Context) {
|
|||
cnt = service.DelayVideo(delay_req.ID, int(id.(float64)), delay_req.Day)
|
||||
}
|
||||
if cnt == 0 {
|
||||
c.JSON(http.StatusOK, gin.H{"code": 1, "data": "延迟失败影响数据", "message": "failed,cnt:" + string(cnt)})
|
||||
c.JSON(http.StatusOK, gin.H{"code": 1, "data": "延迟失败影响数据", "message": "failed,cnt:" + strconv.Itoa(cnt)})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "data": "延迟成功,cnt=" + string(cnt), "message": "success cnt:" + string(cnt)})
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "data": "延迟成功,影响记录:" + strconv.Itoa(cnt), "message": "success cnt:" + strconv.Itoa(cnt)})
|
||||
}
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": 1, "message": "failed"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue