#1176 按照页面访问统计仓库访问量,一次点击算一次访问

Merged
lewis merged 1 commits from fix-1099 into V20211228 2 years ago
  1. +21
    -2
      modules/repository/elk_pagedata.go

+ 21
- 2
modules/repository/elk_pagedata.go View File

@@ -21,7 +21,8 @@ type Fields struct {
Format string `json:"format"`
}
type MatchPhrase struct {
Message string `json:"message"`
Message string `json:"message,omitempty"`
TagName string `json:"tagName.keyword,omitempty"`
}
type Should struct {
MatchPhrase MatchPhrase `json:"match_phrase"`
@@ -144,7 +145,7 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje
inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1)
inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = setting.TimeField
inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = setting.ElkTimeFormat
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3)
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 4)
//限定查询时间
var timeRange Range
timeRange.Timestamptest.Gte = Gte
@@ -159,6 +160,24 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje
var projectName FilterMatchPhrase
projectName.ProjectName = Project
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName
//限定页面
var bool Bool
bool.Should = make([]Should, 14)
bool.Should[0].MatchPhrase.TagName = "%{[request][3]}"
bool.Should[1].MatchPhrase.TagName = "datasets?type=0"
bool.Should[2].MatchPhrase.TagName = "datasets?type=1"
bool.Should[3].MatchPhrase.TagName = "issues"
bool.Should[4].MatchPhrase.TagName = "labels"
bool.Should[5].MatchPhrase.TagName = "pulls"
bool.Should[6].MatchPhrase.TagName = "wiki"
bool.Should[7].MatchPhrase.TagName = "activity"
bool.Should[8].MatchPhrase.TagName = "cloudbrain"
bool.Should[9].MatchPhrase.TagName = "modelarts"
bool.Should[10].MatchPhrase.TagName = "blockchain"
bool.Should[11].MatchPhrase.TagName = "watchers"
bool.Should[12].MatchPhrase.TagName = "stars"
bool.Should[13].MatchPhrase.TagName = "forks"
inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[3].Bool = &bool
return inputStruct
}



Loading…
Cancel
Save