|
@@ -2,6 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/services"
|
|
@@ -21,14 +22,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 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() {
|
|
@@ -47,14 +45,11 @@ 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")
|
|
|
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 +71,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 {
|
|
@@ -121,15 +88,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 {
|
|
|
//音频
|
|
@@ -146,6 +128,11 @@ 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
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 用户权限
|
|
@@ -242,7 +229,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 {
|
|
@@ -250,71 +236,25 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- videoId := req.VideoId
|
|
|
+ sourceId := req.SourceId
|
|
|
playSeconds := req.PlaySeconds
|
|
|
sourceType := req.SourceType
|
|
|
-
|
|
|
if sourceType == 0 {
|
|
|
sourceType = 1
|
|
|
}
|
|
|
- var sellerName string
|
|
|
- sellerName, err = models.GetCompanySellerName(user.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "报名失败!"
|
|
|
- br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
if sourceType == 1 {
|
|
|
- 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)
|
|
|
+ //添加活动音频的播放记录
|
|
|
+ go services.AddActivityVoiceHistory(user, sourceId, playSeconds)
|
|
|
} else if sourceType == 2 {
|
|
|
- err = services.AddActivityVideoHistory(user, videoId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "更新失败"
|
|
|
- br.ErrMsg = "更新失败,AddActivityVideoHistory Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ //添加活动视频的播放记录
|
|
|
+ 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 = "操作成功"
|
|
@@ -353,6 +293,7 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
if sourceType == 0 {
|
|
|
sourceType = 1
|
|
|
}
|
|
|
+ fmt.Println(sourceType)
|
|
|
item := models.CygxArticleComment{
|
|
|
UserId: uid,
|
|
|
CreateTime: time.Now(),
|
|
@@ -364,45 +305,58 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
Content: req.Content,
|
|
|
Title: req.Title,
|
|
|
}
|
|
|
-
|
|
|
+ sourceId := req.SourceId
|
|
|
//var resourceId int
|
|
|
if sourceType == 1 {
|
|
|
- activityVoiceInfo, _ := models.GetCygxActivityVoiceByActivityId(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 = req.Id
|
|
|
+ item.ActivityId = sourceId
|
|
|
item.ActivityVoiceId = activityVoiceInfo.ActivityVoiceId
|
|
|
- //resourceId = activityVoiceInfo.ActivityId
|
|
|
+ err = models.UpdateActivityVoiceCommentNum(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败 ,更新活动音频留言次数失败:" + strconv.Itoa(sourceId)
|
|
|
+ return
|
|
|
+ }
|
|
|
} else if sourceType == 2 {
|
|
|
- activityInfo, _ := models.GetCygxActivityVideoByActivityId(req.Id)
|
|
|
+ activityInfo, _ := models.GetCygxActivityVideoByActivityId(sourceId)
|
|
|
if activityInfo == nil {
|
|
|
br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
|
|
|
return
|
|
|
}
|
|
|
item.VideoId = activityInfo.VideoId
|
|
|
- item.ActivityId = req.Id
|
|
|
- //resourceId = activityInfo.ActivityId
|
|
|
+ item.ActivityId = sourceId
|
|
|
+ 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.IndustryId = microVideo.IndustryId
|
|
|
//resourceId = microVideo.IndustryId
|
|
|
+ } else if sourceType == 4 {
|
|
|
+ item.AskserieVideoId = sourceId
|
|
|
+ go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
|
|
|
}
|
|
|
|
|
|
- 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) {
|
|
@@ -448,15 +402,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()
|
|
@@ -465,7 +419,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
|
|
@@ -484,7 +438,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()
|
|
@@ -493,7 +447,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()
|
|
@@ -504,13 +458,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()
|
|
@@ -519,9 +473,10 @@ 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.ModifyTime = time.Now()
|
|
|
item.Mobile = user.Mobile
|
|
|
item.Email = user.Email
|
|
|
item.CompanyId = user.CompanyId
|
|
@@ -538,7 +493,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()
|
|
@@ -547,7 +502,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()
|
|
@@ -558,13 +513,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()
|
|
@@ -573,7 +528,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
|
|
@@ -592,7 +547,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()
|
|
@@ -601,7 +556,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()
|
|
@@ -611,6 +566,49 @@ 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.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, 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
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -650,9 +648,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 +668,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 +686,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, user)
|
|
|
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)
|