Browse Source

Merge branch 'cygx_12.8.1' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 year ago
parent
commit
74af3c585a
3 changed files with 145 additions and 2 deletions
  1. 133 0
      controllers/micro_roadshow.go
  2. 3 2
      models/micro_roadshow.go
  3. 9 0
      routers/commentsRouter.go

+ 133 - 0
controllers/micro_roadshow.go

@@ -865,3 +865,136 @@ func (this *MicroRoadShowController) CommentDetail() {
 	br.Msg = "操作成功"
 	return
 }
+
+// @Title 策略系列培训视频
+// @Description 策略系列培训视频接口
+// @Param   PageSize		query	int		true	"每页数据条数"
+// @Param   CurrentIndex	query	int		true	"当前页页码,从1开始"
+// @Success 200 {object} models.HomeListResp
+// @router /training/list [get]
+func (this *MicroRoadShowController) TrainingList() {
+	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
+	}
+
+	var audioIds []string
+	var videoIds []string
+	var activityVideoIds []string
+	var askserieVideoIds []string                                                                                                  //问答系列视频
+	activityVideoIds = []string{"461", "462", "463", "464", "465", "466"}                                                          // 系列培训视频,固定的六个,这里先写死
+	activityVideoTitle := []string{"第一期_A股运行特征探讨", "第二期_行业比较研究", "第三期_市场风格观察与我们的研究方法", "第四期_市场估值指标追踪", "第五期_宏观经济研究", "第六期_市场回顾专题"} // 系列培训视频,固定的六个,这里先写死
+	audioIdstr := strings.Join(audioIds, ",")
+	ideoIdsStr := strings.Join(videoIds, ",")
+	activityVideoIdsStr := strings.Join(activityVideoIds, ",")
+	askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
+	// 微路演列表
+	list, total, e := services.GetMicroRoadShowMycollectV12(pageSize, currentIndex, audioIdstr, activityVideoIdsStr, ideoIdsStr, askserieVideoIdsStr, user)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
+		return
+	}
+
+	//存储反转数据
+	reversed := []*models.MicroRoadShowPageList{}
+	for i := range list {
+		n := list[len(list)-1-i]
+		reversed = append(reversed, n)
+	}
+	list = reversed
+
+	// 用户权限
+	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]
+			}
+		}
+		if i <= len(activityVideoTitle)-1 {
+			list[i].Title = activityVideoTitle[i]
+		}
+	}
+
+	resp := new(models.MicroRoadShowListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = list
+	resp.Paging = page
+	resp.Describe = "弘则策略首席 马冬凡 主讲"
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 3 - 2
models/micro_roadshow.go

@@ -9,8 +9,9 @@ import (
 
 // MicroRoadShowListResp 微路演列表响应体
 type MicroRoadShowListResp struct {
-	Paging *paging.PagingItem
-	List   []*MicroRoadShowPageList
+	Paging   *paging.PagingItem
+	List     []*MicroRoadShowPageList
+	Describe string `description:"说明"`
 }
 
 type CygxMicroRoadshowVideo struct {

+ 9 - 0
routers/commentsRouter.go

@@ -871,6 +871,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"],
+        beego.ControllerComments{
+            Method: "TrainingList",
+            Router: `/training/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MicroRoadShowController"],
         beego.ControllerComments{
             Method: "VideoHistoryAdd",