From 7e08b33a86de61ccda470fce4b430c41445c7e55 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:08:32 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index b94762341..7441a8744 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -346,7 +346,7 @@ func QueryUserStaticCurrentMonth(ctx *context.Context) { func getStartTime(pageStartTime time.Time) time.Time { t, _ := time.Parse("2006-01-02", setting.RadarMap.GrowthBeginTime) - t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 1, t.Location()) + t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 1, t.UTC().Location()) if pageStartTime.Before(t) { pageStartTime = t } From 30c01546232dd9b9f27e9ebeea24c87b5c693d5f Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:16:23 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 7441a8744..b742fbd8e 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -345,8 +345,8 @@ func QueryUserStaticCurrentMonth(ctx *context.Context) { } func getStartTime(pageStartTime time.Time) time.Time { - t, _ := time.Parse("2006-01-02", setting.RadarMap.GrowthBeginTime) - t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 1, t.UTC().Location()) + t, _ := time.ParseInLocation("2006-01-02", setting.RadarMap.GrowthBeginTime, time.UTC) + //t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 1, t.UTC().Location()) if pageStartTime.Before(t) { pageStartTime = t } From 205ea62420383b7dd40abcca827553c8b02f4636 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:20:08 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index b742fbd8e..457ef0736 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -345,8 +345,9 @@ func QueryUserStaticCurrentMonth(ctx *context.Context) { } func getStartTime(pageStartTime time.Time) time.Time { - t, _ := time.ParseInLocation("2006-01-02", setting.RadarMap.GrowthBeginTime, time.UTC) - //t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 1, t.UTC().Location()) + t, _ := time.ParseInLocation("2006-01-02", setting.RadarMap.GrowthBeginTime, time.Local) + t = t.UTC() + log.Info("t.time=" + fmt.Sprint(t.Unix())) if pageStartTime.Before(t) { pageStartTime = t } From 9d9110272c1928e723150f190541a2f8d06d70bb Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:21:17 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 457ef0736..82143a57b 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -347,7 +347,6 @@ func QueryUserStaticCurrentMonth(ctx *context.Context) { func getStartTime(pageStartTime time.Time) time.Time { t, _ := time.ParseInLocation("2006-01-02", setting.RadarMap.GrowthBeginTime, time.Local) t = t.UTC() - log.Info("t.time=" + fmt.Sprint(t.Unix())) if pageStartTime.Before(t) { pageStartTime = t } From 65b556e1fe3c98320475b580cf78eef4e2cace64 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:39:59 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 2 +- routers/repo/user_data_analysis.go | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 86c0cfc13..ca6936904 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -228,7 +228,7 @@ func getLastCountDate() int64 { return pageStartTime.Unix() } -func QueryMetricsPage(start int64, end int64, page int, pageSize int) ([]*UserMetrics, int64) { +func QueryMetricsPage(start int64, end int64) ([]*UserMetrics, int64) { statictisSess := xStatistic.NewSession() defer statictisSess.Close() diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 82143a57b..4a3ff5f38 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -256,14 +256,6 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, endTime time.Time) { - page := ctx.QueryInt("page") - if page <= 0 { - page = 1 - } - pageSize := ctx.QueryInt("pageSize") - if pageSize <= 0 { - pageSize = setting.UI.IssuePagingNum - } IsReturnFile := ctx.QueryBool("IsReturnFile") var count int64 @@ -275,7 +267,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e result = models.QueryMetricsForAll(startTime.Unix(), endTime.Unix()) count = int64(len(result)) } else { - result, count = models.QueryMetricsPage(startTime.Unix(), endTime.Unix(), page, pageSize) + result, count = models.QueryMetricsPage(startTime.Unix(), endTime.Unix()) } if IsReturnFile { //writer exec file. @@ -297,6 +289,9 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e //设置默认打开的表单 xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" + if tableName == "" { + filename = sheetName + "_" + startTime.Format("20060102") + "_" + endTime.Format("20060102") + } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") if _, err := xlsx.WriteTo(ctx.Resp); err != nil { @@ -433,12 +428,13 @@ func QueryUserMetricDataPage(ctx *context.Context) { if pageSize <= 0 { pageSize = setting.UI.IssuePagingNum } - result, count := models.QueryMetricsPage(startTime.Unix(), endTime.Unix(), page, pageSize) + queryMetrics(ctx, "", startTime, endTime) + // result, count := models.QueryMetricsPage(startTime.Unix(), endTime.Unix(), page, pageSize) - mapInterface := make(map[string]interface{}) - mapInterface["data"] = result - mapInterface["count"] = count - ctx.JSON(http.StatusOK, mapInterface) + // mapInterface := make(map[string]interface{}) + // mapInterface["data"] = result + // mapInterface["count"] = count + // ctx.JSON(http.StatusOK, mapInterface) } func QueryUserStaticDataPage(ctx *context.Context) { From aa2b4de7f88f55242b85a8350b46ef7e7859cecc Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:43:57 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 4a3ff5f38..4def050dc 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -290,7 +290,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" if tableName == "" { - filename = sheetName + "_" + startTime.Format("20060102") + "_" + endTime.Format("20060102") + filename = sheetName + "_" + startTime.Format("20060102") + "_" + endTime.Format("20060102") + ".xlsx" } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") @@ -418,23 +418,10 @@ func QueryUserMetricDataPage(ctx *context.Context) { startDate := ctx.Query("startDate") endDate := ctx.Query("endDate") startTime, _ := time.ParseInLocation("2006-01-02", startDate, time.Local) + startTime = startTime.UTC() endTime, _ := time.ParseInLocation("2006-01-02", endDate, time.Local) - - page := ctx.QueryInt("page") - if page <= 0 { - page = 1 - } - pageSize := ctx.QueryInt("pageSize") - if pageSize <= 0 { - pageSize = setting.UI.IssuePagingNum - } + startTime = getStartTime(startTime) queryMetrics(ctx, "", startTime, endTime) - // result, count := models.QueryMetricsPage(startTime.Unix(), endTime.Unix(), page, pageSize) - - // mapInterface := make(map[string]interface{}) - // mapInterface["data"] = result - // mapInterface["count"] = count - // ctx.JSON(http.StatusOK, mapInterface) } func QueryUserStaticDataPage(ctx *context.Context) { From fe62ddcb821fa09de39d0c2450e50ea24d24cdae Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:49:53 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 4def050dc..07b2ad775 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -290,7 +290,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" if tableName == "" { - filename = sheetName + "_" + startTime.Format("20060102") + "_" + endTime.Format("20060102") + ".xlsx" + filename = sheetName + "_" + startTime.Add(8*60*60*1000).Format("20060102") + "_" + endTime.Add(8*60*60*1000).Format("20060102") + ".xlsx" } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") From 24d816417017c1f80cd8a2020432f8dd7d652dde Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 15:55:55 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 07b2ad775..80045a5ad 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -290,7 +290,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" if tableName == "" { - filename = sheetName + "_" + startTime.Add(8*60*60*1000).Format("20060102") + "_" + endTime.Add(8*60*60*1000).Format("20060102") + ".xlsx" + filename = sheetName + "_" + getTimeFileName(startTime) + "_" + getTimeFileName(endTime) + ".xlsx" } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") @@ -312,7 +312,17 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } ctx.JSON(http.StatusOK, mapInterface) } - +} +func getTimeFileName(t time.Time) string { + month := fmt.Sprint(t.Month()) + if t.Month() < 10 { + month = "0" + month + } + day := fmt.Sprint(t.Day()) + if t.Day() < 10 { + day = "0" + day + } + return fmt.Sprint(t.Year()) + month + day } func QueryRankingList(ctx *context.Context) { From 885a1877cec334f9ae160032a9f14bb24999610a Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:02:50 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 80045a5ad..addc37480 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -290,7 +290,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" if tableName == "" { - filename = sheetName + "_" + getTimeFileName(startTime) + "_" + getTimeFileName(endTime) + ".xlsx" + filename = sheetName + "_" + getTimeFileName(startTime.Add(8*60*60*1000)) + "_" + getTimeFileName(endTime) + ".xlsx" } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") @@ -314,7 +314,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } } func getTimeFileName(t time.Time) string { - month := fmt.Sprint(t.Month()) + month := fmt.Sprint(int(t.Month())) if t.Month() < 10 { month = "0" + month } From 1a0bb92c80c95ed928ac3e6a5654e3f53206ef3e Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:04:43 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index addc37480..f0a4f4806 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -314,6 +314,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } } func getTimeFileName(t time.Time) string { + log.Info("file time=" + fmt.Sprint(t.Unix())) month := fmt.Sprint(int(t.Month())) if t.Month() < 10 { month = "0" + month From 43ac1475306ee2fa1141439782a899f7dd9437f6 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:08:58 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index f0a4f4806..64be40876 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -290,7 +290,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e xlsx.SetActiveSheet(index) filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" if tableName == "" { - filename = sheetName + "_" + getTimeFileName(startTime.Add(8*60*60*1000)) + "_" + getTimeFileName(endTime) + ".xlsx" + filename = sheetName + "_" + getTimeFileName(startTime) + "_" + getTimeFileName(endTime) + ".xlsx" } ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Type", "application/octet-stream") @@ -314,6 +314,7 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } } func getTimeFileName(t time.Time) string { + t = t.Local() log.Info("file time=" + fmt.Sprint(t.Unix())) month := fmt.Sprint(int(t.Month())) if t.Month() < 10 { From 2d55fc4ab56a09b0424ac1717276547f19e7e9c1 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:12:23 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 64be40876..eb333a822 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -315,16 +315,15 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } func getTimeFileName(t time.Time) string { t = t.Local() - log.Info("file time=" + fmt.Sprint(t.Unix())) - month := fmt.Sprint(int(t.Month())) - if t.Month() < 10 { - month = "0" + month - } - day := fmt.Sprint(t.Day()) - if t.Day() < 10 { - day = "0" + day - } - return fmt.Sprint(t.Year()) + month + day + // month := fmt.Sprint(int(t.Month())) + // if t.Month() < 10 { + // month = "0" + month + // } + // day := fmt.Sprint(t.Day()) + // if t.Day() < 10 { + // day = "0" + day + // } + return t.Format("20060102") } func QueryRankingList(ctx *context.Context) { From a6123b542d61de2329ee20e5d196dfab277ff1e6 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:21:09 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 8 -------- web_src/js/components/UserTrend.vue | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index eb333a822..1bebb9f3e 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -315,14 +315,6 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e } func getTimeFileName(t time.Time) string { t = t.Local() - // month := fmt.Sprint(int(t.Month())) - // if t.Month() < 10 { - // month = "0" + month - // } - // day := fmt.Sprint(t.Day()) - // if t.Day() < 10 { - // day = "0" + day - // } return t.Format("20060102") } diff --git a/web_src/js/components/UserTrend.vue b/web_src/js/components/UserTrend.vue index 6b5be7940..efa845e06 100644 --- a/web_src/js/components/UserTrend.vue +++ b/web_src/js/components/UserTrend.vue @@ -24,8 +24,8 @@ 注册用户数 - 未激活:{{ tableDataYesterday.TotalActivateRegistUser}} - 已激活:{{ tableDataYesterday.TotalNotActivateRegistUser }} + 未激活:{{ tableDataYesterday.TotalNotActivateRegistUser }} + 已激活:{{ tableDataYesterday.TotalActivateRegistUser}} 有贡献活动: {{ tableDataYesterday.TotalHasActivityUser}} From a71982a23f05d774135adc87edaf947bd17fbd42 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:42:17 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index ca6936904..44b67d390 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -669,7 +669,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS log.Info("insert all data failed." + err.Error()) } } - + log.Info("TotalHasActivityUser=" + fmt.Sprint(userMetrics["TotalHasActivityUser"])) //normalization for k, v := range userIndexMap { tmpResult := (v - minUserIndex) / (maxUserIndex - minUserIndex) @@ -868,6 +868,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, dateRecord.UserIndexPrimitive = getUserIndex(dateRecord, ParaWeight) setUserMetrics(userMetrics, userRecord, start_unix, end_unix, dateRecord) if getUserActivate(dateRecord) > 0 { + log.Info("has activity." + userRecord.Name) addUserToMap(userNewAddActivity, userRecord.CreatedUnix, dateRecord.ID) } if userRecord.IsActive { From cfc455d33337f73088f9e941eada77fa2e5ae08f Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:43:19 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 44b67d390..bcbcd57cf 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -669,7 +669,9 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS log.Info("insert all data failed." + err.Error()) } } - log.Info("TotalHasActivityUser=" + fmt.Sprint(userMetrics["TotalHasActivityUser"])) + if tableName == "user_business_analysis_all" { + log.Info("TotalHasActivityUser=" + fmt.Sprint(userMetrics["TotalHasActivityUser"])) + } //normalization for k, v := range userIndexMap { tmpResult := (v - minUserIndex) / (maxUserIndex - minUserIndex) From 3de9251716606cd7c890057e5aa80944215fb598 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:45:09 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index bcbcd57cf..0334b5715 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -652,7 +652,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS dateRecordBatch = make([]UserBusinessAnalysisAll, 0) } if tableName == "user_business_analysis_all" { - if dateRecordAll.UserIndex > 0 || dateRecordAll.LoginCount > 0 { + if getUserActivateAll(dateRecordAll) > 0 { userMetrics["TotalHasActivityUser"] = getMapKeyStringValue("TotalHasActivityUser", userMetrics) + 1 } } @@ -1038,6 +1038,27 @@ func getUserIndexFromAnalysisAll(dateRecord UserBusinessAnalysisAll, ParaWeight return result } +func getUserActivateAll(dateRecord UserBusinessAnalysisAll) int { + var result int + result += dateRecord.CodeMergeCount + result += dateRecord.CommitCount + result += dateRecord.IssueCount + result += dateRecord.CommentCount + result += dateRecord.FocusRepoCount + result += dateRecord.StarRepoCount + result += dateRecord.SolveIssueCount + result += dateRecord.EncyclopediasCount + result += dateRecord.CreateRepoCount + result += dateRecord.CloudBrainTaskNum + result += dateRecord.CommitModelCount + result += dateRecord.CommitDatasetNum + result += dateRecord.FocusOtherUser + result += dateRecord.CollectDataset + result += dateRecord.CollectImage + result += dateRecord.CommitCodeSize + return result +} + func getUserActivate(dateRecord UserBusinessAnalysis) int { var result int result += dateRecord.CodeMergeCount From e7d6e9f50fd9bd47c5d8f14dd72357dacf43f68a Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 16:55:19 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 0334b5715..f292f0b01 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -652,7 +652,9 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS dateRecordBatch = make([]UserBusinessAnalysisAll, 0) } if tableName == "user_business_analysis_all" { - if getUserActivateAll(dateRecordAll) > 0 { + tValue := getUserActivateAll(dateRecordAll) + if tValue > 0 { + log.Info("dateRecordAll name=" + dateRecordAll.Name + " value=" + fmt.Sprint(tValue)) userMetrics["TotalHasActivityUser"] = getMapKeyStringValue("TotalHasActivityUser", userMetrics) + 1 } } From 9e0f5869569b03ed6616ac7c263fedc6f2b9418f Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 17:00:22 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index f292f0b01..db7f6855b 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -1,6 +1,7 @@ package models import ( + "encoding/json" "fmt" "sort" "strconv" @@ -778,6 +779,8 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, log.Info("query commit code errr.") } else { log.Info("query commit code size, len=" + fmt.Sprint(len(CommitCodeSizeMap))) + CommitCodeSizeMapJson, _ := json.Marshal(CommitCodeSizeMap) + log.Info("CommitCodeSizeMapJson=" + string(CommitCodeSizeMapJson)) } CommitDatasetSizeMap, CommitDatasetNumMap := queryDatasetSize(start_unix, end_unix) SolveIssueCountMap := querySolveIssue(start_unix, end_unix) From c59bff083e1cf4c0146d30b6031de127c53abfb4 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 17 May 2022 17:20:49 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- web_src/js/components/UserTrend.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/js/components/UserTrend.vue b/web_src/js/components/UserTrend.vue index efa845e06..cdfdf2a24 100644 --- a/web_src/js/components/UserTrend.vue +++ b/web_src/js/components/UserTrend.vue @@ -13,7 +13,7 @@ 昨日新增注册用户数 未激活:{{ tableDataYesterday.NotActivateRegistUser }} 已激活: {{ tableDataYesterday.ActivateRegistUser }} - 有贡献活动: {{ tableDataYesterday.RegistActivityUser }} + 有贡献活动: {{ tableDataYesterday.HasActivityUser }} @@ -114,7 +114,7 @@ align="center"> @@ -292,7 +292,7 @@ switch(type_val){ case "yesterday_usr":{ this.value_time=[] - this.dataUrl = '../../api/v1/query_user_yesterday'; + this.dataUrl = '../../api/v1/query_metrics_yesterday'; break } case "current_week_usr":{ @@ -517,7 +517,7 @@ xdata.push(this.tableData[this.tableData.length-1-i].DisplayDate); ydata_TotalRegistUser.push(this.tableData[this.tableData.length-1-i].TotalRegistUser) ydata_ActivateRegistUser.push(this.tableData[this.tableData.length-1-i].ActivateRegistUser) - ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].RegistActivityUser) + ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].HasActivityUser) ydata_NotActivateRegistUser.push(this.tableData[this.tableData.length-1-i].NotActivateRegistUser) ydata_TotalUser.push(this.tableData[this.tableData.length-1-i].TotalUser) ydata_TotalActivateRegistUser.push(this.tableData[this.tableData.length-1-i].TotalActivateRegistUser)