|
@@ -53,14 +53,12 @@ func (this *MicroRoadShowController) List() {
|
|
|
activityVideoIds := this.GetString("ActivityVideoIds")
|
|
|
activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
|
filter, _ := this.GetInt("Filter", 0)
|
|
|
-
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
|
}
|
|
|
if currentIndex <= 0 {
|
|
|
currentIndex = 1
|
|
|
}
|
|
|
-
|
|
|
keyWordArr, err := services.GetIndustryMapNameSliceV3(keywords)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
@@ -68,8 +66,6 @@ func (this *MicroRoadShowController) List() {
|
|
|
return
|
|
|
}
|
|
|
keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
|
|
|
-
|
|
|
- //keyWordLen := len(keyWordArr)
|
|
|
var list []*models.MicroRoadShowPageList
|
|
|
var total int
|
|
|
var e error
|
|
@@ -80,68 +76,64 @@ func (this *MicroRoadShowController) List() {
|
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- //var pageSizeIk int
|
|
|
- //var currentIndexIk int
|
|
|
- //pageSizeIk = pageSize - len(list)
|
|
|
- //
|
|
|
- //currentIndexIk = currentIndex - (total / pageSize) - 1
|
|
|
- ////获取总的数量
|
|
|
- //totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds)
|
|
|
- //if e != nil {
|
|
|
- // br.Msg = "获取失败"
|
|
|
- // br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //
|
|
|
- ////startSize, pageSize,
|
|
|
- //startSize := utils.StartIndex(currentIndex, pageSize)
|
|
|
- //
|
|
|
- //lisIk, e := services.GetMicroRoadShowPageListIkWord(pageSizeIk, currentIndexIk, audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds)
|
|
|
- //if e != nil {
|
|
|
- // br.Msg = "获取失败"
|
|
|
- // br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //
|
|
|
- //total = totalIk
|
|
|
- //if keyWordLen > 1 && pageSizeIk > 0 {
|
|
|
- // for _, item := range listIk {
|
|
|
- // list = append(list, item)
|
|
|
- // }
|
|
|
- //}
|
|
|
- //return
|
|
|
+ var pageSizeIk int
|
|
|
+ pageSizeIk = pageSize - len(list)
|
|
|
+ //获取总的数量
|
|
|
+ totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //处理IK分词部分的分页获取条数
|
|
|
+ startSizeIk := utils.StartIndex(currentIndex, pageSize)
|
|
|
+ startSizeIk = startSizeIk - total
|
|
|
+
|
|
|
+ if pageSizeIk > 0 {
|
|
|
+ lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, filter, keyWordArr, audioIds, videoIds, activityVideoIds)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, item := range lisIk {
|
|
|
+ list = append(list, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ total = totalIk
|
|
|
+ userId := user.UserId
|
|
|
+ listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapaudioIds := make(map[int]int) //活动音频
|
|
|
+ mapvideoIds := make(map[int]int) // 微路演视频
|
|
|
+ mapactivityVideoIds := make(map[int]int) // 活动视频
|
|
|
+ for _, item := range listMycollect {
|
|
|
+ if item.ActivityVoiceId > 0 {
|
|
|
+ mapaudioIds[item.ActivityVoiceId] = item.ActivityVoiceId
|
|
|
+ } else if item.VideoId > 0 {
|
|
|
+ mapvideoIds[item.VideoId] = item.VideoId
|
|
|
+ } else if item.ActivityVideoId > 0 {
|
|
|
+ mapactivityVideoIds[item.ActivityVoiceId] = item.ActivityVoiceId
|
|
|
+ }
|
|
|
+ }
|
|
|
for _, item := range list {
|
|
|
if item.Type == 1 {
|
|
|
//音频
|
|
|
- count, err := models.GetVoiceCollectCount(user.UserId, item.Id)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取数据失败!"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if count > 0 {
|
|
|
+ if mapaudioIds[item.Id] > 0 {
|
|
|
item.IsCollect = true
|
|
|
}
|
|
|
} else if item.Type == 2 {
|
|
|
//活动视频
|
|
|
- count, err := models.GetActivityVideoCollectCount(user.UserId, item.Id)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取数据失败!"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if count > 0 {
|
|
|
+ if mapactivityVideoIds[item.Id] > 0 {
|
|
|
item.IsCollect = true
|
|
|
}
|
|
|
} else if item.Type == 3 {
|
|
|
//微路演视频
|
|
|
- count, err := models.GetVideoCollectCount(user.UserId, item.Id)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取数据失败!"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if count > 0 {
|
|
|
+ if mapvideoIds[item.Id] > 0 {
|
|
|
item.IsCollect = true
|
|
|
}
|
|
|
}
|
|
@@ -153,7 +145,6 @@ func (this *MicroRoadShowController) List() {
|
|
|
br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
// 获取默认图配置
|
|
|
audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
|
|
|
if e != nil {
|
|
@@ -161,7 +152,6 @@ func (this *MicroRoadShowController) List() {
|
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
for i := range list {
|
|
|
// 权限
|
|
|
au := new(models.UserPermissionAuthInfo)
|
|
@@ -209,18 +199,11 @@ func (this *MicroRoadShowController) List() {
|
|
|
list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //修改产业视频的标题
|
|
|
- //if list[i].Type == 3 && list[i].IndustryName != "" {
|
|
|
- // list[i].Title = "5min" + "【" + list[i].IndustryName + "】" + "逻辑解析"
|
|
|
- //}
|
|
|
}
|
|
|
-
|
|
|
resp := new(models.MicroRoadShowListResp)
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp.List = list
|
|
|
resp.Paging = page
|
|
|
-
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|