xingzai 2 سال پیش
والد
کامیت
f5d842d275
5فایلهای تغییر یافته به همراه480 افزوده شده و 93 حذف شده
  1. 42 1
      controllers/micro_roadshow.go
  2. 18 21
      controllers/user.go
  3. 166 9
      models/micro_roadshow.go
  4. 38 13
      services/elastic.go
  5. 216 49
      services/micro_roadshow.go

+ 42 - 1
controllers/micro_roadshow.go

@@ -53,14 +53,55 @@ func (this *MicroRoadShowController) List() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
+	var keyWordArr []string
+	var err error
+	if keywords != "" {
+		keyWordArr, err = services.GetIndustryMapNameSliceV3(keywords)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分词失败,GetIndustryMapNameSliceV3 Err: " + err.Error()
+			return
+		}
+		keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
+	}
+	var list []*models.MicroRoadShowPageList
+	var total int
+	var e error
 
 	// 微路演列表
-	list, total, e := services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
+	list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
 	if e != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
 		return
 	}
+	var pageSizeIk int
+
+	//获取总的数量
+	totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
+		return
+	}
+	pageSizeIk = totalIk - len(list)
+	//处理IK分词部分的分页获取条数
+	startSizeIk := utils.StartIndex(currentIndex, pageSize)
+	startSizeIk = startSizeIk - total
+	if startSizeIk < 0 {
+		startSizeIk = 0
+	}
+	if pageSizeIk > 0 {
+		lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter)
+		if e != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
+			return
+		}
+		for _, item := range lisIk {
+			list = append(list, item)
+		}
+	}
 
 	// 用户权限
 	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)

+ 18 - 21
controllers/user.go

@@ -7,7 +7,6 @@ import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
 	"hongze/hongze_clpt/utils"
-	"sort"
 	"strconv"
 	"strings"
 	"time"
@@ -824,7 +823,6 @@ func (this *UserController) CollectList() {
 	br.Data = resp
 }
 
-
 // @Title 获取我的留言
 // @Description 获取我的留言列表
 // @Param   PageSize    query   int true       "PageSize"
@@ -874,19 +872,19 @@ func (this *UserController) CommnetList() {
 
 	for _, comment := range commentlist {
 		item := models.CygxArticleCommentResp{
-			Id:                comment.Id,
-			UserId:            comment.UserId,
-			ArticleId:         comment.ArticleId,
-			IndustryId:        comment.IndustryId,
-			ActivityId:        comment.ActivityId,
-			VideoId:           comment.VideoId,
-			CreateTime:        comment.CreateTime.Format(utils.FormatDateTime),
-			Mobile:            comment.Mobile,
-			Email:             comment.Email,
-			CompanyId:         comment.CompanyId,
-			CompanyName:       comment.CompanyName,
-			Content:           comment.Content,
-			Title:             comment.Title,
+			Id:          comment.Id,
+			UserId:      comment.UserId,
+			ArticleId:   comment.ArticleId,
+			IndustryId:  comment.IndustryId,
+			ActivityId:  comment.ActivityId,
+			VideoId:     comment.VideoId,
+			CreateTime:  comment.CreateTime.Format(utils.FormatDateTime),
+			Mobile:      comment.Mobile,
+			Email:       comment.Email,
+			CompanyId:   comment.CompanyId,
+			CompanyName: comment.CompanyName,
+			Content:     comment.Content,
+			Title:       comment.Title,
 		}
 		if comment.ArticleId > 0 {
 			item.RedirectType = 1
@@ -1104,7 +1102,6 @@ func (this *UserController) AskList() {
 	}
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
-
 	userId := this.User.UserId
 	total, err := models.GetActivityAskCount(userId)
 	if err != nil {
@@ -1231,7 +1228,7 @@ func (this *UserController) Mycollect() {
 			if count > 0 {
 				item.IsCollect = true
 			}
-			if v,ok := collectVoiceMap[item.Id]; ok{
+			if v, ok := collectVoiceMap[item.Id]; ok {
 				item.CollectTime = v
 			}
 		} else if item.Type == 2 {
@@ -1245,7 +1242,7 @@ func (this *UserController) Mycollect() {
 			if count > 0 {
 				item.IsCollect = true
 			}
-			if v,ok := collectActivityVideoMap[item.Id]; ok{
+			if v, ok := collectActivityVideoMap[item.Id]; ok {
 				item.CollectTime = v
 			}
 		} else if item.Type == 3 {
@@ -1259,7 +1256,7 @@ func (this *UserController) Mycollect() {
 			if count > 0 {
 				item.IsCollect = true
 			}
-			if v,ok := collectVideoMap[item.Id]; ok{
+			if v, ok := collectVideoMap[item.Id]; ok {
 				item.CollectTime = v
 			}
 		}
@@ -1332,7 +1329,7 @@ func (this *UserController) Mycollect() {
 	var sortList models.MicroList
 
 	sortList = list
-	sort.Sort(sortList)
+	//sort.Sort(sortList)
 
 	resp := new(models.MicroRoadShowListResp)
 	page := paging.GetPaging(currentIndex, pageSize, total)
@@ -1343,4 +1340,4 @@ func (this *UserController) Mycollect() {
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = resp
-}
+}

+ 166 - 9
models/micro_roadshow.go

@@ -174,7 +174,7 @@ func GetMicroRoadshowVideoByIndustryId(industryId int) (item *MicroRoadshowVideo
 	return
 }
 
-//GetMicroRoadshowVideoByIndustryIdCount  根据行业ID查询产业视频是否存在
+// GetMicroRoadshowVideoByIndustryIdCount  根据行业ID查询产业视频是否存在
 func GetMicroRoadshowVideoByIndustryIdCount(industryId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count
@@ -183,7 +183,7 @@ func GetMicroRoadshowVideoByIndustryIdCount(industryId int) (count int, err erro
 	return
 }
 
-//GetMicroRoadshowVideoByVideoIdCount  根据视频ID查询产业视频是否存在
+// GetMicroRoadshowVideoByVideoIdCount  根据视频ID查询产业视频是否存在
 func GetMicroRoadshowVideoByVideoIdCount(industryId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count
@@ -294,14 +294,171 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 
 type MicroList []*MicroRoadShowPageList
 
-func (m MicroList) Len() int {
-	return len(m)
-}
+//func (m MicroList) Len() int {
+//	return len(m)
+//}
+//
+//func (m MicroList) Less(i, j int) bool {
+//	return m[i].CollectTime.After(m[j].CollectTime)
+//}
+//
+//func (m MicroList) Swap(i, j int) {
+//	m[i], m[j] = m[j], m[i]
+//}
+
+// CountMicroRoadShowVideoPageList 获取微路演视频数量
+func CountMicroRoadShowVideoPageList(condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}) (total int, err error) {
+	o := orm.NewOrm()
+	var sql string
+	sql += `SELECT
+			video_id AS id,
+			video_name AS title,
+			video_url AS resource_url,
+			3 AS type,
+			publish_date AS publish_time,
+			chart_permission_id,
+			chart_permission_name,
+			video_duration AS play_seconds,
+			img_url AS background_img,            
+			industry_name,
+			share_img_url AS share_img,
+			"" as  activity_id
+		FROM
+			cygx_micro_roadshow_video 
+		WHERE
+			publish_status = 1 `
+	if condition != `` {
+		sql += condition
+	}
+	sql += `  UNION ALL `
+	sql += `
+		SELECT
+			video_id AS id,
+			video_name AS title,
+			video_url AS resource_url,
+			2 AS type,
+		art.activity_time as publish_time,
+			art.chart_permission_id,
+			art.chart_permission_name,
+			"" AS play_seconds,
+			"" AS background_img,
+			"" AS industry_name,
+			"" AS share_img,
+			v.activity_id
+		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
+	}
+	sql += `  UNION ALL `
+	sql += `
+			SELECT
+			a.activity_voice_id AS id,
+			a.voice_name AS title,
+			a.voice_url AS resource_url,
+			1 AS type,
+			b.activity_time AS publish_time,
+			b.chart_permission_id,
+			b.chart_permission_name,
+			a.voice_play_seconds AS play_seconds,
+			a.img_url AS background_img,
+			"" AS industry_name,
+			"" AS share_img,
+			a.activity_id 
+		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
+	}
 
-func (m MicroList) Less(i, j int) bool {
-	return m[i].CollectTime.After(m[j].CollectTime)
+	sql += ` ORDER BY publish_time DESC`
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql, pars, parsAct, parsAudio).QueryRow(&total)
+	return
 }
 
-func (m MicroList) Swap(i, j int) {
-	m[i], m[j] = m[j], m[i]
+// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
+func GetMicroRoadShowVideoPageListIkWord(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (list []*MicroRoadShowPageList, err error) {
+	o := orm.NewOrm()
+	var sql string
+	//if audioId+activityVideoId == 0 && filter != 2 {
+	sql += `SELECT
+			video_id AS id,
+			video_name AS title,
+			video_url AS resource_url,
+			3 AS type,
+			publish_date AS publish_time,
+			chart_permission_id,
+			chart_permission_name,
+			video_duration AS play_seconds,
+			img_url AS background_img,            
+			industry_name,
+			share_img_url AS share_img,
+			"" as  activity_id
+		FROM
+			cygx_micro_roadshow_video 
+		WHERE
+			publish_status = 1 `
+	if condition != `` {
+		sql += condition
+	}
+	//}
+	//if audioId+videoId+activityVideoId == 0 && filter != 2 {
+	//	sql += `  UNION ALL `
+	//}
+	sql += `  UNION ALL `
+	//if audioId+videoId == 0 && filter != 2 {
+	sql += `
+		SELECT
+			video_id AS id,
+			video_name AS title,
+			video_url AS resource_url,
+			2 AS type,
+			art.activity_time as publish_time,
+			art.chart_permission_id,
+			art.chart_permission_name,
+			"" AS play_seconds,
+			"" AS background_img,
+			"" AS industry_name,
+			"" AS share_img,
+			v.activity_id
+		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 `
+	//}
+	sql += `  UNION ALL `
+	//if videoId+activityVideoId == 0 && filter != 1 {
+	sql += `
+			SELECT
+			a.activity_voice_id AS id,
+			a.voice_name AS title,
+			a.voice_url AS resource_url,
+			1 AS type,
+			b.activity_time AS publish_time,
+			b.chart_permission_id,
+			b.chart_permission_name,
+			a.voice_play_seconds AS play_seconds,
+			a.img_url AS background_img,
+			"" AS industry_name,
+			"" AS share_img,
+			a.activity_id 
+		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
+	}
+	//}
+	sql += ` ORDER BY publish_time DESC`
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, pars, parsAct, parsAudio, startSize, pageSize).QueryRows(&list)
+	return
 }

+ 38 - 13
services/elastic.go

@@ -8,6 +8,7 @@ import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
 	"strconv"
+	"strings"
 )
 
 //func NewClient() (client *elastic.Client, err error) {
@@ -254,20 +255,20 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 	shouldMapquery := make([]interface{}, 0)
 	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
 	//keyWordWeight := GetWeight(keyWordLen)
-	var boost int
-	lenkeyWordArr := len(keyWordArr)
-	for k, v := range keyWordArr {
-		if k == 0 {
-			boost = 2 * 1000
-		} else {
-			boost = 1000
-		}
+	//var boost int
+	//lenkeyWordArr := len(keyWordArr)
+	for _, v := range keyWordArr {
+		//if k == 0 {
+		//	boost = 2 * 1000
+		//} else {
+		//	boost = 1000
+		//}
 		if v != "" {
 			shouldMapquery = append(shouldMapquery, map[string]interface{}{
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
 							"fields": []interface{}{"Title"},
 							"query":  v,
 						},
@@ -278,7 +279,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
 							"fields": []interface{}{"Abstract"},
 							"query":  v,
 						},
@@ -289,7 +290,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
 							"fields": []interface{}{"Annotation"},
 							"query":  v,
 						},
@@ -301,7 +302,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
 							"fields": []interface{}{"BodyText"},
 							"query":  v,
 						},
@@ -345,7 +346,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 			},
 		},
 	}
-	if orderColumn == "PublishDate" {
+	if orderColumn == "Matching" {
 		queryMap["sort"] = sortMap
 	}
 	queryMap["from"] = startSize
@@ -405,3 +406,27 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 	}
 	return
 }
+
+// KeyWordArrSqlRegexp 预处理ik联想词的模糊查询语句
+func KeyWordArrSqlRegexpAll(a []string) (ret string) {
+	a_len := len(a)
+	for i := 0; i < a_len; i++ {
+		ret += a[i] + "|"
+	}
+	ret = strings.TrimRight(ret, "|")
+	//ret = "'" + ret + "'"
+	return
+}
+
+// KeyWordArrSqlRegexp 预处理ik联想词的模糊查询语句
+func KeyWordArrSqlRegexp(a []string) (ret string) {
+	a_len := len(a)
+	for i := 0; i < a_len; i++ {
+		if i == 0 {
+			continue
+		}
+		ret += a[i] + "|"
+	}
+	ret = strings.TrimRight(ret, "|")
+	return
+}

+ 216 - 49
services/micro_roadshow.go

@@ -5,7 +5,6 @@ import (
 	"errors"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
-	"strings"
 )
 
 // GetMicroRoadShowDefaultImgConfig 获取微路演默认图/分享图配置
@@ -106,7 +105,7 @@ func GetindustryVideo(user *models.WxUserItem, industrialManagementId int) (indu
 	return
 }
 
-//GetindustryVideoDetailById 通过视频ID获取视频详情
+// GetindustryVideoDetailById 通过视频ID获取视频详情
 func GetindustryVideoDetailById(user *models.WxUserItem, videoId int) (industryVideo *models.MicroVideoSimpleInfo, AuthInfo *models.UserPermissionAuthInfo, err error) {
 	total, e := models.GetMicroRoadshowVideoByVideoIdCount(videoId)
 	if e != nil {
@@ -172,7 +171,7 @@ func GetindustryVideoDetailById(user *models.WxUserItem, videoId int) (industryV
 	return
 }
 
-//GetMicroRoadshowVideoMap 获取已经发布的微路演的产业ID
+// GetMicroRoadshowVideoMap 获取已经发布的微路演的产业ID
 func GetMicroRoadshowVideoMap() (items map[int]int, err error) {
 	list, e := models.GetMicroRoadshowVideoList()
 	if e != nil && e.Error() != utils.ErrNoRow() {
@@ -201,59 +200,65 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	var audioCond string
 	var audioPars []interface{}
 	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
-	// @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
-	if (videoId > 0 || activityVideoId > 0 || (!strings.Contains(filter, "2") && !strings.Contains(filter, "4"))) && filter != "" {
-		audioCond += ` AND a.activity_voice_id = 0 `
-	} else {
-		// 活动已发布且已结束
-		audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
-		//活动音频,设置有效时间为30天,失效后该活动就不再支持音频回放。有效期起始时间为活动的开始时间
-		//endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		//audioCond += ` AND b.activity_time > ? `
-		//audioPars = append(audioPars, endTime)
-		if keywords != "" {
-			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)
-		}
+	// 活动已发布且已结束
+	audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
+	//活动音频,设置有效时间为30天,失效后该活动就不再支持音频回放。有效期起始时间为活动的开始时间
+	//endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
+	//audioCond += ` AND b.activity_time > ? `
+	//audioPars = append(audioPars, endTime)
+	if keywords != "" {
+		audioCond += ` AND ( a.voice_name LIKE ? OR b.label LIKE ? )`
+		audioPars = append(audioPars, keywords, keywords)
 	}
-	//活动视频的处理
-	var videoCondAct string
-	var videoParsAct []interface{}
-	if (audioId > 0 || videoId > 0 || (!strings.Contains(filter, "1") && !strings.Contains(filter, "4"))) && filter != "" {
-		videoCondAct = "AND video_id =  0 "
-	} else {
-		if keywords != "" {
-			videoCondAct += ` AND video_name LIKE ?`
-			videoParsAct = append(videoParsAct, keywords)
-		}
-		if activityVideoId > 0 {
-			videoCondAct += ` AND video_id = ?`
-			videoParsAct = append(videoParsAct, activityVideoId)
-		}
-		videoCondAct += ` AND publish_status = 1`
+	if audioId > 0 {
+		audioCond += ` AND a.activity_voice_id = ?`
+		audioPars = append(audioPars, audioId)
 	}
-	//产业视频的处理
+
+	//}
+	//视频的处理
 	var videoCond string
+	var videoCondAct string
 	var videoPars []interface{}
-	if (audioId > 0 || videoId > 0 || (!strings.Contains(filter, "1") && !strings.Contains(filter, "3"))) && filter != "" {
-		videoCond += ` AND video_id =  0 `
-	} else {
-		if keywords != "" {
-			videoCond += ` AND video_name LIKE ?`
-			videoPars = append(videoPars, keywords)
-		}
-		if videoId > 0 {
-			videoCond += ` AND video_id = ?`
-			videoPars = append(videoPars, videoId)
-		}
+	var videoParsAct []interface{}
+
+	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)
+	}
 
-		videoCond += ` AND publish_status = 1`
+	//如果传了路演的或者活动的视频ID只查询一个
+	if videoId > 0 {
+		videoCondAct += ` AND video_id = 0 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if activityVideoId > 0 {
+		videoCond += ` AND video_id = 0 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if audioId > 0 {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
 	}
+	if filter == "1" {
+		audioCond += ` AND a.activity_voice_id = 0 `
+	} else if filter == "2" {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+
+	videoCond += ` AND publish_status = 1`
 	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())
@@ -292,3 +297,165 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	respList = videoList
 	return
 }
+
+// GetMicroRoadShowPageListIkWord  添加IK分词联想词 获取微路演列表添加活动视频 更新与8.1版本
+func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId int, keywordArr []string, filter string) (total int, err error) {
+	var e error
+	var keywords string
+	if len(keywordArr) > 0 {
+		keywords = KeyWordArrSqlRegexpAll(keywordArr)
+	}
+	//if keywords == "" {
+	//	return
+	//}
+	//音频的查询
+	var audioCond string
+	var audioPars []interface{}
+	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
+	//if videoId > 0 || activityVideoId > 0 || filter == 1 {
+	//	audioCond += ` AND a.activity_voice_id  = 0 `
+	//} else {
+	// 活动已发布且已结束
+	audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
+	if keywords != "" {
+		audioCond += ` AND (a.voice_name REGEXP ? OR b.label REGEXP ? ) `
+		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 {
+	//	videoCond = ""
+	//} else {
+	if keywords != "" {
+		videoCond += ` AND video_name REGEXP ?`
+		videoPars = append(videoPars, keywords)
+		videoCondAct += ` AND video_name REGEXP ?`
+		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 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if activityVideoId > 0 {
+		videoCond += ` AND video_id = 0 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if audioId > 0 {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+	if filter == "1" {
+		audioCond += ` AND a.activity_voice_id = 0 `
+	} else if filter == "2" {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+
+	videoCond += ` AND publish_status = 1`
+	//}
+	total, e = models.CountMicroRoadShowVideoPageList(videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars)
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
+		return
+	}
+	return
+}
+
+// GetMicroRoadShowPageListIkWord  添加IK分词联想词 获取微路演列表添加活动视频 更新与8.1版本
+func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activityVideoId int, keywordArr []string, filter string) (respList []*models.MicroRoadShowPageList, err error) {
+
+	videoList := make([]*models.MicroRoadShowPageList, 0)
+	var e error
+	var keywords string
+	if len(keywordArr) > 1 {
+		keywords = KeyWordArrSqlRegexp(keywordArr)
+	}
+	//音频的查询
+	var audioCond string
+	var audioPars []interface{}
+	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
+	//if videoId > 0 || activityVideoId > 0 || filter == 1 {
+	//	audioCond += ` AND a.activity_voice_id  = 0 `
+	//} else {
+	// 活动已发布且已结束
+	audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
+	if keywords != "" {
+		audioCond += ` AND a.voice_name REGEXP ? OR b.label REGEXP ?`
+		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 {
+	//	videoCond = ""
+	//} else {
+	if keywords != "" {
+		videoCond += ` AND video_name REGEXP ?`
+		videoPars = append(videoPars, keywords)
+		videoCondAct += ` AND video_name REGEXP ?`
+		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 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if activityVideoId > 0 {
+		videoCond += ` AND video_id = 0 `
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	if audioId > 0 {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+	if filter == "1" {
+		audioCond += ` AND a.activity_voice_id = 0 `
+	} else if filter == "2" {
+		videoCondAct += ` AND video_id = 0 `
+		videoCond += ` AND video_id = 0 `
+	}
+
+	videoCond += ` AND publish_status = 1`
+	//}
+	videoList, e = models.GetMicroRoadShowVideoPageListIkWord(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, audioId, videoId, activityVideoId, 0)
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败分词, Err: " + e.Error())
+		return
+	}
+	respList = videoList
+	return
+}