| @@ -305,7 +305,10 @@ func NotifyWatchersActions(acts []*Action) error { | |||||
| return err | return err | ||||
| } | } | ||||
| } | } | ||||
| return sess.Commit() | |||||
| err := sess.Commit() | |||||
| producer(acts...) | |||||
| return err | |||||
| } | } | ||||
| func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { | func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { | ||||
| @@ -387,7 +387,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, CommitCodeSizeMap map[s | |||||
| OpenIIndexMap := queryUserRepoOpenIIndex(startTime.Unix(), end_unix) | 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" | cond := "type != 1 and is_active=true" | ||||
| count, err := sess.Where(cond).Count(new(User)) | count, err := sess.Where(cond).Count(new(User)) | ||||
| @@ -534,6 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
| m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) | m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) | ||||
| m.Group("/project", func() { | m.Group("/project", func() { | ||||
| m.Get("", repo.GetAllProjectsPeriodStatistics) | m.Get("", repo.GetAllProjectsPeriodStatistics) | ||||
| m.Get("/numVisit", repo.ProjectNumVisit) | |||||
| m.Group("/:id", func() { | m.Group("/:id", func() { | ||||
| m.Get("", repo.GetProjectLatestStatistics) | m.Get("", repo.GetProjectLatestStatistics) | ||||
| @@ -12,6 +12,7 @@ import ( | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/repository" | |||||
| "code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
| "code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
| @@ -640,3 +641,26 @@ func getTotalPage(total int64, pageSize int) int { | |||||
| return int(total)/pageSize + another | 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, | |||||
| }) | |||||
| } | |||||
| @@ -88,22 +88,22 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac | |||||
| xlsx.SetCellValue(sheetName, "P"+rows, formatTime[0:len(formatTime)-3]) | xlsx.SetCellValue(sheetName, "P"+rows, formatTime[0:len(formatTime)-3]) | ||||
| formatTime = userRecord.DataDate | formatTime = userRecord.DataDate | ||||
| xlsx.SetCellValue(sheetName, "Q"+rows, formatTime+" 00:01") | |||||
| 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 | indexTotal += PAGE_SIZE | ||||
| if indexTotal >= count { | if indexTotal >= count { | ||||
| break | 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 { | } else { | ||||
| re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) | re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) | ||||
| mapInterface := make(map[string]interface{}) | mapInterface := make(map[string]interface{}) | ||||
| @@ -50,6 +50,7 @@ func (h *ClientsManager) Run() { | |||||
| } | } | ||||
| case message := <-models.ActionChan: | case message := <-models.ActionChan: | ||||
| if isInOpTypes(opTypes, message.OpType) { | if isInOpTypes(opTypes, message.OpType) { | ||||
| message.Comment = nil | |||||
| LastActionsQueue.Push(message) | LastActionsQueue.Push(message) | ||||
| for _, client := range h.Clients.Keys() { | for _, client := range h.Clients.Keys() { | ||||
| select { | select { | ||||
| @@ -61,7 +61,9 @@ | |||||
| -webkit-line-clamp: 2; | -webkit-line-clamp: 2; | ||||
| -webkit-box-orient: vertical; | -webkit-box-orient: vertical; | ||||
| } | } | ||||
| .ui.cards>.card>.extra .tags > a{ | |||||
| margin-top: 5px; | |||||
| } | |||||
| </style> | </style> | ||||
| <div class="ui stackable grid"> | <div class="ui stackable grid"> | ||||
| @@ -99,7 +101,7 @@ | |||||
| {{if .Topics }} | {{if .Topics }} | ||||
| <div class=" tags " style="position: relative;"> | <div class=" tags " style="position: relative;"> | ||||
| {{range .Topics}} | {{range .Topics}} | ||||
| {{if ne . "" }}<a style="max-width:100%;margin: 5px 0;display:inline-flex;" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}" ><span class="ui small label topic omit" >{{.}}</span></a>{{end}} | |||||
| {{if ne . "" }}<a style="max-width:100%;display:inline-flex;" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}" ><span class="ui small label topic omit" >{{.}}</span></a>{{end}} | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| @@ -108,7 +110,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class=" extra " style="color:#888888;border-top: none !important"> | |||||
| <div class=" extra " style="color:#888888;border-top: none !important;padding-top: 0"> | |||||
| <div class="ui mini right compact marg" > | <div class="ui mini right compact marg" > | ||||
| <a class="item marg "> | <a class="item marg "> | ||||
| {{svg "octicon-eye" 16}} {{.NumWatches}} | {{svg "octicon-eye" 16}} {{.NumWatches}} | ||||
| @@ -77,14 +77,14 @@ | |||||
| <a class="ui image poping up" style="color: #0366D6;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted">{{.Name}}</a> | <a class="ui image poping up" style="color: #0366D6;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted">{{.Name}}</a> | ||||
| </li> | </li> | ||||
| <li class="infor" style="width: 25%;"> | |||||
| <li class="infor" style="width: 25%;display: table-cell"> | |||||
| <img style="width: 14px; height: 14px;border: none;" src="/img/member.svg" > | |||||
| <span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumMembers}}</span> | |||||
| <img style="width: 16px;height:16px;border: none;" src="/img/member.svg" > | |||||
| <span style="color: rgba(0,0,0,.4);vertical-align: middle;">{{.NumMembers}}</span> | |||||
| </li> | </li> | ||||
| <li class="infor" style="width: 25%;"> | |||||
| <img style="width: 14px; height: 14px" src="/img/pro_num.svg" > | |||||
| <span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumRepos}}</span> | |||||
| <li class="infor" style="width: 25%;display: table-cell"> | |||||
| <img style="width: 16px;height: 16px;" src="/img/pro_num.svg" > | |||||
| <span style="color: rgba(0,0,0,.4);vertical-align: middle;">{{.NumRepos}}</span> | |||||
| </li> | </li> | ||||
| {{end}} | {{end}} | ||||
| @@ -135,13 +135,10 @@ | |||||
| </template> | </template> | ||||
| </el-table-column> | </el-table-column> | ||||
| <el-table-column | <el-table-column | ||||
| prop="CountDate" | |||||
| prop="DataDate" | |||||
| label="系统统计时间" | label="系统统计时间" | ||||
| width="120px" | width="120px" | ||||
| align="center"> | align="center"> | ||||
| <template slot-scope="scope"> | |||||
| {{scope.row.CountDate | transformTimestamp}} | |||||
| </template> | |||||
| </el-table-column> | </el-table-column> | ||||
| </el-table> | </el-table> | ||||
| </div> | </div> | ||||