|
@@ -2,6 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "github.com/medivhzhan/weapp/v2"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_clpt/models"
|
|
|
"hongze/hongze_clpt/services"
|
|
@@ -104,6 +105,44 @@ func (this *MicroRoadShowController) List() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ userId := user.UserId
|
|
|
+ listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapaudioIds := make(map[int]int) //活动音频
|
|
|
+ mapvideoIds := make(map[int]int) // 微路演视频
|
|
|
+ mapactivityVideoIds := 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, item := range list {
|
|
|
+ if item.Type == 1 {
|
|
|
+ //音频
|
|
|
+ if mapaudioIds[item.Id] > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ } else if item.Type == 2 {
|
|
|
+ //活动视频
|
|
|
+ if mapactivityVideoIds[item.Id] > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ } else if item.Type == 3 {
|
|
|
+ //微路演视频
|
|
|
+ if mapvideoIds[item.Id] > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 用户权限
|
|
|
authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
|
if e != nil {
|
|
@@ -335,6 +374,31 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ content := req.Content
|
|
|
+ if content == "" {
|
|
|
+ br.Msg = "留言内容不能为空!"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ itemToken, err := services.WxGetToken()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if itemToken.AccessToken == "" {
|
|
|
+ br.Msg = "accessToken is empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "内容校验失败!"
|
|
|
+ br.ErrMsg = "内容校验失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if commerr.ErrCode != 0 {
|
|
|
+ br.Msg = "内容违规,请重新提交!"
|
|
|
+ br.ErrMsg = "内容违规,Err:" + commerr.ErrMSG
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
sourceType := req.SourceType
|
|
|
|
|
@@ -361,6 +425,7 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
return
|
|
|
}
|
|
|
item.ActivityId = req.Id
|
|
|
+ item.Title = activityVoiceInfo.VoiceName
|
|
|
item.ActivityVoiceId = activityVoiceInfo.ActivityVoiceId
|
|
|
resourceId = activityVoiceInfo.ActivityId
|
|
|
} else if sourceType == 2 {
|
|
@@ -370,6 +435,7 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
|
|
|
return
|
|
|
}
|
|
|
+ item.Title = activityInfo.VideoName
|
|
|
item.VideoId = activityInfo.VideoId
|
|
|
item.ActivityId = req.Id
|
|
|
resourceId = activityInfo.ActivityId
|
|
@@ -381,6 +447,7 @@ func (this *MicroRoadShowController) CommentAdd() {
|
|
|
br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(req.Id)
|
|
|
return
|
|
|
}
|
|
|
+ item.Title = microVideo.VideoName
|
|
|
item.IndustryId = microVideo.IndustryId
|
|
|
resourceId = microVideo.IndustryId
|
|
|
}
|