Browse Source

no message

xingzai 9 months ago
parent
commit
5e47e69a68
2 changed files with 230 additions and 20 deletions
  1. 228 20
      controllers/cygx/user.go
  2. 2 0
      services/cygx/article.go

+ 228 - 20
controllers/cygx/user.go

@@ -1814,9 +1814,9 @@ func (this *UserController) ExportInteraction() {
 		//	return
 		//}
 		if classType == 1 {
-			condition += "  AND  art.chart_permission_id  != 31 "
+			condition += "  AND art.article_type_id =  0 "
 		} else {
-			condition += "  AND  art.chart_permission_id  = 31 "
+			condition += "  AND art.article_type_id >  0 "
 		}
 
 		condition += " 	AND (r.mobile = '" + wxUser.Mobile + "'  OR  r.email = '" + wxUser.Mobile + "')  "
@@ -1897,6 +1897,26 @@ func (this *UserController) ExportInteraction() {
 				}
 			}
 		}
+	} else if source == 11 {
+		sheetName = "专栏文章阅读记录"
+		if startDate != "" {
+			startDate += " 00:00:00"
+			condition += ` AND r.create_time >= '` + startDate + `' `
+		}
+		if endDate != "" {
+			endDate += " 23:59:59"
+			condition += ` AND r.create_time <= '` + endDate + `' `
+		}
+		if wxUser.Mobile == "" {
+			wxUser.Mobile = wxUser.Email
+		}
+		condition += " 	AND (r.mobile = '" + wxUser.Mobile + "'  OR  r.email = '" + wxUser.Mobile + "')  "
+		_, list, err = cygx.GetCygxYanxuaSspecialHistoryRecordByUser(condition, 0, 9999)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+			return
+		}
 	}
 
 	//创建excel
@@ -1958,7 +1978,7 @@ func (this *UserController) ExportInteraction() {
 			cellG := row.AddCell()
 			cellG.Value = item.StopTime
 		}
-	} else {
+	} else if source == 2 {
 		//标头
 		rowTitle := sheet.AddRow()
 		cellA := rowTitle.AddCell()
@@ -2001,21 +2021,99 @@ func (this *UserController) ExportInteraction() {
 			cellF := row.AddCell()
 			if item.IsMeeting == 1 {
 				cellF.Value = "到会"
+				cellG := row.AddCell()
+				cellG.Value = item.FirstMeetingTime
+				cellH := row.AddCell()
+				cellH.Value = item.LastMeetingTime
+				cellI := row.AddCell()
+				cellI.Value = item.Duration
+				cellJ := row.AddCell()
+				cellJ.Value = item.LastMeetingTime
+				cellK := row.AddCell()
+				cellK.Value = item.MeetingTypeStr
+				cellL := row.AddCell()
+				cellL.Value = item.MeetingStatusStr
 			} else {
 				cellF.Value = "未到会"
 			}
+		}
+	} else if source == 11 {
+		//标头
+		rowTitle := sheet.AddRow()
+		cellA := rowTitle.AddCell()
+		cellA.Value = "文章标题"
+		cellB := rowTitle.AddCell()
+		cellB.Value = "文章类型"
+		cellC := rowTitle.AddCell()
+		cellC.Value = "标签"
+		cellD := rowTitle.AddCell()
+		cellD.Value = "发布时间"
+		cellE := rowTitle.AddCell()
+		cellE.Value = "阅读时间"
+		cellF := rowTitle.AddCell()
+		cellF.Value = "阅读时长"
+		cellG := rowTitle.AddCell()
+		cellG.Value = "阅读来源"
+
+		for _, item := range list {
+			row := sheet.AddRow()
+			cellA := row.AddCell()
+			cellA.Value = item.Title
+			cellB := row.AddCell()
+			if item.SpecialType == 1 {
+				cellB.Value = "笔记"
+			} else {
+				cellB.Value = "观点"
+			}
+			cellC := row.AddCell()
+			cellC.Value = item.IndustryName
+			cellD := row.AddCell()
+			cellD.Value = item.PublishDate
+			cellE := row.AddCell()
+			cellE.Value = item.CreateTime
+			cellF := row.AddCell()
+			cellF.Value = item.StopTime
 			cellG := row.AddCell()
-			cellG.Value = item.FirstMeetingTime
-			cellH := row.AddCell()
-			cellH.Value = item.LastMeetingTime
-			cellI := row.AddCell()
-			cellI.Value = item.Duration
-			cellJ := row.AddCell()
-			cellJ.Value = item.LastMeetingTime
-			cellK := row.AddCell()
-			cellK.Value = item.MeetingTypeStr
-			cellL := row.AddCell()
-			cellL.Value = item.MeetingStatusStr
+			cellG.Value = cygxService.GetArticleSourcePlatformText(item.RegisterPlatform)
+		}
+	} else if source == 11 {
+		//标头
+		rowTitle := sheet.AddRow()
+		cellA := rowTitle.AddCell()
+		cellA.Value = "文章标题"
+		cellB := rowTitle.AddCell()
+		cellB.Value = "文章类型"
+		cellC := rowTitle.AddCell()
+		cellC.Value = "标签"
+		cellD := rowTitle.AddCell()
+		cellD.Value = "发布时间"
+		cellE := rowTitle.AddCell()
+		cellE.Value = "阅读时间"
+		cellF := rowTitle.AddCell()
+		cellF.Value = "阅读时长"
+		cellG := rowTitle.AddCell()
+		cellG.Value = "阅读来源"
+
+		for _, item := range list {
+			row := sheet.AddRow()
+			cellA := row.AddCell()
+			cellA.Value = item.Title
+			cellB := row.AddCell()
+			if item.SpecialType == 1 {
+				cellB.Value = "笔记"
+			} else {
+				cellB.Value = "观点"
+			}
+			cellC := row.AddCell()
+			cellC.Value = item.IndustryName
+			cellD := row.AddCell()
+			cellD.Value = item.PublishDate
+			cellE := row.AddCell()
+			cellE.Value = item.CreateTime
+			cellF := row.AddCell()
+			cellF.Value = item.StopTime
+			cellG := row.AddCell()
+			cellG.Value = cygxService.GetArticleSourcePlatformText(item.RegisterPlatform)
 		}
 	}
 	err = xlsxFile.Save(downLoadnFilePath)
@@ -2965,9 +3063,9 @@ func (this *UserController) CompanyExportInteraction() {
 	}
 	if source == 1 {
 		if classType == 1 {
-			condition += "  AND  art.chart_permission_id  != 31 "
+			condition += "  AND art.article_type_id =  0 "
 		} else {
-			condition += "  AND  art.chart_permission_id  = 31 "
+			condition += "  AND art.article_type_id >  0 "
 		}
 		if startDate != "" {
 			startDate += " 00:00:00"
@@ -3099,6 +3197,22 @@ func (this *UserController) CompanyExportInteraction() {
 				}
 			}
 		}
+	} else if source == 11 {
+		if isAdminRole {
+			_, list, err = cygx.GetCygxYanxuaSspecialHistoryRecordByUser(condition, 0, 9999)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+				return
+			}
+		} else {
+			_, list, err = cygx.GetCygxYanxuaSspecialHistoryRecordByUserWeekly(condition, 0, 9999)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+				return
+			}
+		}
 	}
 	//创建excel
 	dir, err := os.Executable()
@@ -3168,7 +3282,7 @@ func (this *UserController) CompanyExportInteraction() {
 			cellI := row.AddCell()
 			cellI.Value = item.StopTime
 		}
-	} else {
+	} else if source == 2 {
 		excelName = "参会记录"
 		//标头
 		rowTitle := sheet.AddRow()
@@ -3235,6 +3349,45 @@ func (this *UserController) CompanyExportInteraction() {
 			cellN := row.AddCell()
 			cellN.Value = item.MeetingStatusStr
 		}
+	} else if source == 11 {
+		//标头
+		rowTitle := sheet.AddRow()
+		cellA := rowTitle.AddCell()
+		cellA.Value = "文章标题"
+		cellB := rowTitle.AddCell()
+		cellB.Value = "文章类型"
+		cellC := rowTitle.AddCell()
+		cellC.Value = "标签"
+		cellD := rowTitle.AddCell()
+		cellD.Value = "发布时间"
+		cellE := rowTitle.AddCell()
+		cellE.Value = "阅读时间"
+		cellF := rowTitle.AddCell()
+		cellF.Value = "阅读时长"
+		cellG := rowTitle.AddCell()
+		cellG.Value = "阅读来源"
+
+		for _, item := range list {
+			row := sheet.AddRow()
+			cellA := row.AddCell()
+			cellA.Value = item.Title
+			cellB := row.AddCell()
+			if item.SpecialType == 1 {
+				cellB.Value = "笔记"
+			} else {
+				cellB.Value = "观点"
+			}
+			cellC := row.AddCell()
+			cellC.Value = item.IndustryName
+			cellD := row.AddCell()
+			cellD.Value = item.PublishDate
+			cellE := row.AddCell()
+			cellE.Value = item.CreateTime
+			cellF := row.AddCell()
+			cellF.Value = item.StopTime
+			cellG := row.AddCell()
+			cellG.Value = cygxService.GetArticleSourcePlatformText(item.RegisterPlatform)
+		}
 	}
 	err = xlsxFile.Save(downLoadnFilePath)
 	if err != nil {
@@ -4402,9 +4555,9 @@ func (this *UserController) CompanyExportInteractionList() {
 	}
 	if source == 1 {
 		if classType == 1 {
-			condition += "  AND  art.chart_permission_id  != 31 "
+			condition += "  AND art.article_type_id =  0 "
 		} else {
-			condition += "  AND  art.chart_permission_id  = 31 "
+			condition += "  AND art.article_type_id >  0 "
 		}
 		if startDate != "" {
 			startDate += " 00:00:00"
@@ -4538,6 +4691,22 @@ func (this *UserController) CompanyExportInteractionList() {
 				}
 			}
 		}
+	} else if source == 11 {
+		if isAdminRole {
+			_, list, err = cygx.GetCygxYanxuaSspecialHistoryRecordByUser(condition, 0, 9999)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+				return
+			}
+		} else {
+			_, list, err = cygx.GetCygxYanxuaSspecialHistoryRecordByUserWeekly(condition, 0, 9999)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取用户阅读记录,Err:" + err.Error()
+				return
+			}
+		}
 	}
 	//创建excel
 	dir, err := os.Executable()
@@ -4616,7 +4785,7 @@ func (this *UserController) CompanyExportInteractionList() {
 			cellK := row.AddCell()
 			cellK.Value = item.StopTime
 		}
-	} else {
+	} else if source == 2 {
 		excelName = "客户参会记录"
 		//标头
 		rowTitle := sheet.AddRow()
@@ -4694,6 +4863,45 @@ func (this *UserController) CompanyExportInteractionList() {
 			cellP := row.AddCell()
 			cellP.Value = item.MeetingStatusStr
 		}
+	} else if source == 11 {
+		//标头
+		rowTitle := sheet.AddRow()
+		cellA := rowTitle.AddCell()
+		cellA.Value = "文章标题"
+		cellB := rowTitle.AddCell()
+		cellB.Value = "文章类型"
+		cellC := rowTitle.AddCell()
+		cellC.Value = "标签"
+		cellD := rowTitle.AddCell()
+		cellD.Value = "发布时间"
+		cellE := rowTitle.AddCell()
+		cellE.Value = "阅读时间"
+		cellF := rowTitle.AddCell()
+		cellF.Value = "阅读时长"
+		cellG := rowTitle.AddCell()
+		cellG.Value = "阅读来源"
+
+		for _, item := range list {
+			row := sheet.AddRow()
+			cellA := row.AddCell()
+			cellA.Value = item.Title
+			cellB := row.AddCell()
+			if item.SpecialType == 1 {
+				cellB.Value = "笔记"
+			} else {
+				cellB.Value = "观点"
+			}
+			cellC := row.AddCell()
+			cellC.Value = item.IndustryName
+			cellD := row.AddCell()
+			cellD.Value = item.PublishDate
+			cellE := row.AddCell()
+			cellE.Value = item.CreateTime
+			cellF := row.AddCell()
+			cellF.Value = item.StopTime
+			cellG := row.AddCell()
+			cellG.Value = cygxService.GetArticleSourcePlatformText(item.RegisterPlatform)
+		}
 	}
 	err = xlsxFile.Save(downLoadnFilePath)
 	if err != nil {

+ 2 - 0
services/cygx/article.go

@@ -107,6 +107,8 @@ func GetArticleSourcePlatformText(sourcePlatformResp int) (sourcePlatformText st
 		sourcePlatformText = "研选小程序"
 	case 6:
 		sourcePlatformText = "研选网页版"
+	default:
+		sourcePlatformText = "查研小程序"
 	}
 	return
 }