Browse Source

Merge branch 'cygx/7.4' into debug

hsun 2 years ago
parent
commit
3f06892a1f
2 changed files with 28 additions and 12 deletions
  1. 20 12
      controllers/activity.go
  2. 8 0
      models/industrial_management.go

+ 20 - 12
controllers/activity.go

@@ -961,7 +961,7 @@ func (this *ActivityCoAntroller) Detail() {
 					}
 				}
 				for k, v := range industrialList {
-					if mapIndustrial[v.IndustrialManagementId] > 0 {
+					if mapIndustrial[v.IndustrialManagementId] > 0 && !industrialList[k].IsResearch {
 						industrialList[k].IsJump = true
 					}
 					industrialList[k].IndustryNewLabel = industryNewMap[v.IndustrialManagementId]
@@ -3007,28 +3007,36 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 
 	// 查研观向7.4-判断标签是否为产业, 为产业时是否跳转资源包
 	if label != "" {
-		sourceIndustry, e := models.GetSourceIndustryByName(label)
+		industry, e := models.GetIndustryByName(label)
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取标签产业资源包失败, Err:" + e.Error()
+			br.ErrMsg = "获取标签产业失败, Err:" + e.Error()
 			return
 		}
-		if sourceIndustry != nil {
-			resp.IndustrialManagementId = sourceIndustry.IndustrialManagementId
-			resp.IsJump = true
-			// 研选产业不跳资源包
-			if sourceIndustry.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
-				resp.IsJump = false
-			}
+		if industry != nil {
 			// 产业新标签
-			industryIds := []int{sourceIndustry.IndustrialManagementId}
+			industryIds := []int{industry.IndustrialManagementId}
 			industryNewMap, e := services.GetIndustryNewLabelMap(industryIds)
 			if e != nil {
 				br.Msg = "获取信息失败"
 				br.ErrMsg = "获取产业新标签失败, Err: " + e.Error()
 				return
 			}
-			resp.IndustryNewLabel = industryNewMap[sourceIndustry.IndustrialManagementId]
+			resp.IndustryNewLabel = industryNewMap[industry.IndustrialManagementId]
+			sourceIndustry, e := models.GetSourceIndustryByName(label)
+			if e != nil && e.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取标签产业资源包失败, Err:" + e.Error()
+				return
+			}
+			if sourceIndustry != nil {
+				resp.IndustrialManagementId = sourceIndustry.IndustrialManagementId
+				resp.IsJump = true
+				// 研选产业不跳资源包
+				if sourceIndustry.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+					resp.IsJump = false
+				}
+			}
 		}
 	}
 

+ 8 - 0
models/industrial_management.go

@@ -612,3 +612,11 @@ func GetSourceIndustryByName(industryName string) (item *IndustrialManagement, e
 	err = orm.NewOrm().Raw(sql, industryName).QueryRow(&item)
 	return
 }
+
+
+// GetIndustryByName 通过名称获取产业
+func GetIndustryByName(industryName string) (item *IndustrialManagement, err error) {
+	sql := `SELECT * FROM cygx_industrial_management WHERE industry_name = ? LIMIT 1`
+	err = orm.NewOrm().Raw(sql, industryName).QueryRow(&item)
+	return
+}