Browse Source

no message

zhangchuanxing 5 months ago
parent
commit
9c3704daff

+ 145 - 66
controllers/cygx/report_article.go

@@ -1985,9 +1985,9 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
 	br.IsAddLog = true
 }
 
-//func init() {
-//	initart()
-//}
+func init() {
+	initart()
+}
 
 func initart() {
 	//行业
@@ -2070,6 +2070,8 @@ func initart() {
 	cellTc := rowTitle.AddCell()
 	cellTc.Value = "签约套餐"
 
+	hasmobile := make(map[string]bool)
+
 	for _, v := range listart {
 		articleId := v.ArticleId
 		condition = ` AND h.company_id != ` + strconv.Itoa(utils.HZ_COMPANY_ID) // 过滤弘则
@@ -2092,7 +2094,8 @@ func initart() {
 			if !utils.ValidateMobileFormatat(vPv.Mobile) {
 				continue
 			}
-			mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] = true
+			mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] = true
+
 		}
 
 		listClPv, err := cygx.GetCygxCelueArticleHistoryRecordPvAll(strconv.Itoa(articleId))
@@ -2110,7 +2113,8 @@ func initart() {
 			if !utils.ValidateMobileFormatat(vPv.Mobile) {
 				continue
 			}
-			mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] = true
+			mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] = true
+
 		}
 
 		var listDate []*cygx.ArticleHistoryRep
@@ -2124,7 +2128,7 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) {
 					continue
 				}
-				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] {
 					continue
 				}
 
@@ -2144,9 +2148,10 @@ func initart() {
 				//if vPv.Mobile != "" {
 				mobiles = append(mobiles, vPv.Mobile)
 				//}
-				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] {
 					continue
 				}
+
 			}
 		}
 
@@ -2199,10 +2204,15 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) || mapMobileCy[vPv.Mobile] {
 					continue
 				}
-				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] {
 					continue
 				}
+				if hasmobile[vPv.Mobile] {
+					continue
+				}
+				hasmobile[vPv.Mobile] = true
 				mapMobileCy[vPv.Mobile] = true
+
 				listDate = append(listDate, vPv)
 			}
 		}
@@ -2212,9 +2222,13 @@ func initart() {
 				if !utils.ValidateMobileFormatat(vPv.Mobile) || mapMobileCl[vPv.Mobile] {
 					continue
 				}
-				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile, "a_", vPv.ArticleId)] {
+				if mapArticle_H[fmt.Sprint("m_", vPv.Mobile)] {
 					continue
 				}
+				if hasmobile[vPv.Mobile] {
+					continue
+				}
+				hasmobile[vPv.Mobile] = true
 				mapMobileCl[vPv.Mobile] = true
 				listDate = append(listDate, vPv)
 			}
@@ -2286,74 +2300,139 @@ func initAct() {
 	var condition string
 	mapMobile := make(map[string]bool)
 	mapuserMapbil := make(map[int]*models.WxUserSller)
-	var activityIds []int
-	activityIds = []int{5590, 5658, 5734, 5747, 5805, 5833, 5832, 5865, 5887, 5872, 5889, 5870, 5892, 5890, 5935, 5976, 5946} //	2024-10-31 17:15
+	//var activityIds []int
+	//activityIds = []int{5590, 5658, 5734, 5747, 5805, 5833, 5832, 5865, 5887, 5872, 5889, 5870, 5892, 5890, 5935, 5976, 5946, 6005} //	2024-11-07 16:45
 	//activityIds = []int{6005} //	2024-10-31 17:15
+	//activityIds = []int{6052} //	2024-11-07 16:45
 
-	var listData []*cygx.UserInteraction
-	for _, vid := range activityIds {
-		activityId := strconv.Itoa(vid)
+	condition = " AND  s.activity_id IN (5590, 5658, 5734, 5747, 5805, 5833, 5832, 5865, 5887, 5872, 5889, 5870, 5892, 5890, 5935, 5976, 5946)  AND  ( is_meeting  = 1  OR    duration != '' ) AND  s.create_time < '2024-10-31 17:15' "
+	listH, err := cygx.GetActivityMeetByUser(condition, 0, 9999)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	mobileMap := make(map[string]bool)
 
-		//activityId := "5865"
-		//condition = " AND  s.activity_id = " + activityId + "  AND duration != ''  AND  s.create_time < '2024-09-06 09:20'   "
-		//condition = " AND  s.activity_id = " + activityId + "  AND  (is_meeting  = 1  OR   AND duration != '' ) AND  s.create_time < '2024-09-13 10:30'   "
-		//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+"_"+activityId] = true
-		//}
+	for _, v := range listH {
+		mobileMap[v.Mobile] = true
+	}
+	fmt.Println(mobileMap)
 
-		//condition = " AND  s.activity_id = 5833  AND duration != ''   "
-		//condition = " AND  s.activity_id = " + activityId + "  AND duration != ''   " // 2024-09-06 09:20
-		condition = " AND  s.activity_id = " + activityId + "  AND  ( is_meeting  = 1  OR    duration != '' ) AND  s.create_time > '2024-10-25 18:15'   "
-		list, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			fmt.Println(err)
-			return
-		}
+	condition = " AND  s.activity_id = 6052   AND  ( is_meeting  = 1  OR    duration != '' ) AND  s.create_time > '2024-10-31 17:15'   "
+	list, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
+	fmt.Println(list)
+	fmt.Println()
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		fmt.Println(err)
+		return
+	}
 
-		var companyIds []int
-		for _, vuser := range list {
-			//mapuserMapbil[vuser.Mobile] = vuser
-			companyIds = append(companyIds, vuser.CompanyId)
-			listData = append(listData, vuser)
-		}
+	var listData []*cygx.UserInteraction
+	//for _, vid := range activityIds {
+	//	activityId := strconv.Itoa(vid)
+	//
+	//	//activityId := "5865"
+	//	//condition = " AND  s.activity_id = " + activityId + "  AND duration != ''  AND  s.create_time < '2024-09-06 09:20'   "
+	//	//condition = " AND  s.activity_id = " + activityId + "  AND  (is_meeting  = 1  OR   AND duration != '' ) AND  s.create_time < '2024-09-13 10:30'   "
+	//	//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+"_"+activityId] = true
+	//	//}
+	//
+	//	//condition = " AND  s.activity_id = 5833  AND duration != ''   "
+	//	//condition = " AND  s.activity_id = " + activityId + "  AND duration != ''   " // 2024-09-06 09:20
+	//	condition = " AND  s.activity_id = " + activityId + "  AND  ( is_meeting  = 1  OR    duration != '' ) AND  s.create_time > '2024-10-31 17:15'   "
+	//	list, err := cygx.GetActivityMeetByUser(condition, 0, 1000)
+	//	if err != nil && err.Error() != utils.ErrNoRow() {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//
+	//	var companyIds []int
+	//	for _, vuser := range list {
+	//		//mapuserMapbil[vuser.Mobile] = vuser
+	//		companyIds = append(companyIds, vuser.CompanyId)
+	//		listData = append(listData, vuser)
+	//	}
+	//
+	//	listCompany, err := models.GetWxUserRaiSllerListByUserComapnyId(companyIds)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//
+	//	//合并合同所对应的权限
+	//	mappermissionName, err := cygxService.GetCompanyContractPermissionNameMapByIds(companyIds)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//	for _, v := range listCompany {
+	//		v.ChartPermissionName = mappermissionName[v.CompanyId]
+	//		mapuserMapbil[v.CompanyId] = v
+	//	}
+	//
+	//	listCompanyFicc, err := models.GetWxUserRaiSllerListByUserComapnyIdFicc(companyIds)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//
+	//	for _, v := range listCompanyFicc {
+	//		if mapuserMapbil[v.CompanyId] != nil {
+	//			continue
+	//		}
+	//		v.Status = ""
+	//		v.SellerName = ""
+	//		mapuserMapbil[v.CompanyId] = v
+	//	}
+	//}
 
-		listCompany, err := models.GetWxUserRaiSllerListByUserComapnyId(companyIds)
-		if err != nil {
-			fmt.Println(err)
-			return
+	var companyIds []int
+	for _, vuser := range list {
+		fmt.Println(vuser.Mobile)
+		if mobileMap[vuser.Mobile] {
+			continue
 		}
+		companyIds = append(companyIds, vuser.CompanyId)
+		listData = append(listData, vuser)
+	}
 
-		//合并合同所对应的权限
-		mappermissionName, err := cygxService.GetCompanyContractPermissionNameMapByIds(companyIds)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
-		for _, v := range listCompany {
-			v.ChartPermissionName = mappermissionName[v.CompanyId]
-			mapuserMapbil[v.CompanyId] = v
-		}
+	listCompany, err := models.GetWxUserRaiSllerListByUserComapnyId(companyIds)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
 
-		listCompanyFicc, err := models.GetWxUserRaiSllerListByUserComapnyIdFicc(companyIds)
-		if err != nil {
-			fmt.Println(err)
-			return
-		}
+	//合并合同所对应的权限
+	mappermissionName, err := cygxService.GetCompanyContractPermissionNameMapByIds(companyIds)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	for _, v := range listCompany {
+		v.ChartPermissionName = mappermissionName[v.CompanyId]
+		mapuserMapbil[v.CompanyId] = v
+	}
 
-		for _, v := range listCompanyFicc {
-			if mapuserMapbil[v.CompanyId] != nil {
-				continue
-			}
-			v.Status = ""
-			v.SellerName = ""
-			mapuserMapbil[v.CompanyId] = v
+	listCompanyFicc, err := models.GetWxUserRaiSllerListByUserComapnyIdFicc(companyIds)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	for _, v := range listCompanyFicc {
+		if mapuserMapbil[v.CompanyId] != nil {
+			continue
 		}
+		v.Status = ""
+		v.SellerName = ""
+		mapuserMapbil[v.CompanyId] = v
 	}
 
 	//创建excel

+ 1 - 1
models/cygx/cygx_user.go

@@ -1108,7 +1108,7 @@ func GetActivityMeetByUser(condition string, startSize, pageSize int) (item []*U
 			1 = 1 
 			AND s.do_fail_type = 0  ` + condition + `
 		GROUP BY
-			s.activity_id,s.outbound_mobile
+			s.mobile
 		ORDER BY
 			a.activity_time DESC `
 	if startSize > 0 || pageSize > 0 {

+ 3 - 3
models/cygx/report_article.go

@@ -1303,15 +1303,15 @@ type CygxCelueArticleHistoryRecord struct {
 func GetCygxCelueArticleHistoryRecordPvAll(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      `
-	sql += ` ORDER BY create_time DESC  `
+	sql += ` group by mobile  ORDER BY create_time DESC  `
 	_, err = o.Raw(sql).QueryRows(&item)
 	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-10-26 10:15'  `
-	sql += ` ORDER BY create_time DESC  `
+	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-10-31 17:15'  `
+	sql += ` group by mobile  ORDER BY create_time DESC  `
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }

+ 3 - 3
models/cygx/summary_manage.go

@@ -560,7 +560,7 @@ func GetArticleHistoryList(articleId int, condition string) (items []*ArticleHis
 				h.article_id = ?
 				AND h.platfor = 1  AND h.is_del = 0   `
 	if condition != "" {
-		sql = sql + condition + ` GROUP BY h.id`
+		sql = sql + condition + ` group by mobile `
 	}
 	_, err = o.Raw(sql, articleId).QueryRows(&items)
 	return
@@ -575,9 +575,9 @@ func GetArticleHistoryList_H(articleId int, condition string) (items []*ArticleH
 				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-10-26 10:15' `
+				AND h.platfor = 1  AND h.is_del = 0  AND h.create_time <'2024-10-31 17:15' `
 	if condition != "" {
-		sql = sql + condition + ` GROUP BY h.id`
+		sql = sql + condition + ` group by mobile  `
 	}
 	_, err = o.Raw(sql, articleId).QueryRows(&items)
 	return