Browse Source

修改数据开始时间。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.5.1^2
zouap 3 years ago
parent
commit
67f7cac545
5 changed files with 22 additions and 6 deletions
  1. +1
    -1
      models/user_business_analysis.go
  2. +3
    -2
      routers/private/internal.go
  3. +5
    -0
      routers/private/tool.go
  4. +10
    -0
      routers/repo/user_data_analysis.go
  5. +3
    -3
      web_src/js/components/UserTrend.vue

+ 1
- 1
models/user_business_analysis.go View File

@@ -891,9 +891,9 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time,
//insert userMetrics table //insert userMetrics table
var useMetrics UserMetrics var useMetrics UserMetrics
useMetrics.CountDate = CountDate.Unix() useMetrics.CountDate = CountDate.Unix()
useMetrics.DataDate = DataDate
statictisSess.Delete(&useMetrics) statictisSess.Delete(&useMetrics)


useMetrics.DataDate = DataDate
useMetrics.ActivateRegistUser = getMapKeyStringValue("ActivateRegistUser", userMetrics) useMetrics.ActivateRegistUser = getMapKeyStringValue("ActivateRegistUser", userMetrics)
useMetrics.HasActivityUser = getMapKeyStringValue("HasActivityUser", userMetrics) useMetrics.HasActivityUser = getMapKeyStringValue("HasActivityUser", userMetrics)
useMetrics.RegistActivityUser = 0 useMetrics.RegistActivityUser = 0


+ 3
- 2
routers/private/internal.go View File

@@ -6,9 +6,10 @@
package private package private


import ( import (
"code.gitea.io/gitea/routers/repo"
"strings" "strings"


"code.gitea.io/gitea/routers/repo"

"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private" "code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
@@ -46,7 +47,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/manager/flush-queues", bind(private.FlushOptions{}), FlushQueues) m.Post("/manager/flush-queues", bind(private.FlushOptions{}), FlushQueues)
m.Post("/tool/update_all_repo_commit_cnt", UpdateAllRepoCommitCnt) m.Post("/tool/update_all_repo_commit_cnt", UpdateAllRepoCommitCnt)
m.Post("/tool/repo_stat/:date", RepoStatisticManually) m.Post("/tool/repo_stat/:date", RepoStatisticManually)
m.Post("/tool/user_stat/:date", UserStatisticManually)
m.Get("/tool/org_stat", OrgStatisticManually) m.Get("/tool/org_stat", OrgStatisticManually)
m.Post("/tool/update_repo_visit/:date", UpdateRepoVisit) m.Post("/tool/update_repo_visit/:date", UpdateRepoVisit)
m.Post("/task/history_handle/duration", repo.HandleTaskWithNoDuration) m.Post("/task/history_handle/duration", repo.HandleTaskWithNoDuration)


+ 5
- 0
routers/private/tool.go View File

@@ -45,6 +45,11 @@ func RepoStatisticManually(ctx *macaron.Context) {
repo.TimingCountDataByDate(date) repo.TimingCountDataByDate(date)
} }


func UserStatisticManually(ctx *macaron.Context) {
date := ctx.Params("date")
repo.TimingCountDataByDate(date)
}

func OrgStatisticManually() { func OrgStatisticManually() {
models.UpdateOrgStatistics() models.UpdateOrgStatistics()
} }


+ 10
- 0
routers/repo/user_data_analysis.go View File

@@ -247,6 +247,7 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac
mapInterface := make(map[string]interface{}) mapInterface := make(map[string]interface{})
mapInterface["data"] = re mapInterface["data"] = re
mapInterface["count"] = count mapInterface["count"] = count

ctx.JSON(http.StatusOK, mapInterface) ctx.JSON(http.StatusOK, mapInterface)
} }
} }
@@ -303,6 +304,15 @@ func queryMetrics(ctx *context.Context, tableName string, startTime time.Time, e
mapInterface := make(map[string]interface{}) mapInterface := make(map[string]interface{})
mapInterface["data"] = result mapInterface["data"] = result
mapInterface["count"] = count mapInterface["count"] = count
if tableName == "public.user_business_analysis_yesterday" {
mapInterface["datarecordbegintime"] = setting.RadarMap.RecordBeginTime
if len(result) > 0 {
dateTime := time.Unix(result[0].CountDate, 0)
mapInterface["lastUpdatedTime"] = dateTime.Format("2006-01-02 15:04:05")
} else {
mapInterface["lastUpdatedTime"] = ""
}
}
ctx.JSON(http.StatusOK, mapInterface) ctx.JSON(http.StatusOK, mapInterface)
} }




+ 3
- 3
web_src/js/components/UserTrend.vue View File

@@ -257,11 +257,11 @@
return days; return days;
}, },
getUpdateTime(){ getUpdateTime(){
this.$axios.get('../../api/v1/projectboard/project',{
this.$axios.get('../../api/v1//query_metrics_yesterday',{
params:this.params_pro params:this.params_pro
}).then((res)=>{ }).then((res)=>{
this.recordBeginTime=res.data.recordBeginTime
this.lastUpdatedTime=res.data.lastUpdatedTime
this.recordBeginTime=res.datarecordbegintime
this.lastUpdatedTime=res.lastUpdatedTime
}) })
}, },
getUserList(type_val,index){ getUserList(type_val,index){


Loading…
Cancel
Save