|
@@ -21,10 +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 ActivityVideoId query int false "活动视频ID"
|
|
|
-// @Param Filter query string false "筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
|
|
|
+// @Param Filter query string false "筛选条件 为空:全部 1:视频 2:音频 "
|
|
|
+// @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 +44,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 +74,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)
|
|
@@ -115,15 +119,30 @@ func (this *MicroRoadShowController) List() {
|
|
|
mapaudioIds := make(map[int]int) //活动音频
|
|
|
mapvideoIds := make(map[int]int) // 微路演视频
|
|
|
mapactivityVideoIds := make(map[int]int) // 活动视频
|
|
|
+ mapAskserieVideoIds := 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
|
|
|
+ mapactivityVideoIds[item.ActivityVideoId] = item.ActivityVideoId
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ listAskserieVideoCollect, err := models.GetUserCygxAskserieVideoCollectList(userId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listAskserieVideoCollect {
|
|
|
+ if v.AskserieVideoId > 0 {
|
|
|
+ mapAskserieVideoIds[v.AskserieVideoId] = v.AskserieVideoId
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, item := range list {
|
|
|
if item.Type == 1 {
|
|
|
//音频
|
|
@@ -140,7 +159,14 @@ func (this *MicroRoadShowController) List() {
|
|
|
if mapvideoIds[item.Id] > 0 {
|
|
|
item.IsCollect = true
|
|
|
}
|
|
|
+ } else if item.Type == 4 {
|
|
|
+ //系列问答视频
|
|
|
+ if mapAskserieVideoIds[item.SourceId] > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ item.IndustrialManagementId = item.IndustryId
|
|
|
}
|
|
|
|
|
|
// 用户权限
|
|
@@ -209,7 +235,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
|
|
|
|
|
@@ -270,7 +296,6 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- uid := user.UserId
|
|
|
var req models.AddVideoHistoryReq
|
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
@@ -279,69 +304,27 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- videoId := req.VideoId
|
|
|
+ sourceId := req.SourceId
|
|
|
playSeconds := req.PlaySeconds
|
|
|
+ sourceType := req.SourceType
|
|
|
|
|
|
- var sellerName string
|
|
|
- sellerName, err = models.GetCompanySellerName(user.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "报名失败!"
|
|
|
- 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
|
|
|
+ if sourceType == 0 {
|
|
|
+ sourceType = 1
|
|
|
}
|
|
|
- err = models.UpdateCygxActivityVideoCounts(videoId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "更新失败"
|
|
|
- br.ErrMsg = "更新失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ if sourceType == 1 {
|
|
|
+ //添加活动音频的播放记录
|
|
|
+ go services.AddActivityVoiceHistory(user, sourceId, playSeconds)
|
|
|
+ } else if sourceType == 2 {
|
|
|
+ //添加活动视频的播放记录
|
|
|
+ go services.AddActivityVideoHistory(user, sourceId, playSeconds)
|
|
|
+ } else if sourceType == 3 {
|
|
|
+ //添加产业视频播放记录
|
|
|
+ go services.AddMicroRoadshowVideoRecord(user, sourceId, playSeconds)
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ //问答系列音频播放记录
|
|
|
+ go services.AddAskserieVideoHistoryRecord(user, sourceId, playSeconds)
|
|
|
}
|
|
|
+ go services.AddAllCygxVoiceAndVideoHistory(user, sourceId, sourceType, playSeconds)
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
@@ -380,6 +363,7 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
return
|
|
|
}
|
|
|
sourceType := req.SourceType
|
|
|
+ sourceId := req.SourceId
|
|
|
title := req.Title
|
|
|
if sourceType == 0 {
|
|
|
sourceType = 1
|
|
@@ -397,48 +381,62 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
}
|
|
|
//var resourceId int
|
|
|
if sourceType == 1 {
|
|
|
- activityVoiceInfo, _ := models.GetCygxActivityVoiceById(req.Id)
|
|
|
+ activityVoiceInfo, _ := models.GetCygxActivityVoiceByActivityId(sourceId)
|
|
|
if activityVoiceInfo == nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
|
|
|
return
|
|
|
}
|
|
|
item.ActivityId = activityVoiceInfo.ActivityId
|
|
|
item.Title = activityVoiceInfo.VoiceName
|
|
|
item.ActivityVoiceId = activityVoiceInfo.ActivityVoiceId
|
|
|
title = activityVoiceInfo.VoiceName
|
|
|
- //resourceId = activityVoiceInfo.ActivityId
|
|
|
+ err = models.UpdateActivityVoiceCommentNum(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败 ,更新活动音频留言次数失败:" + strconv.Itoa(sourceId)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if sourceType == 2 {
|
|
|
- activityInfo, _ := models.GetCygxActivityVideoById(req.Id)
|
|
|
+ activityInfo, _ := models.GetCygxActivityVideoByActivityIdInfo(sourceId)
|
|
|
if activityInfo == nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
|
|
|
return
|
|
|
}
|
|
|
item.Title = activityInfo.Title
|
|
|
item.VideoId = activityInfo.Id
|
|
|
item.ActivityId = activityInfo.ActivityId
|
|
|
title = activityInfo.Title
|
|
|
- //resourceId = activityInfo.ActivityId
|
|
|
+ err = models.UpdateActivityVideoCommentNum(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败 ,更新活动视频留言次数失败:" + strconv.Itoa(sourceId)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if sourceType == 3 {
|
|
|
- item.VideoId = req.Id
|
|
|
- microVideo, e := models.GetMicroRoadshowVideoById(req.Id)
|
|
|
+ item.VideoId = sourceId
|
|
|
+ microVideo, e := models.GetMicroRoadshowVideoById(sourceId)
|
|
|
if e != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(req.Id)
|
|
|
+ br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(sourceId)
|
|
|
return
|
|
|
}
|
|
|
item.Title = microVideo.VideoName
|
|
|
item.IndustryId = microVideo.IndustryId
|
|
|
title = microVideo.VideoName
|
|
|
//resourceId = microVideo.IndustryId
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ item.AskserieVideoId = sourceId
|
|
|
+
|
|
|
+ go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
|
|
|
}
|
|
|
var isResearch bool // 是否属于研选
|
|
|
- if sourceType == 2 || sourceType == 3 {
|
|
|
- detail, err := models.GetAddActivityInfoById(req.Id)
|
|
|
+ if sourceType == 1 || sourceType == 2 {
|
|
|
+ detail, err := models.GetAddActivityInfoById(sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
|
|
|
return
|
|
|
}
|
|
|
if strings.Contains(detail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
@@ -483,15 +481,15 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ sourceId := req.SourceId
|
|
|
if req.SourceType == 1 {
|
|
|
- _, err := models.GetCygxActivityVoiceById(req.Id)
|
|
|
+ detail, err := models.GetCygxActivityVoiceByActivityId(sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- count, err := models.GetVoiceCollectCount(uid, req.Id)
|
|
|
+ count, err := models.GetVoiceCollectCount(uid, detail.ActivityVoiceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败!"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -500,7 +498,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
resp := new(models.ArticleCollectResp)
|
|
|
if count <= 0 {
|
|
|
item := new(models.CygxArticleCollect)
|
|
|
- item.ActivityVoiceId = req.Id
|
|
|
+ item.ActivityVoiceId = detail.ActivityVoiceId
|
|
|
item.UserId = uid
|
|
|
item.CreateTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
@@ -519,7 +517,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
// 文章收藏消息发送
|
|
|
//go services.ArticleUserRemind(user, detail, 2)
|
|
|
} else {
|
|
|
- err = models.RemoveVoiceCollect(uid, req.Id)
|
|
|
+ err = models.RemoveVoiceCollect(uid, detail.ActivityVoiceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "取消收藏失败"
|
|
|
br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
@@ -528,7 +526,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Msg = "已取消收藏"
|
|
|
resp.Status = 2
|
|
|
}
|
|
|
- collectTotal, err := models.GetVoiceCollectUsersCount(req.Id)
|
|
|
+ collectTotal, err := models.GetVoiceCollectUsersCount(detail.ActivityVoiceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -539,13 +537,13 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
} else if req.SourceType == 2 {
|
|
|
- _, err := models.GetCygxActivityVideoById(req.Id)
|
|
|
+ detail, err := models.GetCygxActivityVideoByActivityIdInfo(sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- count, err := models.GetActivityVideoCollectCount(uid, req.Id)
|
|
|
+ count, err := models.GetActivityVideoCollectCount(uid, detail.Id)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败!"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -554,7 +552,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
resp := new(models.ArticleCollectResp)
|
|
|
if count <= 0 {
|
|
|
item := new(models.CygxArticleCollect)
|
|
|
- item.ActivityVideoId = req.Id
|
|
|
+ item.ActivityVideoId = detail.Id
|
|
|
item.UserId = uid
|
|
|
item.CreateTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
@@ -573,7 +571,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
// 文章收藏消息发送
|
|
|
//go services.ArticleUserRemind(user, detail, 2)
|
|
|
} else {
|
|
|
- err = models.RemoveActivityVideoCollect(uid, req.Id)
|
|
|
+ err = models.RemoveActivityVideoCollect(uid, detail.Id)
|
|
|
if err != nil {
|
|
|
br.Msg = "取消收藏失败"
|
|
|
br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
@@ -582,7 +580,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Msg = "已取消收藏"
|
|
|
resp.Status = 2
|
|
|
}
|
|
|
- collectTotal, err := models.GetActivityVideoCollectUsersCount(req.Id)
|
|
|
+ collectTotal, err := models.GetActivityVideoCollectUsersCount(detail.Id)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -593,13 +591,13 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
} else if req.SourceType == 3 {
|
|
|
- _, err := models.GetMicroRoadshowVideoById(req.Id)
|
|
|
+ _, err := models.GetMicroRoadshowVideoById(sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- count, err := models.GetVideoCollectCount(uid, req.Id)
|
|
|
+ count, err := models.GetVideoCollectCount(uid, sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败!"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -608,7 +606,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
resp := new(models.ArticleCollectResp)
|
|
|
if count <= 0 {
|
|
|
item := new(models.CygxArticleCollect)
|
|
|
- item.VideoId = req.Id
|
|
|
+ item.VideoId = sourceId
|
|
|
item.UserId = uid
|
|
|
item.CreateTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
@@ -627,7 +625,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
// 文章收藏消息发送
|
|
|
//go services.ArticleUserRemind(user, detail, 2)
|
|
|
} else {
|
|
|
- err = models.RemoveVideoCollect(uid, req.Id)
|
|
|
+ err = models.RemoveVideoCollect(uid, sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "取消收藏失败"
|
|
|
br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
@@ -636,7 +634,7 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Msg = "已取消收藏"
|
|
|
resp.Status = 2
|
|
|
}
|
|
|
- collectTotal, err := models.GetVideoCollectUsersCount(req.Id)
|
|
|
+ collectTotal, err := models.GetVideoCollectUsersCount(sourceId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -646,5 +644,81 @@ func (this *MicroRoadShowController) Collect() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
+ } else if req.SourceType == 4 {
|
|
|
+ // 系列问答视频收藏
|
|
|
+ count, err := models.GetAskserieVideoCount(uid, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
+ if count <= 0 {
|
|
|
+ item := new(models.CygxAskserieVideoCollect)
|
|
|
+ item.AskserieVideoId = sourceId
|
|
|
+ item.UserId = uid
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = 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
|
|
|
+ // 文章收藏消息发送
|
|
|
+ } else {
|
|
|
+ err = models.RemoveAskserieVideoCollect(uid, sourceId)
|
|
|
+ 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
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// @Title 问答系列视频详情
|
|
|
+// @Description 问答系列视频详情接口
|
|
|
+// @Param VideoId query int true "视频ID"
|
|
|
+// @Success 200 {object} models.IndustryVideoDetailResp
|
|
|
+// @router /askserie_video/detail [get]
|
|
|
+func (this *MicroRoadShowController) AskserieVideoDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ askserieVideoId, _ := this.GetInt("VideoId")
|
|
|
+ videoSimple, au, err := services.GetAskserieVideoDetailById(user, askserieVideoId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.IndustryVideoDetailResp)
|
|
|
+ resp.IndustryVideo = videoSimple
|
|
|
+ resp.AuthInfo = au
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|