| | |
| | | |
| | | "basic.com/pubsub/protomsg.git" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/golang/glog" |
| | | "github.com/pierrec/lz4" |
| | | "gocv.io/x/gocv" |
| | | |
| | |
| | | // ResponseFormat 返回数据格式化 |
| | | func ResponseFormat(c *gin.Context, respStatus *code.Code, data interface{}) { |
| | | if respStatus == nil { |
| | | glog.Error("response status param not found!") |
| | | respStatus = code.RequestParamError |
| | | } |
| | | c.JSON(respStatus.Status, gin.H{ |
| | |
| | | package router |
| | | |
| | | import ( |
| | | "time" |
| | | "webserver/controllers" |
| | | "webserver/middlewares/auth" |
| | | |
| | | "github.com/gin-gonic/gin" |
| | | ginSwagger "github.com/swaggo/gin-swagger" |
| | | "github.com/swaggo/gin-swagger" |
| | | "github.com/swaggo/gin-swagger/swaggerFiles" |
| | | ginglog "github.com/szuecs/gin-glog" |
| | | |
| | | _ "webserver/docs" |
| | | ) |
| | | |
| | | func NewRouter() *gin.Engine { |
| | | r := gin.Default() |
| | | r.Use(ginglog.Logger(3 * time.Second)) |
| | | //r.Use(ginglog.Logger(3 * time.Second)) |
| | | |
| | | r.Use(auth.AuthHandler()) //auth过滤器 |
| | | |