浏览代码

no message

zhangchuanxing 1 月之前
父节点
当前提交
f55c4cb645
共有 2 个文件被更改,包括 29 次插入2 次删除
  1. 13 0
      controllers/cygx/report_article.go
  2. 16 2
      services/cygx/resource_data.go

+ 13 - 0
controllers/cygx/report_article.go

@@ -493,6 +493,17 @@ func (this *IndustrialSubjectController) ReportArticleClassification() {
 		return
 	}
 
+	detailIndustryNameList, err := cygx.GetIndustrialManagemenDetailByAaticleID(reportInfo.ArticleId)
+	if err != nil {
+		br.Msg = "分类失败"
+		br.ErrMsg = "获取报告原有分类失败,Err:" + err.Error()
+		return
+	}
+	var industryId []string
+	for _, v := range detailIndustryNameList {
+		industryId = append(industryId, strconv.Itoa(v.IndustrialManagementId))
+	}
+
 	industrialStrList := strings.Split(industrialManagementIdStr, ",")
 	for _, v := range industrialStrList {
 		condition = `AND industrial_management_id = ` + v
@@ -502,6 +513,7 @@ func (this *IndustrialSubjectController) ReportArticleClassification() {
 			br.ErrMsg = "操作失败,产业不存在IndustrialManagementId:" + v
 			return
 		}
+		industryId = append(industryId, v)
 	}
 	if req.IndustrialSubjectIdStr != "0" && req.IndustrialSubjectIdStr != "" {
 		strList := strings.Split(req.IndustrialSubjectIdStr, ",")
@@ -524,6 +536,7 @@ func (this *IndustrialSubjectController) ReportArticleClassification() {
 	}
 
 	go cygxService.DoArticleOnenIdWxTemplateMsg(reportInfo.ArticleId, 2)
+	go cygxService.UpdateIndustrialsourceHzResourceDataById(industryId, "HZ")
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "分类成功"

+ 16 - 2
services/cygx/resource_data.go

@@ -1294,6 +1294,20 @@ func UpdateAskserieVideoResourceData(sourceId int) {
 //	UpdateIndustrialsourceHzResourceData(731, "HZ")
 //}
 
+func UpdateIndustrialsourceHzResourceDataById(industrialManagementIds []string, sourceType string) {
+	for _, v := range industrialManagementIds {
+		if v == "" {
+			continue
+		}
+		industrialManagementId, _ := strconv.Atoi(v)
+		if industrialManagementId < 1 {
+			continue
+		}
+		UpdateIndustrialsourceHzResourceData(industrialManagementId, sourceType)
+	}
+
+}
+
 // 更新产业资源包  写入首页最新  cygx_resource_data 表
 func UpdateIndustrialsourceHzResourceData(sourceId int, sourceType string) {
 	var err error
@@ -1365,8 +1379,8 @@ func UpdateIndustrialsourceHzResourceData(sourceId int, sourceType string) {
 	}
 	item.SearchContent = ""
 	item.SearchOrderTime = maxData
-	fmt.Println(item)
-	return
+	//fmt.Println(item)
+	//return
 	if totalData == 0 {
 		_, e := cygx.AddCygxResourceData(item)
 		if e != nil {