| @@ -93,7 +93,7 @@ type Batch struct { | |||||
| Request Request `json:"request"` | 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" | url := "http://192.168.207.35:5601/internal/bsearch" | ||||
| req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) | req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) | ||||
| req.Header.Set("Content-Type", "application/json") | req.Header.Set("Content-Type", "application/json") | ||||
| @@ -109,7 +109,7 @@ func SendData(jsonStr []byte) (content string) { | |||||
| return string(body) | 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 | var resultTest ResultInfo | ||||
| errs := json.Unmarshal([]byte(jobResult), &resultTest) | errs := json.Unmarshal([]byte(jobResult), &resultTest) | ||||
| fmt.Println(errs) | fmt.Println(errs) | ||||
| @@ -143,14 +143,14 @@ func inputStructInit(User string, Project string, Gte string, Lte string) (input | |||||
| return inputStruct | return inputStruct | ||||
| } | } | ||||
| // @title ProjectViewData | |||||
| // @title projectViewData | |||||
| // @description 获取指定用户和项目的访问量 | // @description 获取指定用户和项目的访问量 | ||||
| // @param User string "用户名" | // @param User string "用户名" | ||||
| // @param Project string "项目名" | // @param Project string "项目名" | ||||
| // @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) | // @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) | ||||
| // @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) | // @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) | ||||
| // @return value int "访问量" | // @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) | InitInfo := inputStructInit(User, Project, Gte, Lte) | ||||
| jsons, errs := json.Marshal(InitInfo) | jsons, errs := json.Marshal(InitInfo) | ||||
| if errs != nil { | if errs != nil { | ||||
| @@ -158,11 +158,11 @@ func ProjectViewData(User string, Project string, Gte string, Lte string) (value | |||||
| } | } | ||||
| var jsonStr = []byte(jsons) | var jsonStr = []byte(jsons) | ||||
| var resultTest ResultInfo | var resultTest ResultInfo | ||||
| loaded, total := getdata(resultTest, SendData(jsonStr)) | |||||
| loaded, total := getData(resultTest, sendData(jsonStr)) | |||||
| time := 0 | time := 0 | ||||
| for { | for { | ||||
| if loaded == 0 { | if loaded == 0 { | ||||
| value1, total := getdata(resultTest, SendData(jsonStr)) | |||||
| value1, total := getData(resultTest, sendData(jsonStr)) | |||||
| time++ | time++ | ||||
| if value1 != 0 && time < 100 { | if value1 != 0 && time < 100 { | ||||
| fmt.Println("total:", total) | fmt.Println("total:", total) | ||||