|
@@ -7,6 +7,7 @@ import (
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/utils"
|
|
"hongze/hongze_cygx/utils"
|
|
"strconv"
|
|
"strconv"
|
|
|
|
+ "strings"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -22,6 +23,9 @@ type MicroRoadShowController struct {
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
// @Param AudioId query int false "音频ID"
|
|
// @Param AudioId query int false "音频ID"
|
|
// @Param VideoId 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 ActivityVideoId query int false "活动视频ID"
|
|
// @Param Filter query int false "筛选条件 0:全部 1:视频 2:音频"
|
|
// @Param Filter query int false "筛选条件 0:全部 1:视频 2:音频"
|
|
// @Success 200 {object} models.HomeListResp
|
|
// @Success 200 {object} models.HomeListResp
|
|
@@ -44,6 +48,9 @@ func (this *MicroRoadShowController) List() {
|
|
keywords := this.GetString("KeyWord")
|
|
keywords := this.GetString("KeyWord")
|
|
audioId, _ := this.GetInt("AudioId")
|
|
audioId, _ := this.GetInt("AudioId")
|
|
videoId, _ := this.GetInt("VideoId")
|
|
videoId, _ := this.GetInt("VideoId")
|
|
|
|
+ audioIds := this.GetString("AudioIds")
|
|
|
|
+ videoIds := this.GetString("VideoIds")
|
|
|
|
+ activityVideoIds := this.GetString("ActivityVideoIds")
|
|
activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
filter, _ := this.GetInt("Filter", 0)
|
|
filter, _ := this.GetInt("Filter", 0)
|
|
|
|
|
|
@@ -55,13 +62,48 @@ func (this *MicroRoadShowController) List() {
|
|
}
|
|
}
|
|
|
|
|
|
// 微路演列表
|
|
// 微路演列表
|
|
- list, total, e := services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
|
|
|
|
|
|
+ list, total, e := services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords, audioIds, videoIds, activityVideoIds)
|
|
if e != nil {
|
|
if e != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
return
|
|
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
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 用户权限
|
|
// 用户权限
|
|
authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
if e != nil {
|
|
if e != nil {
|
|
@@ -238,3 +280,461 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
br.Msg = "操作成功"
|
|
br.Msg = "操作成功"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @Title 微路演新增留言
|
|
|
|
+// @Description 微路演新增留言接口
|
|
|
|
+// @Param request body models.AddVideoCommnetReq true "type json string"
|
|
|
|
+// @Success Ret=200 {object} models.AppointmentResp
|
|
|
|
+// @router /comment/add [post]
|
|
|
|
+func (this *MicroRoadShowController) CommentAdd() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ user := this.User
|
|
|
|
+ if user == nil {
|
|
|
|
+ br.Msg = "请登录"
|
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
|
+ br.Ret = 408
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ uid := user.UserId
|
|
|
|
+ var req models.AddVideoCommnetReq
|
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sourceType := req.SourceType
|
|
|
|
+
|
|
|
|
+ if sourceType == 0 {
|
|
|
|
+ sourceType = 1
|
|
|
|
+ }
|
|
|
|
+ item := models.CygxArticleComment{
|
|
|
|
+ UserId: uid,
|
|
|
|
+ CreateTime: time.Now(),
|
|
|
|
+ RealName: user.RealName,
|
|
|
|
+ Mobile: user.Mobile,
|
|
|
|
+ Email: user.Email,
|
|
|
|
+ CompanyId: user.CompanyId,
|
|
|
|
+ CompanyName: user.CompanyName,
|
|
|
|
+ Content: req.Content,
|
|
|
|
+ Title: req.Title,
|
|
|
|
+ }
|
|
|
|
+ if sourceType == 1 {
|
|
|
|
+ activityVoiceInfo, _ := models.GetCygxActivityVoiceByActivityId(req.Id)
|
|
|
|
+ if activityVoiceInfo == nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.ActivityId = req.Id
|
|
|
|
+ item.ActivityVoiceId = activityVoiceInfo.ActivityVoiceId
|
|
|
|
+ } else if sourceType == 2 {
|
|
|
|
+ activityInfo, _ := models.GetCygxActivityVideoByActivityId(req.Id)
|
|
|
|
+ if activityInfo == nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.VideoId = activityInfo.VideoId
|
|
|
|
+ item.ActivityId = req.Id
|
|
|
|
+ } else if sourceType == 3 {
|
|
|
|
+ item.VideoId = req.Id
|
|
|
|
+ microVideo, e := models.GetMicroRoadshowVideoById(req.Id)
|
|
|
|
+ if e != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(req.Id)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.IndustryId = microVideo.IndustryId
|
|
|
|
+ }
|
|
|
|
+ _, err = models.AddArticleComment(&item)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "提交失败"
|
|
|
|
+ br.ErrMsg = "提交留言失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ services.SendWxMsgWithMicroRoadshowAsk(req, user)
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "操作成功"
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 微路演收藏
|
|
|
|
+// @Description 微路演收藏
|
|
|
|
+// @Param request body models.MicroRoadshowCollectReq true "type json string"
|
|
|
|
+// @Success 200 {object} models.FontsCollectResp
|
|
|
|
+// @router /collect [post]
|
|
|
|
+func (this *MicroRoadShowController) Collect() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ uid := user.UserId
|
|
|
|
+ var req models.MicroRoadshowCollectReq
|
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if req.SourceType == 1 {
|
|
|
|
+ _, err := models.GetCygxActivityVoiceById(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ count, err := models.GetVoiceCollectCount(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
|
+ if count <= 0 {
|
|
|
|
+ item := new(models.CygxArticleCollect)
|
|
|
|
+ item.ActivityVoiceId = 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
|
|
|
|
+ _, err = models.AddCygxArticleCollect(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.RemoveVoiceCollect(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "取消收藏失败"
|
|
|
|
+ br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ br.Msg = "已取消收藏"
|
|
|
|
+ resp.Status = 2
|
|
|
|
+ }
|
|
|
|
+ collectTotal, err := models.GetVoiceCollectUsersCount(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.CollectCount = collectTotal
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ } else if req.SourceType == 2 {
|
|
|
|
+ _, err := models.GetCygxActivityVideoById(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ count, err := models.GetActivityVideoCollectCount(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
|
+ if count <= 0 {
|
|
|
|
+ item := new(models.CygxArticleCollect)
|
|
|
|
+ item.ActivityVideoId = 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
|
|
|
|
+ _, err = models.AddCygxArticleCollect(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.RemoveActivityVideoCollect(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "取消收藏失败"
|
|
|
|
+ br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ br.Msg = "已取消收藏"
|
|
|
|
+ resp.Status = 2
|
|
|
|
+ }
|
|
|
|
+ collectTotal, err := models.GetActivityVideoCollectUsersCount(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.CollectCount = collectTotal
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ } else if req.SourceType == 3 {
|
|
|
|
+ _, err := models.GetMicroRoadshowVideoById(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ count, err := models.GetVideoCollectCount(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
|
+ if count <= 0 {
|
|
|
|
+ item := new(models.CygxArticleCollect)
|
|
|
|
+ item.VideoId = 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
|
|
|
|
+ _, err = models.AddCygxArticleCollect(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.RemoveVideoCollect(uid, req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "取消收藏失败"
|
|
|
|
+ br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ br.Msg = "已取消收藏"
|
|
|
|
+ resp.Status = 2
|
|
|
|
+ }
|
|
|
|
+ collectTotal, err := models.GetVideoCollectUsersCount(req.Id)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.CollectCount = collectTotal
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 我的收藏微路演列表
|
|
|
|
+// @Description 我的收藏微路演列表接口
|
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
|
+// @Success 200 {object} models.HomeListResp
|
|
|
|
+// @router /mycollect [get]
|
|
|
|
+func (this *MicroRoadShowController) Mycollect() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ user := this.User
|
|
|
|
+ if user == nil {
|
|
|
|
+ br.Msg = "请登录"
|
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
|
+ br.Ret = 408
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
|
+
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ userId := user.UserId
|
|
|
|
+ listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var audioIds []string
|
|
|
|
+ var videoIds []string
|
|
|
|
+ var activityVideoIds []string
|
|
|
|
+ for _, item := range listMycollect {
|
|
|
|
+ if item.ActivityVoiceId > 0 {
|
|
|
|
+ audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
|
|
|
|
+ } else if item.VideoId > 0 {
|
|
|
|
+ videoIds = append(videoIds, strconv.Itoa(item.VideoId))
|
|
|
|
+ } else if item.ActivityVideoId > 0 {
|
|
|
|
+ activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 {
|
|
|
|
+ resp := new(models.MicroRoadShowListResp)
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
|
+ resp.List = make([]*models.MicroRoadShowPageList, 0)
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ audioIdstr := strings.Join(audioIds, ",")
|
|
|
|
+ ideoIdsStr := strings.Join(videoIds, ",")
|
|
|
|
+ activityVideoIdsStr := strings.Join(activityVideoIds, ",")
|
|
|
|
+ // 微路演列表
|
|
|
|
+ list, total, e := services.GetMicroRoadShowMycollect(pageSize, currentIndex, audioIdstr, ideoIdsStr, activityVideoIdsStr)
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 用户权限
|
|
|
|
+ authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取默认图配置
|
|
|
|
+ audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
|
|
|
|
+ if e != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i := range list {
|
|
|
|
+ // 权限
|
|
|
|
+ au := new(models.UserPermissionAuthInfo)
|
|
|
|
+ au.SellerName = authInfo.SellerName
|
|
|
|
+ au.SellerMobile = authInfo.SellerMobile
|
|
|
|
+ au.HasPermission = authInfo.HasPermission
|
|
|
|
+ au.OperationMode = authInfo.OperationMode
|
|
|
|
+ if au.HasPermission == 1 {
|
|
|
|
+ // 非宏观权限进一步判断是否有权限
|
|
|
|
+ if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
|
|
|
|
+ au.HasPermission = 2
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 无权限的弹框提示
|
|
|
|
+ if au.HasPermission != 1 {
|
|
|
|
+ if au.OperationMode == services.UserPermissionOperationModeCall {
|
|
|
|
+ if list[i].Type == 1 {
|
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgCallActivity
|
|
|
|
+ } else {
|
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if list[i].Type == 1 {
|
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgApplyActivity
|
|
|
|
+ } else {
|
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ list[i].AuthInfo = au
|
|
|
|
+ list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
|
|
|
|
+ // 默认图
|
|
|
|
+ if list[i].BackgroundImg == "" {
|
|
|
|
+ if list[i].Type == 1 {
|
|
|
|
+ list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
|
|
|
|
+ } else {
|
|
|
|
+ list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 分享图
|
|
|
|
+ if list[i].ShareImg == "" {
|
|
|
|
+ if list[i].Type == 1 {
|
|
|
|
+ list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
|
|
|
|
+ } else {
|
|
|
|
+ list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ resp := new(models.MicroRoadShowListResp)
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|