xingzai 7 miesięcy temu
rodzic
commit
abcbe3b55b

+ 78 - 10
controllers/cygx/report_article.go

@@ -1978,7 +1978,7 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
 }
 
 //func init() {
-//	initarta()
+//	initAct()
 //}
 
 func initart() {
@@ -1987,7 +1987,7 @@ func initart() {
 	var pars []interface{}
 	condition += ` AND re.chart_permission_id  = 62  `
 	//报告匹配类型
-
+	//9.5 13:52
 	condition += `	GROUP BY art.article_id  ORDER BY art.publish_date DESC `
 	listart, err := cygx.GetReportArticleList(condition, pars, 0, 200, 1)
 	if err != nil {
@@ -2031,6 +2031,11 @@ func initart() {
 	}
 	//标头
 	rowTitle := sheet.AddRow()
+	cellAt := rowTitle.AddCell()
+	cellAt.Value = "标题"
+
+	cellPd := rowTitle.AddCell()
+	cellPd.Value = "发布时间"
 	cellA := rowTitle.AddCell()
 	cellA.Value = "姓名"
 	cellB := rowTitle.AddCell()
@@ -2063,12 +2068,41 @@ func initart() {
 			fmt.Println(err)
 			return
 		}
+
+		//上一次的阅读记录
+		list_H, err := cygx.GetArticleHistoryList_H(articleId, condition)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+
+		mapArticle_H := make(map[string]bool)
+
+		for _, vPv := range list_H {
+			if !utils.ValidateMobileFormatat(vPv.Mobile) {
+				continue
+			}
+			mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] = true
+		}
+
 		listClPv, err := cygx.GetCygxCelueArticleHistoryRecordPvAll(strconv.Itoa(articleId))
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			fmt.Println(err)
 			return
 		}
 
+		listClPv_H, err := cygx.GetCygxCelueArticleHistoryRecordPvAll_H(strconv.Itoa(articleId))
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			fmt.Println(err)
+			return
+		}
+		for _, vPv := range listClPv_H {
+			if !utils.ValidateMobileFormatat(vPv.Mobile) {
+				continue
+			}
+			mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] = true
+		}
+
 		var listDate []*cygx.ArticleHistoryRep
 		var mobiles []string
 
@@ -2080,6 +2114,9 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) {
 					continue
 				}
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+					continue
+				}
 
 				mobiles = append(mobiles, vPv.Mobile)
 
@@ -2097,6 +2134,9 @@ func initart() {
 				//if vPv.Mobile != "" {
 				mobiles = append(mobiles, vPv.Mobile)
 				//}
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+					continue
+				}
 			}
 		}
 
@@ -2149,6 +2189,9 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) || mapMobileCy[vPv.Mobile] {
 					continue
 				}
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+					continue
+				}
 				mapMobileCy[vPv.Mobile] = true
 				listDate = append(listDate, vPv)
 			}
@@ -2159,21 +2202,27 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) || mapMobileCl[vPv.Mobile] {
 					continue
 				}
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+					continue
+				}
 				mapMobileCl[vPv.Mobile] = true
 				listDate = append(listDate, vPv)
 			}
 		}
 
-		rowtitleK := sheet.AddRow()
-		cellADatatitleK := rowtitleK.AddCell()
-		cellADatatitleK.Value = ""
-
-		rowtitle := sheet.AddRow()
-		cellADatatitle := rowtitle.AddCell()
-		cellADatatitle.Value = v.Title
+		//rowtitle := sheet.AddRow()
+		//cellADatatitle := rowtitle.AddCell()
+		//cellADatatitle.Value = v.Title
 
 		for _, item := range listDate {
 			row := sheet.AddRow()
+
+			cellADatatitle := row.AddCell()
+			cellADatatitle.Value = v.Title
+
+			cellADataPd := row.AddCell()
+			cellADataPd.Value = v.PublishDate
+
 			cellAData := row.AddCell()
 			cellAData.Value = item.RealName
 			//if item.Ly == "1" {
@@ -2222,7 +2271,23 @@ func initart() {
 
 func initAct() {
 	var condition string
-	condition = " AND  s.activity_id = 5747  AND duration != '' "
+	mapMobile := make(map[string]bool)
+	//condition = " AND  s.activity_id = 5747  AND duration != ''  AND  s.create_time < '2024-08-28 18:00:00'   "
+	//condition = " AND  s.activity_id = 5734  AND is_meeting  = 1  AND  s.create_time < '2024-08-28 18:00:00'   "
+	//list_H, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
+	//if err != nil && err.Error() != utils.ErrNoRow() {
+	//	fmt.Println(err)
+	//	return
+	//}
+	//
+
+	//
+	//for _, v := range list_H {
+	//	mapMobile[v.Mobile] = true
+	//}
+
+	condition = " AND  s.activity_id = 5833  AND duration != ''   "
+	//condition = " AND  s.activity_id = 5805  AND is_meeting  = 1 "
 	list, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		fmt.Println(err)
@@ -2319,6 +2384,9 @@ func initAct() {
 	cellTc.Value = "签约套餐"
 
 	for _, item := range list {
+		if mapMobile[item.Mobile] {
+			continue
+		}
 		row := sheet.AddRow()
 		cellAData := row.AddCell()
 		cellAData.Value = item.RealName

+ 8 - 0
models/cygx/report_article.go

@@ -1305,6 +1305,14 @@ func GetCygxCelueArticleHistoryRecordPvAll(articleIds string) (item []*ArticleHi
 	return
 }
 
+func GetCygxCelueArticleHistoryRecordPvAll_H(articleIds string) (item []*ArticleHistoryRep, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_article_history_record_all as  h WHERE article_id IN ( ` + articleIds + ` )  AND   h.is_del = 0  AND h.company_id != 16   AND h.platfor = 2 AND  h.create_time <'2024-08-28 14:45:00' `
+	sql += ` ORDER BY create_time DESC  `
+	_, err = o.Raw(sql).QueryRows(&item)
+	return
+}
+
 func GetCygxCelueArticleComapnyName(mobiles string) (item []*ArticleHistoryRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT

+ 17 - 0
models/cygx/summary_manage.go

@@ -547,6 +547,23 @@ func GetArticleHistoryList(articleId int, condition string) (items []*ArticleHis
 	return
 }
 
+// 列表
+func GetArticleHistoryList_H(articleId int, condition string) (items []*ArticleHistoryRep, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT
+			h.*
+			FROM
+				cygx_article_history_record_all AS h
+			WHERE
+				h.article_id = ?
+				AND h.platfor = 1  AND h.is_del = 0  AND h.create_time <'2024-08-28 14:45:00' `
+	if condition != "" {
+		sql = sql + condition + ` GROUP BY h.id`
+	}
+	_, err = o.Raw(sql, articleId).QueryRows(&items)
+	return
+}
+
 // 列表
 func GetArticleHistoryListInit(ArticleIds, companyIds []int) (items []*ArticleHistoryRep, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")