修改为毫秒返回
This commit is contained in:
parent
e343a50003
commit
87c52f79a4
12
main.go
12
main.go
|
@ -16,9 +16,9 @@ type server struct {
|
|||
|
||||
type result struct {
|
||||
// 通过json标签指定json字段名
|
||||
Sataus int `json:"sataus"`
|
||||
Code int `json:"code"`
|
||||
Time string `json:"time"`
|
||||
Sataus int `json:"sataus"`
|
||||
Code int `json:"code"`
|
||||
Time int `json:"time"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -43,10 +43,10 @@ func textserver(c echo.Context) error {
|
|||
// 通过结构体对象就可以访问json参数
|
||||
json := new(result)
|
||||
json.Code = http.StatusOK
|
||||
start := time.Now()
|
||||
start := time.Now().UnixMilli()
|
||||
json.Sataus = text_url(u.Url)
|
||||
elapsed := time.Since(start)
|
||||
json.Time = elapsed.String()
|
||||
elapsed := time.Now().UnixMilli() - start
|
||||
json.Time = int(elapsed)
|
||||
return c.JSON(http.StatusOK, json)
|
||||
}
|
||||
func text_url(url string) int {
|
||||
|
|
Loading…
Reference in New Issue