Compare commits
No commits in common. "87c52f79a4c041675056ba4290119e82b1ae327b" and "313b4c747d4b1e3c478ee57484ab763e99c15435" have entirely different histories.
87c52f79a4
...
313b4c747d
5
main.go
5
main.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/idoubi/goz"
|
"github.com/idoubi/goz"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
@ -18,7 +17,6 @@ type result struct {
|
||||||
// 通过json标签指定json字段名
|
// 通过json标签指定json字段名
|
||||||
Sataus int `json:"sataus"`
|
Sataus int `json:"sataus"`
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Time int `json:"time"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -43,10 +41,7 @@ func textserver(c echo.Context) error {
|
||||||
// 通过结构体对象就可以访问json参数
|
// 通过结构体对象就可以访问json参数
|
||||||
json := new(result)
|
json := new(result)
|
||||||
json.Code = http.StatusOK
|
json.Code = http.StatusOK
|
||||||
start := time.Now().UnixMilli()
|
|
||||||
json.Sataus = text_url(u.Url)
|
json.Sataus = text_url(u.Url)
|
||||||
elapsed := time.Now().UnixMilli() - start
|
|
||||||
json.Time = int(elapsed)
|
|
||||||
return c.JSON(http.StatusOK, json)
|
return c.JSON(http.StatusOK, json)
|
||||||
}
|
}
|
||||||
func text_url(url string) int {
|
func text_url(url string) int {
|
||||||
|
|
Loading…
Reference in New Issue