Browse Source

fix filter

ziwen 2 years ago
parent
commit
8c30636e7a
3 changed files with 13 additions and 9 deletions
  1. 2 2
      controllers/report.go
  2. 6 6
      models/micro_roadshow.go
  3. 5 1
      services/micro_roadshow.go

+ 2 - 2
controllers/report.go

@@ -2926,8 +2926,8 @@ func (this *ReportController) StockNameList() {
 
 	list, err := models.GetSummaryArticle(chartPermissionId)
 	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.Msg = "获取综述报告公司名称失败"
+		br.ErrMsg = "获取综述报告公司名称失败,Err:" + err.Error()
 		return
 	}
 	for _, item := range list {

+ 6 - 6
models/micro_roadshow.go

@@ -31,10 +31,10 @@ type MicroRoadShowPageList struct {
 }
 
 // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
-func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId int) (total int, list []*MicroRoadShowPageList, 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 {
+	if audioId+activityVideoId == 0 && filter != 2{
 		sql += `SELECT
 			video_id AS id,
 			video_name AS title,
@@ -56,11 +56,11 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			sql += condition
 		}
 	}
-	if audioId+videoId+activityVideoId == 0 {
+	if audioId+videoId+activityVideoId == 0 && filter != 2 {
 		sql += `  UNION ALL `
 	}
 
-	if audioId+videoId == 0 {
+	if audioId+videoId == 0 && filter != 2{
 		sql += `
 		SELECT
 			video_id AS id,
@@ -82,11 +82,11 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			sql += conditionAct
 		}
 	}
-	if audioId+videoId+activityVideoId == 0 {
+	if audioId+videoId+activityVideoId == 0 && filter == 0 {
 		sql += `  UNION ALL `
 	}
 
-	if videoId+activityVideoId == 0 {
+	if videoId+activityVideoId == 0 && filter != 1 {
 		sql += `
 			SELECT
 			a.activity_voice_id AS id,

+ 5 - 1
services/micro_roadshow.go

@@ -3,6 +3,7 @@ package services
 import (
 	"encoding/json"
 	"errors"
+	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
 )
@@ -175,7 +176,9 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	var audioCond string
 	var audioPars []interface{}
 	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
+	fmt.Println("filter:", filter)
 	if videoId > 0 || activityVideoId > 0 || filter == 1{
+		fmt.Println("11111")
 		audioCond = ""
 	} else {
 		// 活动已发布且已结束
@@ -199,6 +202,7 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	var videoPars []interface{}
 	var videoParsAct []interface{}
 	if audioId > 0 || filter == 2{
+		fmt.Println("22222")
 		videoCond = ""
 	} else {
 		if keywords != "" {
@@ -230,7 +234,7 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 		//}
 		videoCond += ` AND publish_status = 1`
 	}
-	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId)
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, filter)
 	if e != nil {
 		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
 		return