xingzai il y a 2 ans
Parent
commit
c4684563c1
4 fichiers modifiés avec 50 ajouts et 56 suppressions
  1. 2 2
      controllers/micro_roadshow.go
  2. 21 21
      models/micro_roadshow.go
  3. 2 4
      services/activity.go
  4. 25 29
      services/micro_roadshow.go

+ 2 - 2
controllers/micro_roadshow.go

@@ -23,7 +23,7 @@ type MicroRoadShowController struct {
 // @Param   AudioId			query	int		false	"音频ID"
 // @Param   VideoId			query	int		false	"视频ID"
 // @Param   ActivityVideoId			query	int		false	"活动视频ID"
-// @Param   Filter			query	int		false	"筛选条件 0:全部 1:视频 2:音频"
+// @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
 // @Success 200 {object} models.HomeListResp
 // @router /list [get]
 func (this *MicroRoadShowController) List() {
@@ -45,7 +45,7 @@ func (this *MicroRoadShowController) List() {
 	audioId, _ := this.GetInt("AudioId")
 	videoId, _ := this.GetInt("VideoId")
 	activityVideoId, _ := this.GetInt("ActivityVideoId")
-	filter, _ := this.GetInt("Filter", 0)
+	filter := this.GetString("Filter")
 
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20

+ 21 - 21
models/micro_roadshow.go

@@ -188,8 +188,8 @@ func GetMicroRoadshowVideoList() (list []*MicroRoadshowVideo, err error) {
 func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (total int, list []*MicroRoadShowPageList, err error) {
 	o := orm.NewOrm()
 	var sql string
-	if audioId+activityVideoId == 0 && filter != 2 {
-		sql += `SELECT
+	//if audioId+activityVideoId == 0 && filter != 2 {
+	sql += `SELECT
 			video_id AS id,
 			video_name AS title,
 			video_url AS resource_url,
@@ -206,16 +206,16 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			cygx_micro_roadshow_video 
 		WHERE
 			publish_status = 1 `
-		if condition != `` {
-			sql += condition
-		}
-	}
-	if audioId+videoId+activityVideoId == 0 && filter != 2 {
-		sql += `  UNION ALL `
+	if condition != `` {
+		sql += condition
 	}
+	//}
+	//if audioId+videoId+activityVideoId == 0 && filter != 2 {
+	sql += `  UNION ALL `
+	//}
 
-	if audioId+videoId == 0 && filter != 2 {
-		sql += `
+	//if audioId+videoId == 0 && filter != 2 {
+	sql += `
 		SELECT
 			video_id AS id,
 			video_name AS title,
@@ -232,16 +232,16 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 		FROM
 			cygx_activity_video as v
 			INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1  `
-		if conditionAct != `` {
-			sql += conditionAct
-		}
-	}
-	if audioId+videoId+activityVideoId == 0 && filter == 0 {
-		sql += `  UNION ALL `
+	if conditionAct != `` {
+		sql += conditionAct
 	}
+	//}
+	//if audioId+videoId+activityVideoId == 0 && filter == 0 {
+	sql += `  UNION ALL `
+	//}
 
-	if videoId+activityVideoId == 0 && filter != 1 {
-		sql += `
+	//if videoId+activityVideoId == 0 && filter != 1 {
+	sql += `
 			SELECT
 			a.activity_voice_id AS id,
 			a.voice_name AS title,
@@ -258,10 +258,10 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 		FROM
 			cygx_activity_voice AS a
 			JOIN cygx_activity AS b ON a.activity_id = b.activity_id  WHERE 1= 1  `
-		if conditionAudio != `` {
-			sql += conditionAudio
-		}
+	if conditionAudio != `` {
+		sql += conditionAudio
 	}
+	//}
 	sql += ` ORDER BY publish_time DESC`
 	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
 	err = o.Raw(totalSql, pars, parsAct, parsAudio).QueryRow(&total)

+ 2 - 4
services/activity.go

@@ -351,10 +351,8 @@ func ActivityButtonShow(item *models.ActivityDetail) (articleDetail *models.Acti
 	//专家电话会 1
 	if articleDetail.ActivityTypeId == 1 {
 		articleDetail.IsShowOutboundCall = true
-		if articleDetail.LimitPeopleNum == 0 {
-			articleDetail.IsShowMeetingReminder = true
-			articleDetail.IsShowHelpSsk = true
-		}
+		articleDetail.IsShowMeetingReminder = true
+		articleDetail.IsShowHelpSsk = true
 	}
 
 	//分析师电话会 2

+ 25 - 29
services/micro_roadshow.go

@@ -3,9 +3,9 @@ package services
 import (
 	"encoding/json"
 	"errors"
-	"fmt"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
+	"strings"
 )
 
 // GetMicroRoadShowDefaultImgConfig 获取微路演默认图/分享图配置
@@ -188,7 +188,7 @@ func GetMicroRoadshowVideoMap() (items map[int]int, err error) {
 }
 
 // GetMicroRoadShowPageList 获取微路演列表添加活动视频 更新与8.1版本
-func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter int, keywords string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId int, filter, keywords string) (respList []*models.MicroRoadShowPageList, total int, err error) {
 	var e error
 	// 根据每页数据量获取音视频配比
 	startSize := utils.StartIndex(currentIndex, pageSize)
@@ -201,9 +201,9 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	var audioCond string
 	var audioPars []interface{}
 	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
-
-	if videoId > 0 || activityVideoId > 0 || filter == 1 {
-		audioCond = ""
+	// @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
+	if (videoId > 0 || activityVideoId > 0 || !strings.Contains(filter, "1") || !strings.Contains(filter, "4")) && filter != "" {
+		audioCond += ` AND a.activity_voice_id = 0 `
 	} else {
 		// 活动已发布且已结束
 		audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
@@ -215,50 +215,46 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 			audioCond += ` AND a.voice_name LIKE ? OR b.label LIKE ?`
 			audioPars = append(audioPars, keywords, keywords)
 		}
+
 		if audioId > 0 {
 			audioCond += ` AND a.activity_voice_id = ?`
 			audioPars = append(audioPars, audioId)
 		}
 	}
-	//视频的处理
-	var videoCond string
+	//活动视频的处理
 	var videoCondAct string
-	var videoPars []interface{}
 	var videoParsAct []interface{}
-	if audioId > 0 || filter == 2 {
-		fmt.Println("22222")
-		videoCond = ""
+	if (audioId > 0 || videoId > 0 || !strings.Contains(filter, "2") || !strings.Contains(filter, "4")) && filter != "" {
+		videoCondAct = "AND video_id =  0 "
 	} else {
 		if keywords != "" {
-			videoCond += ` AND video_name LIKE ?`
-			videoPars = append(videoPars, keywords)
 			videoCondAct += ` AND video_name LIKE ?`
 			videoParsAct = append(videoParsAct, keywords)
 		}
-		if videoId > 0 {
-			videoCond += ` AND video_id = ?`
-			videoPars = append(videoPars, videoId)
-		}
 		if activityVideoId > 0 {
 			videoCondAct += ` AND video_id = ?`
 			videoParsAct = append(videoParsAct, activityVideoId)
 		}
-
-		//如果传了路演的或者活动的视频ID只查询一个
-		if videoId > 0 {
-			videoCondAct += ` AND video_id = 0 `
+		videoCondAct += ` AND publish_status = 1`
+	}
+	//产业视频的处理
+	var videoCond string
+	var videoPars []interface{}
+	if (audioId > 0 || videoId > 0 || !strings.Contains(filter, "2") || !strings.Contains(filter, "3")) && filter != "" {
+		videoCond += ` AND video_id =  0 `
+	} else {
+		if keywords != "" {
+			videoCond += ` AND video_name LIKE ?`
+			videoPars = append(videoPars, keywords)
 		}
-		if activityVideoId > 0 {
-			videoCond += ` AND video_id = 0 `
+		if videoId > 0 {
+			videoCond += ` AND video_id = ?`
+			videoPars = append(videoPars, videoId)
 		}
-		//if videoId == 0 {
-		//	endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		//	videoCondAct += ` AND art.activity_time > ? `
-		//	videoParsAct = append(videoParsAct, endTime)
-		//}
+
 		videoCond += ` AND publish_status = 1`
 	}
-	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, filter)
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, 0)
 	if e != nil {
 		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
 		return