From e6c21864bd7ee16f8d3f3b243dab497d4554c2ed Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jan 2022 17:36:23 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/api/v1/api.go | 1 + routers/api/v1/repo/repo_dashbord.go | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index dcea46ed6..723c6b4ef 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -534,6 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) m.Group("/project", func() { m.Get("", repo.GetAllProjectsPeriodStatistics) + m.Post("/numVisit", repo.ProjectNumVisit) m.Group("/:id", func() { m.Get("", repo.GetProjectLatestStatistics) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index a8887a744..46596330f 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/setting" @@ -640,3 +641,26 @@ func getTotalPage(total int64, pageSize int) int { return int(total)/pageSize + another } + +func ProjectNumVisit(ctx *context.APIContext) { + var ( + err error + ) + + var userName = ctx.Query("user") + var projectName = ctx.Query("project") + var beginTime = ctx.Query("begintime") + var endTime = ctx.Query("endtime") + + var ProjectNumVisits int + ProjectNumVisits, err = repository.AppointProjectView(userName, projectName, beginTime, endTime) //访问量 + if err != nil { + ctx.NotFound(err) + } + log.Info("ProjectNumVisits is:", ProjectNumVisits) + + ctx.JSON(http.StatusOK, map[string]interface{}{ + "ProjectNumVisits": ProjectNumVisits, + "StatusOK": 0, + }) +} From 2f97fbbac3a817d0549629da4c30c88ef74cffe6 Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jan 2022 18:32:48 +0800 Subject: [PATCH 2/8] update --- routers/api/v1/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 723c6b4ef..b81607c49 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -534,7 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) m.Group("/project", func() { m.Get("", repo.GetAllProjectsPeriodStatistics) - m.Post("/numVisit", repo.ProjectNumVisit) + m.Get("/numVisit", repo.ProjectNumVisit) m.Group("/:id", func() { m.Get("", repo.GetProjectLatestStatistics) From 6b3e8c554c8724aa9449d21236e3fa62cccf62d9 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 14 Jan 2022 11:03:33 +0800 Subject: [PATCH 3/8] =?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 | 2 +- web_src/js/components/UserAnalysis.vue | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index d04e350c2..288762161 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -387,7 +387,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, CommitCodeSizeMap map[s OpenIIndexMap := queryUserRepoOpenIIndex(startTime.Unix(), end_unix) - DataDate := currentTimeNow.Format("2006-01-02") + DataDate := currentTimeNow.Format("2006-01-02") + " 00:01" cond := "type != 1 and is_active=true" count, err := sess.Where(cond).Count(new(User)) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 7df384cc4..e2d44ab0a 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -88,7 +88,7 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac xlsx.SetCellValue(sheetName, "P"+rows, formatTime[0:len(formatTime)-3]) formatTime = userRecord.DataDate - xlsx.SetCellValue(sheetName, "Q"+rows, formatTime+" 00:01") + xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) } //设置默认打开的表单 diff --git a/web_src/js/components/UserAnalysis.vue b/web_src/js/components/UserAnalysis.vue index c4c5608f1..5650e164f 100755 --- a/web_src/js/components/UserAnalysis.vue +++ b/web_src/js/components/UserAnalysis.vue @@ -135,13 +135,10 @@ - From 4af1d5d66f2821cfe66c0857dcadb32d70932664 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 14 Jan 2022 12:33:58 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3action=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/action.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/action.go b/models/action.go index b9a0a603c..003dc1b20 100755 --- a/models/action.go +++ b/models/action.go @@ -350,6 +350,7 @@ func GetLast20PublicFeeds(opTypes []int) ([]*Action, error) { cond := builder.NewCond() cond = cond.And(builder.Eq{"is_private": false}) cond = cond.And(builder.Eq{"is_deleted": false}) + cond = cond.And(builder.Expr("user_id=act_user_id")) cond = cond.And(builder.In("op_type", opTypes)) actions := make([]*Action, 0, 20) From 3fd596c3901b77ceb783f4a7fb720acfa9af18c2 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 17 Jan 2022 09:20:01 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3#1360?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/home/home.js b/public/home/home.js index 5811b91c1..717d57682 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -239,7 +239,7 @@ var actionNameZH={ "5":"推送了 {branch} 分支的代码到", "6":"创建了任务", "7":"创建了合并请求", - "9":"推送了 {branch} 分支的代码到", + "9":"推送了标签 {branch} 到", "10":"评论了任务", "11":"合并了合并请求", "12":"关闭了任务", @@ -257,7 +257,7 @@ var actionNameEN={ "5":" pushed to {branch} at", "6":" opened issue", "7":" created pull request", - "9":" pushed to {branch} at", + "9":" pushed tag {branch} to ", "10":" commented on issue", "11":" merged pull request", "12":" closed issue", From 5364060a4019d243a1e2d842198e5149d35cab9a Mon Sep 17 00:00:00 2001 From: wangjr Date: Mon, 17 Jan 2022 09:29:05 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E7=B2=BE=E9=80=89=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=BA=95=E9=83=A8=E8=BE=B9=E8=B7=9D=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=8C=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/select_pro.tmpl | 8 +++++--- templates/user/profile.tmpl | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/templates/org/select_pro.tmpl b/templates/org/select_pro.tmpl index 647bccd57..c88803e16 100755 --- a/templates/org/select_pro.tmpl +++ b/templates/org/select_pro.tmpl @@ -61,7 +61,9 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } - + .ui.cards>.card>.extra .tags > a{ + margin-top: 5px; + }
@@ -99,7 +101,7 @@ {{if .Topics }}
{{range .Topics}} - {{if ne . "" }}{{.}}{{end}} + {{if ne . "" }}{{.}}{{end}} {{end}}
@@ -108,7 +110,7 @@
-
+
{{svg "octicon-eye" 16}} {{.NumWatches}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 9c483efe1..f14dc9b7a 100755 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -77,14 +77,14 @@ {{.Name}} -
  • +
  • - - {{.NumMembers}} + + {{.NumMembers}}
  • -
  • - - {{.NumRepos}} +
  • + + {{.NumRepos}}
  • {{end}} From 010712cb01046c710d34593b79790385e62d5dd2 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 17 Jan 2022 16:59:19 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=B8=8B=E8=BD=BD=E7=BB=93=E6=9E=9C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index e2d44ab0a..e71e8cb3a 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -91,19 +91,19 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) } - //设置默认打开的表单 - xlsx.SetActiveSheet(index) - filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" - 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 { - log.Info("writer exel error." + err.Error()) - } indexTotal += PAGE_SIZE if indexTotal >= count { break } } + //设置默认打开的表单 + xlsx.SetActiveSheet(index) + filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" + 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 { + log.Info("writer exel error." + err.Error()) + } } else { re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) mapInterface := make(map[string]interface{}) From a7c28dc4634f3a31e36e4992842471edcfa14699 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 18 Jan 2022 10:16:15 +0800 Subject: [PATCH 8/8] fix-1365 --- models/repo_watch.go | 5 ++++- services/socketwrap/clientManager.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/models/repo_watch.go b/models/repo_watch.go index 85a7834bb..31868fcae 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -305,7 +305,10 @@ func NotifyWatchersActions(acts []*Action) error { return err } } - return sess.Commit() + + err := sess.Commit() + producer(acts...) + return err } func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index c59936581..601c0f7a8 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -50,6 +50,7 @@ func (h *ClientsManager) Run() { } case message := <-models.ActionChan: if isInOpTypes(opTypes, message.OpType) { + message.Comment = nil LastActionsQueue.Push(message) for _, client := range h.Clients.Keys() { select {