Browse Source

Merge remote-tracking branch 'origin/V20220125' into V20220110.patch

tags/v1.22.1.3
chenyifan01 3 years ago
parent
commit
1930134d5a
9 changed files with 52 additions and 24 deletions
  1. +4
    -1
      models/repo_watch.go
  2. +1
    -1
      models/user_business_analysis.go
  3. +1
    -0
      routers/api/v1/api.go
  4. +24
    -0
      routers/api/v1/repo/repo_dashbord.go
  5. +9
    -9
      routers/repo/user_data_analysis.go
  6. +1
    -0
      services/socketwrap/clientManager.go
  7. +5
    -3
      templates/org/select_pro.tmpl
  8. +6
    -6
      templates/user/profile.tmpl
  9. +1
    -4
      web_src/js/components/UserAnalysis.vue

+ 4
- 1
models/repo_watch.go View File

@@ -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 {


+ 1
- 1
models/user_business_analysis.go View File

@@ -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))


+ 1
- 0
routers/api/v1/api.go View File

@@ -534,6 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile)
m.Group("/project", func() {
m.Get("", repo.GetAllProjectsPeriodStatistics)
m.Get("/numVisit", repo.ProjectNumVisit)

m.Group("/:id", func() {
m.Get("", repo.GetProjectLatestStatistics)


+ 24
- 0
routers/api/v1/repo/repo_dashbord.go View File

@@ -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,
})
}

+ 9
- 9
routers/repo/user_data_analysis.go View File

@@ -88,22 +88,22 @@ 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)
}

//设置默认打开的表单
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{})


+ 1
- 0
services/socketwrap/clientManager.go View File

@@ -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 {


+ 5
- 3
templates/org/select_pro.tmpl View File

@@ -61,7 +61,9 @@
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}

.ui.cards>.card>.extra .tags > a{
margin-top: 5px;
}

</style>
<div class="ui stackable grid">
@@ -99,7 +101,7 @@
{{if .Topics }}
<div class=" tags " style="position: relative;">
{{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}}
</div>
@@ -108,7 +110,7 @@
</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" >
<a class="item marg ">
{{svg "octicon-eye" 16}} {{.NumWatches}}


+ 6
- 6
templates/user/profile.tmpl View File

@@ -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>
</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 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>
{{end}}


+ 1
- 4
web_src/js/components/UserAnalysis.vue View File

@@ -135,13 +135,10 @@
</template>
</el-table-column>
<el-table-column
prop="CountDate"
prop="DataDate"
label="系统统计时间"
width="120px"
align="center">
<template slot-scope="scope">
{{scope.row.CountDate | transformTimestamp}}
</template>
</el-table-column>
</el-table>
</div>


Loading…
Cancel
Save