Jelajahi Sumber

Merge branch 'yb/8.0' into debug

hsun 2 tahun lalu
induk
melakukan
c8acb12f99
3 mengubah file dengan 15 tambahan dan 10 penghapusan
  1. 6 5
      controller/community/video.go
  2. 5 4
      models/request/community.go
  3. 4 1
      services/community/video.go

+ 6 - 5
controller/community/video.go

@@ -12,10 +12,11 @@ import (
 // VideoList 视频列表
 // @Tags 视频社区模块
 // @Description 获取视频社区列表
-// @Param page_index	query int false "页码"
-// @Param page_size		query int false "每页数量"
-// @Param Keywords		query string false "只看我的"
-// @Param video_id		query int false "视频ID"
+// @Param page_index			query int false "页码"
+// @Param page_size				query int false "每页数量"
+// @Param keywords				query string false "只看我的"
+// @Param video_id				query int false "视频ID"
+// @Param chart_permission_id	query int false "品种权限ID"
 // @Success 200 {object}
 // @failure 400 {string} string "获取失败"
 // @Router /video/list [get]
@@ -31,7 +32,7 @@ func VideoList(c *gin.Context) {
 	if req.PageSize == 0 {
 		req.PageSize = utils.PageSize20
 	}
-	list, err := community.GetVideoList(req.PageIndex, req.PageSize, req.VideoId, req.Keywords)
+	list, err := community.GetVideoList(req.PageIndex, req.PageSize, req.VideoId, req.ChartPermissionId, req.Keywords)
 	if err != nil {
 		response.FailMsg("获取失败", "VideoList ErrMsg:"+err.Error(), c)
 		return

+ 5 - 4
models/request/community.go

@@ -43,10 +43,11 @@ type CommunityAudioListenLogReq struct {
 }
 
 type VideoListReq struct {
-	PageIndex int    `json:"page_index" form:"page_index"`
-	PageSize  int    `json:"page_size" form:"page_size"`
-	Keywords  string `json:"keywords" form:"keywords"`
-	VideoId   int    `json:"video_id" form:"video_id"`
+	PageIndex         int    `json:"page_index" form:"page_index"`
+	PageSize          int    `json:"page_size" form:"page_size"`
+	Keywords          string `json:"keywords" form:"keywords"`
+	VideoId           int    `json:"video_id" form:"video_id"`
+	ChartPermissionId int    `json:"chart_permission_id" form:"chart_permission_id"`
 }
 
 type VideoPlayLogReq struct {

+ 4 - 1
services/community/video.go

@@ -11,12 +11,15 @@ import (
 )
 
 // GetVideoList 获取视频列表
-func GetVideoList(pageIndex, pageSize, videoId int, keywords string) (resp []*response.CommunityVideoItem, err error) {
+func GetVideoList(pageIndex, pageSize, videoId, chartPermissionId int, keywords string) (resp []*response.CommunityVideoItem, err error) {
 	condition := make(map[string]interface{})
 	// 分享点进来的直接定位到具体视频
 	if videoId > 0 {
 		condition["community_video_id ="] = videoId
 	} else {
+		if chartPermissionId > 0 {
+			condition["chart_permission_id ="] = chartPermissionId
+		}
 		if keywords != "" {
 			condition["title like"] = "%" + keywords + "%"
 		}