zhangchuanxing 4 kuukautta sitten
vanhempi
commit
81959677d3
2 muutettua tiedostoa jossa 14 lisäystä ja 4 poistoa
  1. 4 0
      services/article.go
  2. 10 4
      services/ficc_report.go

+ 4 - 0
services/article.go

@@ -1293,6 +1293,9 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			go DoArticleOnenIdWxTemplateMsg(v.ArticleId)
 		}
 
+		if v.CategoryName == utils.ZHOU_QI_NAME {
+			UpdateCygxZhouqiArticleMapTime(v.FieldName) //更新周期对应分类下所管理文章的更新时间
+		}
 		//【公司调研】系列纪要发布/更新后 end
 
 		//查研观向6.9模板消息推送规则
@@ -1334,6 +1337,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 	}
 
 	AddCygxReportMappingCategoryGroupByArticleId(artcleId)
+
 	return err
 }
 

+ 10 - 4
services/ficc_report.go

@@ -500,6 +500,7 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 			if v.ClassifyNameFirst == "晨会纪要" && v.ClassifyNameSecond == "晨会纪要" {
 				item.Title = "FICC/周期品晨会纪要"
 			}
+			item.CategoryName = "周期"
 			item.Body = v.Content
 			item.Abstract = v.Abstract
 			item.FieldName = v.ClassifyNameSecond
@@ -567,6 +568,7 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 			UpdateFICCReportResourceData(v.Id, listFiccSet)
 
 			AddCygxReportMappingCategoryGroupByArticleId(articleIdMax)
+			UpdateCygxZhouqiArticleMapTime(item.FieldName) //更新周期对应分类下所管理文章的更新时间
 		}
 	}
 
@@ -688,7 +690,11 @@ func GetFiccReportXcxItem(user *models.WxUserItem) (itemSourceResp *models.CygxR
 }
 
 //func init() {
-//	UpdateCygxZhouqiArticleMapTime("煤炭")
+//	strslice := []string{"晨会纪要", "煤炭", "铜行业数据点评", "石油石化", "黑色调研", "宏观G2观察", "黄金月报"}
+//	for _, v := range strslice {
+//		fmt.Println(v)
+//		UpdateCygxZhouqiArticleMapTime(v)
+//	}
 //}
 
 // UpdateCygxZhouqiArticleMapTime 更新周期对应分类下所管理文章的更新时间
@@ -707,7 +713,7 @@ func UpdateCygxZhouqiArticleMapTime(fieldName string) {
 		return
 	}
 
-	listCategory, err := models.GetCygxZhouqiArticleMapByParentId(detail.ParentId)
+	listCategory, e := models.GetCygxZhouqiArticleMapByParentId(detail.ParentId)
 	if e != nil {
 		err = errors.New("GetCygxZhouqiArticleMapByParentId, Err: " + err.Error())
 		return
@@ -719,14 +725,14 @@ func UpdateCygxZhouqiArticleMapTime(fieldName string) {
 
 	var condition string
 	var pars []interface{}
-	condition = " AND field_name  IN  ('" + strings.Join(matchTypeName, "','") + "')  ORDER  BY  publish_date  DESC  "
-
+	condition = "  AND category_name = '周期' AND field_name  IN  ('" + strings.Join(matchTypeName, "','") + "')  ORDER  BY  publish_date  DESC  "
 	articleList, e := models.GetCygxCygxArticleList(condition, pars, 0, 1)
 	if e != nil {
 		err = errors.New("GetCygxCygxArticleList, Err: " + e.Error())
 		return
 	}
 
+	//就一条数据
 	for _, v := range articleList {
 		e = models.UpdateCygxZhouqiArticleMapTime(v.PublishDate, detail.ParentId)
 	}