Forráskód Böngészése

Merge branch 'cygx_12.4' of http://8.136.199.33:3000/cxzhang/hongze_clpt into debug

xingzai 1 éve
szülő
commit
b276c38c0c

+ 32 - 0
controllers/chart_permission.go

@@ -124,3 +124,35 @@ func (this *MobileChartPermissionAuthController) ListByActivity() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选)
+// @Description 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选)
+// @Success 200 {object} models.ChartPermissionResp
+// @router /noyx [get]
+func (this *MobileChartPermissionAuthController) Noyx() {
+	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
+	}
+	var condition string
+	condition += ` AND permission_name IN ('医药','消费','科技','智造','策略') `
+	list, err := models.GetChartPermissionReportAll(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ChartPermissionListResp)
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 39 - 41
controllers/micro_roadshow.go

@@ -21,10 +21,7 @@ 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:问答系列"
@@ -286,7 +283,7 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 		return
 	}
 
-	videoId := req.VideoId
+	sourceId := req.SourceId
 	playSeconds := req.PlaySeconds
 	sourceType := req.SourceType
 
@@ -302,10 +299,10 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 	}
 	if sourceType == 1 {
 		//添加活动音频的播放记录
-		go services.AddActivityVoiceHistory(user, videoId, playSeconds)
+		go services.AddActivityVoiceHistory(user, sourceId, playSeconds)
 	} else if sourceType == 2 {
 		//添加活动视频的播放记录
-		go services.AddActivityVideoHistory(user, videoId, playSeconds)
+		go services.AddActivityVideoHistory(user, sourceId, playSeconds)
 		//if err != nil {
 		//	br.Msg = "更新失败"
 		//	br.ErrMsg = "更新失败,AddActivityVideoHistory Err:" + err.Error()
@@ -313,7 +310,7 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 		//}
 	} else if sourceType == 3 {
 		item := models.CygxMicroRoadshowVideoHistory{
-			VideoId:     videoId,
+			VideoId:     sourceId,
 			UserId:      uid,
 			Mobile:      user.Mobile,
 			Email:       user.Email,
@@ -326,7 +323,7 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 			ModifyTime:  time.Now(),
 		}
 		if playSeconds != 0 {
-			lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
+			lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(sourceId, user.UserId)
 			if err != nil {
 				br.Msg = "操作失败"
 				br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()
@@ -345,16 +342,16 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 				br.ErrMsg = "操作失败,Err:" + err.Error()
 				return
 			}
-			err = models.UpdateCygxActivityVideoCounts(videoId)
+			err = models.UpdateCygxActivityVideoCounts(sourceId)
 			if err != nil {
 				br.Msg = "更新失败"
 				br.ErrMsg = "更新失败,Err:" + err.Error()
 				return
 			}
 		}
-		go services.MicroRoadshowVideoUserRmind(user, videoId)
+		go services.MicroRoadshowVideoUserRmind(user, sourceId)
 	} else if sourceType == 4 {
-		go services.AddAskserieVideoHistoryRecord(user, videoId, playSeconds)
+		go services.AddAskserieVideoHistoryRecord(user, sourceId, playSeconds)
 	}
 	br.Ret = 200
 	br.Success = true
@@ -394,6 +391,7 @@ func (this *MicroRoadShowController) CommentAdd() {
 		return
 	}
 	sourceType := req.SourceType
+	sourceId := req.SourceId
 	title := req.Title
 	if sourceType == 0 {
 		sourceType = 1
@@ -411,10 +409,10 @@ func (this *MicroRoadShowController) CommentAdd() {
 	}
 	//var resourceId int
 	if sourceType == 1 {
-		activityVoiceInfo, _ := models.GetCygxActivityVoiceById(req.Id)
+		activityVoiceInfo, _ := models.GetCygxActivityVoiceById(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
@@ -423,10 +421,10 @@ func (this *MicroRoadShowController) CommentAdd() {
 		title = activityVoiceInfo.VoiceName
 		//resourceId = activityVoiceInfo.ActivityId
 	} else if sourceType == 2 {
-		activityInfo, _ := models.GetCygxActivityVideoById(req.Id)
+		activityInfo, _ := models.GetCygxActivityVideoById(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
@@ -435,11 +433,11 @@ func (this *MicroRoadShowController) CommentAdd() {
 		title = activityInfo.Title
 		//resourceId = activityInfo.ActivityId
 	} 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
@@ -447,16 +445,16 @@ func (this *MicroRoadShowController) CommentAdd() {
 		title = microVideo.VideoName
 		//resourceId = microVideo.IndustryId
 	} else if sourceType == 4 {
-		item.AskserieVideoId = req.Id
+		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)
+		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) {
@@ -501,15 +499,15 @@ func (this *MicroRoadShowController) Collect() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
-
+	sourceId := req.SourceId
 	if req.SourceType == 1 {
-		_, err := models.GetCygxActivityVoiceById(req.Id)
+		_, err := models.GetCygxActivityVoiceById(sourceId)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + err.Error()
 			return
 		}
-		count, err := models.GetVoiceCollectCount(uid, req.Id)
+		count, err := models.GetVoiceCollectCount(uid, sourceId)
 		if err != nil {
 			br.Msg = "获取数据失败!"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -518,7 +516,7 @@ func (this *MicroRoadShowController) Collect() {
 		resp := new(models.ArticleCollectResp)
 		if count <= 0 {
 			item := new(models.CygxArticleCollect)
-			item.ActivityVoiceId = req.Id
+			item.ActivityVoiceId = sourceId
 			item.UserId = uid
 			item.CreateTime = time.Now()
 			item.Mobile = user.Mobile
@@ -537,7 +535,7 @@ func (this *MicroRoadShowController) Collect() {
 			// 文章收藏消息发送
 			//go services.ArticleUserRemind(user, detail, 2)
 		} else {
-			err = models.RemoveVoiceCollect(uid, req.Id)
+			err = models.RemoveVoiceCollect(uid, sourceId)
 			if err != nil {
 				br.Msg = "取消收藏失败"
 				br.ErrMsg = "取消收藏失败,Err:" + err.Error()
@@ -546,7 +544,7 @@ func (this *MicroRoadShowController) Collect() {
 			br.Msg = "已取消收藏"
 			resp.Status = 2
 		}
-		collectTotal, err := models.GetVoiceCollectUsersCount(req.Id)
+		collectTotal, err := models.GetVoiceCollectUsersCount(sourceId)
 		if err != nil {
 			br.Msg = "获取数据失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -557,13 +555,13 @@ func (this *MicroRoadShowController) Collect() {
 		br.Success = true
 		br.Data = resp
 	} else if req.SourceType == 2 {
-		_, err := models.GetCygxActivityVideoById(req.Id)
+		_, err := models.GetCygxActivityVideoById(sourceId)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + err.Error()
 			return
 		}
-		count, err := models.GetActivityVideoCollectCount(uid, req.Id)
+		count, err := models.GetActivityVideoCollectCount(uid, sourceId)
 		if err != nil {
 			br.Msg = "获取数据失败!"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -572,7 +570,7 @@ func (this *MicroRoadShowController) Collect() {
 		resp := new(models.ArticleCollectResp)
 		if count <= 0 {
 			item := new(models.CygxArticleCollect)
-			item.ActivityVideoId = req.Id
+			item.ActivityVideoId = sourceId
 			item.UserId = uid
 			item.CreateTime = time.Now()
 			item.Mobile = user.Mobile
@@ -591,7 +589,7 @@ func (this *MicroRoadShowController) Collect() {
 			// 文章收藏消息发送
 			//go services.ArticleUserRemind(user, detail, 2)
 		} else {
-			err = models.RemoveActivityVideoCollect(uid, req.Id)
+			err = models.RemoveActivityVideoCollect(uid, sourceId)
 			if err != nil {
 				br.Msg = "取消收藏失败"
 				br.ErrMsg = "取消收藏失败,Err:" + err.Error()
@@ -600,7 +598,7 @@ func (this *MicroRoadShowController) Collect() {
 			br.Msg = "已取消收藏"
 			resp.Status = 2
 		}
-		collectTotal, err := models.GetActivityVideoCollectUsersCount(req.Id)
+		collectTotal, err := models.GetActivityVideoCollectUsersCount(sourceId)
 		if err != nil {
 			br.Msg = "获取数据失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -611,13 +609,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()
@@ -626,7 +624,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
@@ -645,7 +643,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()
@@ -654,7 +652,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()
@@ -666,7 +664,7 @@ func (this *MicroRoadShowController) Collect() {
 		br.Data = resp
 	} else if req.SourceType == 4 {
 		// 系列问答视频收藏
-		count, err := models.GetAskserieVideoCount(uid, req.Id)
+		count, err := models.GetAskserieVideoCount(uid, sourceId)
 		if err != nil {
 			br.Msg = "获取数据失败!"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -675,7 +673,7 @@ func (this *MicroRoadShowController) Collect() {
 		resp := new(models.ArticleCollectResp)
 		if count <= 0 {
 			item := new(models.CygxAskserieVideoCollect)
-			item.AskserieVideoId = req.Id
+			item.AskserieVideoId = sourceId
 			item.UserId = uid
 			item.CreateTime = time.Now()
 			item.Mobile = user.Mobile
@@ -695,7 +693,7 @@ func (this *MicroRoadShowController) Collect() {
 			// 文章收藏消息发送
 			//go services.ArticleUserRemind(user, detail, 2)
 		} else {
-			err = models.RemoveAskserieVideoCollect(uid, req.Id)
+			err = models.RemoveAskserieVideoCollect(uid, sourceId)
 			if err != nil {
 				br.Msg = "取消收藏失败"
 				br.ErrMsg = "取消收藏失败,Err:" + err.Error()

+ 5 - 3
models/micro_roadshow.go

@@ -63,7 +63,7 @@ func GetMicroRoadshowVideoByVideoId(videoId int) (item *CygxMicroRoadshowVideo,
 }
 
 type AddVideoHistoryReq struct {
-	VideoId     int `description:"视频ID"`
+	SourceId    int `description:"资源ID"`
 	PlaySeconds int `description:"播放时长"`
 	SourceType  int `description:"音视频来源: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
 }
@@ -610,12 +610,14 @@ func GetMicroRoadShowVideoPageListIkWord(startSize, pageSize int, condition stri
 }
 
 type AddVideoCommnetReq struct {
-	Id         int    `description:"活动或产业ID"`
+	//Id         int    `description:"活动或产业ID"`
+	SourceId   int    `description:"资源ID"`
 	SourceType int    `description:"视频来源: 1-音频; 2-活动视频; 3-微路演视频 (不传默认为1)"`
 	Content    string `description:"内容"`
 	Title      string `description:"标题"`
 }
 type MicroRoadshowCollectReq struct {
-	Id         int `description:"音频或视频ID"`
+	//Id         int `description:"音频或视频ID"`
+	SourceId   int `description:"资源ID"`
 	SourceType int `description:"视频来源: 1-音频; 2-活动视频; 3-微路演视频 (不传默认为1)"`
 }

+ 9 - 0
routers/commentsRouter.go

@@ -493,6 +493,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileChartPermissionAuthController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileChartPermissionAuthController"],
+        beego.ControllerComments{
+            Method: "Noyx",
+            Router: `/noyx`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileHomeController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileHomeController"],
         beego.ControllerComments{
             Method: "List",

+ 2 - 2
services/wx_template_msg.go

@@ -172,7 +172,7 @@ func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.W
 	var msg string
 	defer func() {
 		if err != nil || msg != "" {
-			go utils.SendAlarmMsg(fmt.Sprint("发送微路演新增留言提问消息提醒失败,用户名", req.Title, "ID:", req.Id), 2)
+			go utils.SendAlarmMsg(fmt.Sprint("发送微路演新增留言提问消息提醒失败,用户名", req.Title, "ID:", req.SourceId), 2)
 		}
 	}()
 
@@ -244,7 +244,7 @@ func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.W
 	sendInfo.TemplateId = utils.WxMsgTemplateIdApplyXzs
 	sendInfo.RedirectUrl = redirectUrl
 	sendInfo.RedirectTarget = 3
-	sendInfo.Resource = strconv.Itoa(req.Id)
+	sendInfo.Resource = strconv.Itoa(req.SourceId)
 	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_COMMENT
 	sendInfo.OpenIdArr = openIdArr
 	err = PublicSendTemplateMsg(sendInfo)