xingzai 1 rok pred
rodič
commit
c8e28c7331
3 zmenil súbory, kde vykonal 45 pridanie a 37 odobranie
  1. 35 30
      controllers/activity.go
  2. 9 6
      models/activity_type.go
  3. 1 1
      routers/commentsRouter.go

+ 35 - 30
controllers/activity.go

@@ -2179,6 +2179,7 @@ func (this *ActivityCoAntroller) CheckAsk() {
 // @Param   WhichMonth   query   string  false       "哪一月 本月:1 上月:2"
 // @Param   WhichMonth   query   string  false       "哪一月 本月:1 上月:2"
 // @Param   IsPower   query   int  false       "是否选择有权限行业 ,1是 0 否 默认0"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} models.ActivityTypeListHomeResp
 // @router /labelTypeListV5 [get]
 func (this *ActivityCoAntroller) LabelTypeListV5() {
@@ -2198,7 +2199,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	chartPermissionIds := this.GetString("ChartPermissionIds")
 	whichDay := this.GetString("WhichDay")
 	activeState := this.GetString("ActiveState")
-
+	isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
 	//入参为 undefined 时的处理
 	if chartPermissionIds == "undefined" {
 		chartPermissionIds = ""
@@ -2209,6 +2210,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	if activeState == "undefined" || activeState == "" {
 		activeState = "1"
 	}
+
 	// 查研观向7.4-始终查询宏观的活动
 	if chartPermissionIds != "" {
 		chartPermissionIds += ",1"
@@ -2249,14 +2251,12 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	permissionNameStr = strings.Replace(permissionNameStr, "(主观)", "", -1)
 	permissionNameStr = strings.Replace(permissionNameStr, "(客观)", "", -1)
 	permissionNameStr = strings.TrimRight(permissionNameStr, ",")
-	//
-	//// 查研观向7.4-始终查询宏观的权限(无论是否有权限)
-	//if permissionNameStr == `` {
-	//	permissionNameStr = `'宏观'`
-	//} else {
-	//	permissionNameStr += `, '宏观'`
-	//}
 
+	if isResearch {
+		chartPermissionIds = strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
+	} else {
+		conditioninit += ` AND ( art.chart_permission_id  !=  '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'  OR  ( art.is_show_hz = 1 AND art.chart_permission_id  =  '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `')  )`
+	}
 	//行业名称
 	if len(chartPermissionIds) > 0 {
 		conditioninit += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
@@ -2311,7 +2311,6 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	} else {
 		conditioninit += ` AND art.active_state  IN (1,2)`
 	}
-
 	var condition string
 	//conditionActivity, err := services.GetActivityonditionList(user, "", chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
 
@@ -2362,13 +2361,19 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 		mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)] = item.KeyWord
 	}
 	//
-	list, err := models.GetActivityTypeHomeList()
+	var conditionType string
+	var parsType []interface{}
+	if isResearch {
+		conditionType = "  AND  source_type IN (0,2) "
+	} else {
+		conditionType = " AND source_type IN (0,1) "
+	}
+	list, err := models.GetActivityTypeHomeList(conditionType, parsType)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-
 	resp := new(models.ActivityTypeListHomeResp)
 	for k, v := range list {
 		if len(mapActivity[v.ActivityTypeId]) > 0 {
@@ -2410,11 +2415,9 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 		return
 	}
 	for k, _ := range list {
-		//if v.ActivityTypeId == 1 {
 		for k2 := range list[k].List {
 			list[k].List[k2].IsNew = newLabelMap[list[k].List[k2].ActivityId]
 		}
-		//}
 	}
 
 	var itemsNew []*models.ActivityTypeHome
@@ -2463,23 +2466,25 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 			}
 		}
 	}
+	//研选互动不展示专项产业调研
+	if !isResearch {
+		//查询专项产业调研展示权限 仅对大套餐客户跟永续客户展示
+		if whichDay == "" {
 
-	//查询专项产业调研展示权限 仅对大套餐客户跟永续客户展示
-	if whichDay == "" {
-
-		speciaItem, err := services.GetActivityLabelSpecialList(user, isPower, chartPermissionIds, permissionNameStr)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		if leftPx > rightPx {
-			speciaItem.Position = 2
-		} else {
-			speciaItem.Position = 1
-		}
-		if len(speciaItem.List) > 0 {
-			itemsNew = append(itemsNew, speciaItem)
+			speciaItem, err := services.GetActivityLabelSpecialList(user, isPower, chartPermissionIds, permissionNameStr)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取失败,Err:" + err.Error()
+				return
+			}
+			if leftPx > rightPx {
+				speciaItem.Position = 2
+			} else {
+				speciaItem.Position = 1
+			}
+			if len(speciaItem.List) > 0 {
+				itemsNew = append(itemsNew, speciaItem)
+			}
 		}
 	}
 	//记录用户搜索的筛选条件
@@ -3128,7 +3133,7 @@ func (this *ActivityCoAntroller) SpecialMsg() {
 // @Param   WhichDay   query   string  false       "哪一天 今天:1、明天:2,多个用 , 隔开"
 // @Param   IsPower   query   int  false       "是否选择有权限行业 ,1是 0 否 默认0"
 // @Success 200 {object} models.ActivityTypeListHomeRespPc
-// @router /labelTypeListV6Pc [get]
+// @router /labelTypeListV6Pc_del [get]
 func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 	br := new(models.BaseResponse).Init()
 	defer func() {

+ 9 - 6
models/activity_type.go

@@ -18,7 +18,7 @@ type ActivityTypeListResp struct {
 	List []*ActivityType
 }
 
-//列表
+// 列表
 func GetActivityTypeList() (items []*ActivityType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
@@ -61,15 +61,18 @@ type ActivityTypeHomePc struct {
 	List             []*CygxActivityLabelList
 }
 
-//列表
-func GetActivityTypeHomeList() (items []*ActivityTypeHome, err error) {
+// 列表
+func GetActivityTypeHomeList(condition string, pars []interface{}) (items []*ActivityTypeHome, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
-	_, err = o.Raw(sql).QueryRows(&items)
+	sql := `SELECT * FROM cygx_activity_type  WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
 
-//列表
+// 列表
 func GetActivityTypeHomeListPc() (items []*ActivityTypeHomePc, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_activity_type WHERE activity_type_id != 7   ORDER BY sort DESC`

+ 1 - 1
routers/commentsRouter.go

@@ -109,7 +109,7 @@ func init() {
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivityCoAntroller"],
         beego.ControllerComments{
             Method: "LabelTypeListV6Pc",
-            Router: `/labelTypeListV6Pc`,
+            Router: `/labelTypeListV6Pc_del`,
             AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,