|
@@ -25,6 +25,10 @@ type MicroRoadShowController struct {
|
|
|
// @Param VideoId query int false "视频ID"
|
|
|
// @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() {
|
|
@@ -43,11 +47,14 @@ func (this *MicroRoadShowController) List() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
keywords := this.GetString("KeyWord")
|
|
|
- audioId, _ := this.GetInt("AudioId")
|
|
|
- videoId, _ := this.GetInt("VideoId")
|
|
|
- activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
|
+ //audioId, _ := this.GetInt("AudioId")
|
|
|
+ //videoId, _ := this.GetInt("VideoId")
|
|
|
+ //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
|
|
|
}
|
|
@@ -70,40 +77,40 @@ func (this *MicroRoadShowController) List() {
|
|
|
var e error
|
|
|
|
|
|
// 微路演列表
|
|
|
- list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
|
|
|
+ list, total, e = services.GetMicroRoadShowPageListV12(pageSize, currentIndex, sourceId, sourceType, filter, keywords, searchType, chartPermissionIds)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- var pageSizeIk int
|
|
|
+ //var pageSizeIk int
|
|
|
|
|
|
//获取总的数量
|
|
|
- totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- //return
|
|
|
- pageSizeIk = totalIk - len(list)
|
|
|
- //处理IK分词部分的分页获取条数
|
|
|
- startSizeIk := utils.StartIndex(currentIndex, pageSize)
|
|
|
- startSizeIk = startSizeIk - total
|
|
|
- if startSizeIk < 0 {
|
|
|
- startSizeIk = 0
|
|
|
- }
|
|
|
- if len(keyWordArr) > 0 {
|
|
|
- lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter, keywords)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- for _, item := range lisIk {
|
|
|
- list = append(list, item)
|
|
|
- }
|
|
|
- }
|
|
|
+ //totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter)
|
|
|
+ //if e != nil {
|
|
|
+ // br.Msg = "获取失败"
|
|
|
+ // br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ ////return
|
|
|
+ //pageSizeIk = totalIk - len(list)
|
|
|
+ ////处理IK分词部分的分页获取条数
|
|
|
+ //startSizeIk := utils.StartIndex(currentIndex, pageSize)
|
|
|
+ //startSizeIk = startSizeIk - total
|
|
|
+ //if startSizeIk < 0 {
|
|
|
+ // startSizeIk = 0
|
|
|
+ //}
|
|
|
+ //if len(keyWordArr) > 0 {
|
|
|
+ // lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter, keywords)
|
|
|
+ // if e != nil {
|
|
|
+ // br.Msg = "获取失败"
|
|
|
+ // br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // for _, item := range lisIk {
|
|
|
+ // list = append(list, item)
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
userId := user.UserId
|
|
|
listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
|
|
@@ -209,7 +216,7 @@ func (this *MicroRoadShowController) List() {
|
|
|
}
|
|
|
|
|
|
resp := new(models.MicroRoadShowListResp)
|
|
|
- page := paging.GetPaging(currentIndex, pageSize, totalIk)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp.List = list
|
|
|
resp.Paging = page
|
|
|
|
|
@@ -281,7 +288,11 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
|
|
|
videoId := req.VideoId
|
|
|
playSeconds := req.PlaySeconds
|
|
|
+ sourceType := req.SourceType
|
|
|
|
|
|
+ if sourceType == 0 {
|
|
|
+ sourceType = 1
|
|
|
+ }
|
|
|
var sellerName string
|
|
|
sellerName, err = models.GetCompanySellerName(user.CompanyId)
|
|
|
if err != nil {
|
|
@@ -289,58 +300,61 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- item := models.CygxMicroRoadshowVideoHistory{
|
|
|
- VideoId: videoId,
|
|
|
- UserId: uid,
|
|
|
- Mobile: user.Mobile,
|
|
|
- Email: user.Email,
|
|
|
- CompanyId: user.CompanyId,
|
|
|
- CompanyName: user.CompanyName,
|
|
|
- RealName: user.RealName,
|
|
|
- SellerName: sellerName,
|
|
|
- PlaySeconds: strconv.Itoa(playSeconds),
|
|
|
- CreateTime: time.Now(),
|
|
|
- ModifyTime: time.Now(),
|
|
|
- }
|
|
|
- //if playSeconds != 0 {
|
|
|
- // lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
|
|
|
- // if err != nil {
|
|
|
- // br.Msg = "操作失败"
|
|
|
- // br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()
|
|
|
- // return
|
|
|
- // }
|
|
|
- // err = models.UpdateLastCygxActivityVideoHistory(strconv.Itoa(playSeconds), lastItem.Id)
|
|
|
- // if err != nil {
|
|
|
- // br.Msg = "更新失败"
|
|
|
- // br.ErrMsg = "更新失败,UpdateLastCygxActivityVideoHistory Err:" + err.Error()
|
|
|
- // return
|
|
|
- // }
|
|
|
- //} else {
|
|
|
- // err = models.AddCygxMicroRoadshowVideoHistory(&item)
|
|
|
- // if err != nil {
|
|
|
- // br.Msg = "操作失败"
|
|
|
- // br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- // }
|
|
|
- // err = models.UpdateCygxActivityVideoCounts(videoId)
|
|
|
- // if err != nil {
|
|
|
- // br.Msg = "更新失败"
|
|
|
- // br.ErrMsg = "更新失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- err = models.AddCygxMicroRoadshowVideoHistory(&item)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- err = models.UpdateCygxActivityVideoCounts(videoId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "更新失败"
|
|
|
- br.ErrMsg = "更新失败,Err:" + err.Error()
|
|
|
- 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,
|
|
|
+ Mobile: user.Mobile,
|
|
|
+ Email: user.Email,
|
|
|
+ CompanyId: user.CompanyId,
|
|
|
+ CompanyName: user.CompanyName,
|
|
|
+ RealName: user.RealName,
|
|
|
+ SellerName: sellerName,
|
|
|
+ PlaySeconds: strconv.Itoa(playSeconds),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ }
|
|
|
+ if playSeconds != 0 {
|
|
|
+ lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = models.UpdateLastCygxActivityVideoHistory(strconv.Itoa(playSeconds), lastItem.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "更新失败"
|
|
|
+ br.ErrMsg = "更新失败,UpdateLastCygxActivityVideoHistory Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ err = models.AddCygxMicroRoadshowVideoHistory(&item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = models.UpdateCygxActivityVideoCounts(videoId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "更新失败"
|
|
|
+ br.ErrMsg = "更新失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ go services.MicroRoadshowVideoUserRmind(user, videoId)
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ go services.AddAskserieVideoHistoryRecord(user, videoId, playSeconds)
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -432,6 +446,10 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
item.IndustryId = microVideo.IndustryId
|
|
|
title = microVideo.VideoName
|
|
|
//resourceId = microVideo.IndustryId
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ item.AskserieVideoId = req.Id
|
|
|
+
|
|
|
+ go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
|
|
|
}
|
|
|
var isResearch bool // 是否属于研选
|
|
|
if sourceType == 2 || sourceType == 3 {
|
|
@@ -646,5 +664,48 @@ 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
|
|
|
}
|
|
|
}
|