From 400b1bd1a620c165acfd86dc81aac4be4d8a2c06 Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 12 Oct 2021 17:10:04 +0800 Subject: [PATCH] elk --- models/elk_pagedata.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/elk_pagedata.go b/models/elk_pagedata.go index 2f5c241a8..a0f7f3ca0 100644 --- a/models/elk_pagedata.go +++ b/models/elk_pagedata.go @@ -93,7 +93,7 @@ type Batch struct { Request Request `json:"request"` } -func SendData(jsonStr []byte) (content string) { +func sendData(jsonStr []byte) (content string) { url := "http://192.168.207.35:5601/internal/bsearch" req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") @@ -109,7 +109,7 @@ func SendData(jsonStr []byte) (content string) { return string(body) } -func getdata(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { +func getData(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { var resultTest ResultInfo errs := json.Unmarshal([]byte(jobResult), &resultTest) fmt.Println(errs) @@ -143,14 +143,14 @@ func inputStructInit(User string, Project string, Gte string, Lte string) (input return inputStruct } -// @title ProjectViewData +// @title projectViewData // @description 获取指定用户和项目的访问量 // @param User string "用户名" // @param Project string "项目名" // @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) // @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) // @return value int "访问量" -func ProjectViewData(User string, Project string, Gte string, Lte string) (value int) { +func projectViewData(User string, Project string, Gte string, Lte string) (value int) { InitInfo := inputStructInit(User, Project, Gte, Lte) jsons, errs := json.Marshal(InitInfo) if errs != nil { @@ -158,11 +158,11 @@ func ProjectViewData(User string, Project string, Gte string, Lte string) (value } var jsonStr = []byte(jsons) var resultTest ResultInfo - loaded, total := getdata(resultTest, SendData(jsonStr)) + loaded, total := getData(resultTest, sendData(jsonStr)) time := 0 for { if loaded == 0 { - value1, total := getdata(resultTest, SendData(jsonStr)) + value1, total := getData(resultTest, sendData(jsonStr)) time++ if value1 != 0 && time < 100 { fmt.Println("total:", total)