|
@@ -21,14 +21,11 @@ type MicroRoadShowController struct {
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
|
-// @Param AudioId query int false "音频ID"
|
|
|
-// @Param VideoId query int false "视频ID"
|
|
|
-// @Param AudioIds query string false "活动音频IDs"
|
|
|
-// @Param ActivityVideoIds query string false "活动视频IDs"
|
|
|
-// @Param VideoIds query string false "视频IDs"
|
|
|
-// @Param ActivityVideoId query int false "活动视频ID"
|
|
|
// @Param Filter query string false "筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
|
|
|
// @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
|
|
|
+// @Param SourceId query int true "资源ID"
|
|
|
+// @Param SourceType query int true " 1:活动音频 2:活动视频 3:产业视频 4:问答系列"
|
|
|
+// @Param SearchType string int true "搜索类型: 1-路演回放; 2-问答系列; 3-调研反馈 多个用 , 隔开"
|
|
|
// @Success 200 {object} models.HomeListResp
|
|
|
// @router /list [get]
|
|
|
func (this *MicroRoadShowController) List() {
|
|
@@ -47,14 +44,17 @@ func (this *MicroRoadShowController) List() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
keywords := this.GetString("KeyWord")
|
|
|
- audioId, _ := this.GetInt("AudioId")
|
|
|
- videoId, _ := this.GetInt("VideoId")
|
|
|
- audioIds := this.GetString("AudioIds")
|
|
|
- videoIds := this.GetString("VideoIds")
|
|
|
- activityVideoIds := this.GetString("ActivityVideoIds")
|
|
|
- activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
|
+ //audioId, _ := this.GetInt("AudioId")
|
|
|
+ //videoId, _ := this.GetInt("VideoId")
|
|
|
+ //audioIds := this.GetString("AudioIds")
|
|
|
+ //videoIds := this.GetString("VideoIds")
|
|
|
+ //activityVideoIds := this.GetString("ActivityVideoIds")
|
|
|
+ //activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
|
filter := this.GetString("Filter")
|
|
|
chartPermissionIds := this.GetString("ChartPermissionIds")
|
|
|
+ sourceId, _ := this.GetInt("SourceId")
|
|
|
+ sourceType, _ := this.GetInt("SourceType")
|
|
|
+ searchType := this.GetString("SearchType")
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
|
}
|
|
@@ -76,41 +76,13 @@ func (this *MicroRoadShowController) List() {
|
|
|
var total int
|
|
|
var e error
|
|
|
// 微路演列表
|
|
|
- list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords, audioIds, videoIds, activityVideoIds, chartPermissionIds)
|
|
|
+ list, total, e = services.GetMicroRoadShowPageListV12(pageSize, currentIndex, sourceId, sourceType, filter, keywords, searchType, chartPermissionIds)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- if keywords != "" {
|
|
|
- var pageSizeIk int
|
|
|
- //获取总的数量
|
|
|
- totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter, audioIds, videoIds, activityVideoIds)
|
|
|
- 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, audioIds, videoIds, activityVideoIds, keywords)
|
|
|
- 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 {
|
|
@@ -250,11 +222,9 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
videoId := req.VideoId
|
|
|
playSeconds := req.PlaySeconds
|
|
|
sourceType := req.SourceType
|
|
|
-
|
|
|
if sourceType == 0 {
|
|
|
sourceType = 1
|
|
|
}
|
|
@@ -266,6 +236,17 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
return
|
|
|
}
|
|
|
if sourceType == 1 {
|
|
|
+ //添加活动音频的播放记录
|
|
|
+ go services.AddActivityVoiceHistory(user, videoId, playSeconds)
|
|
|
+ } else if sourceType == 2 {
|
|
|
+ //添加活动视频的播放记录
|
|
|
+ go services.AddActivityVideoHistory(user, videoId, playSeconds)
|
|
|
+ //if err != nil {
|
|
|
+ // br.Msg = "更新失败"
|
|
|
+ // br.ErrMsg = "更新失败,AddActivityVideoHistory Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ } else if sourceType == 3 {
|
|
|
item := models.CygxMicroRoadshowVideoHistory{
|
|
|
VideoId: videoId,
|
|
|
UserId: uid,
|
|
@@ -307,13 +288,8 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
}
|
|
|
}
|
|
|
go services.MicroRoadshowVideoUserRmind(user, videoId)
|
|
|
- } else if sourceType == 2 {
|
|
|
- err = services.AddActivityVideoHistory(user, videoId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "更新失败"
|
|
|
- br.ErrMsg = "更新失败,AddActivityVideoHistory Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ go services.AddAskserieVideoHistoryRecord(user, videoId, playSeconds)
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -396,6 +372,10 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
}
|
|
|
item.IndustryId = microVideo.IndustryId
|
|
|
//resourceId = microVideo.IndustryId
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ item.AskserieVideoId = req.Id
|
|
|
+
|
|
|
+ go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
|
|
|
}
|
|
|
|
|
|
if sourceType == 2 || sourceType == 3 {
|
|
@@ -522,6 +502,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
item.ActivityVideoId = req.Id
|
|
|
item.UserId = uid
|
|
|
item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
|
item.Email = user.Email
|
|
|
item.CompanyId = user.CompanyId
|
|
@@ -611,6 +592,49 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
+ } else if req.SourceType == 4 {
|
|
|
+ // 系列问答视频收藏
|
|
|
+ count, err := models.GetAskserieVideoCount(uid, req.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
+ if count <= 0 {
|
|
|
+ item := new(models.CygxAskserieVideoCollect)
|
|
|
+ item.AskserieVideoId = req.Id
|
|
|
+ item.UserId = uid
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.Email = user.Email
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.RealName = user.RealName
|
|
|
+ item.RegisterPlatform = utils.REGISTER_PLATFORM
|
|
|
+ err = models.AddCygxAskserieVideoCollect(item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "收藏失败"
|
|
|
+ br.ErrMsg = "收藏失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "收藏成功"
|
|
|
+ resp.Status = 1
|
|
|
+ // 文章收藏消息发送
|
|
|
+ //go services.ArticleUserRemind(user, detail, 2)
|
|
|
+ } else {
|
|
|
+ err = models.RemoveAskserieVideoCollect(uid, req.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "取消收藏失败"
|
|
|
+ br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "已取消收藏"
|
|
|
+ resp.Status = 2
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -650,9 +674,17 @@ func (this *MicroRoadShowController) Mycollect() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ listAskserieVideoCollect, err := models.GetUserCygxAskserieVideoCollectList(userId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var audioIds []string
|
|
|
var videoIds []string
|
|
|
var activityVideoIds []string
|
|
|
+ var askserieVideoIds []string //问答系列视频
|
|
|
for _, item := range listMycollect {
|
|
|
if item.ActivityVoiceId > 0 {
|
|
|
audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
|
|
@@ -662,7 +694,10 @@ func (this *MicroRoadShowController) Mycollect() {
|
|
|
activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
|
|
|
}
|
|
|
}
|
|
|
- if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 {
|
|
|
+ for _, item := range listAskserieVideoCollect {
|
|
|
+ askserieVideoIds = append(askserieVideoIds, strconv.Itoa(item.AskserieVideoId))
|
|
|
+ }
|
|
|
+ if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 && len(askserieVideoIds) == 0 {
|
|
|
resp := new(models.MicroRoadShowListResp)
|
|
|
page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
resp.List = make([]*models.MicroRoadShowPageList, 0)
|
|
@@ -677,48 +712,51 @@ func (this *MicroRoadShowController) Mycollect() {
|
|
|
audioIdstr := strings.Join(audioIds, ",")
|
|
|
ideoIdsStr := strings.Join(videoIds, ",")
|
|
|
activityVideoIdsStr := strings.Join(activityVideoIds, ",")
|
|
|
+ askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
|
|
|
// 微路演列表
|
|
|
- list, total, e := services.GetMicroRoadShowMycollect(pageSize, currentIndex, audioIdstr, ideoIdsStr, activityVideoIdsStr)
|
|
|
+ list, total, e := services.GetMicroRoadShowMycollectV12(pageSize, currentIndex, audioIdstr, activityVideoIdsStr, ideoIdsStr, askserieVideoIdsStr)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
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 {
|
|
|
- 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 {
|
|
|
- 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 {
|
|
|
- item.IsCollect = true
|
|
|
- }
|
|
|
- }
|
|
|
+ //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 {
|
|
|
+ // 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 {
|
|
|
+ // 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 {
|
|
|
+ // item.IsCollect = true
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ item.IsCollect = true
|
|
|
}
|
|
|
// 用户权限
|
|
|
authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|