commit
95ce8b6ae6
@ -1,24 +0,0 @@
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Gin struct {
|
||||
C *gin.Context
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
func (g *Gin) Response(httpCode int, errMsg string, data interface{}) {
|
||||
g.C.JSON(httpCode, Response{
|
||||
Code: httpCode,
|
||||
Msg: errMsg,
|
||||
Data: data,
|
||||
})
|
||||
return
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package routers
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
api "webserver/pkg/api"
|
||||
)
|
||||
|
||||
// InitRouter 初始化路由信息
|
||||
func InitRouter() *gin.Engine {
|
||||
r := gin.Default()
|
||||
// 静态文件路由
|
||||
r.LoadHTMLGlob("./template/*")
|
||||
r.StaticFS("/template", http.Dir("template"))
|
||||
r.StaticFS("/static", http.Dir("static"))
|
||||
r.GET("/trans", api.SqliteQueryTRANSLATION)
|
||||
r.GET("/xyz", api.SqliteQueryXYZ)
|
||||
r.GET("/address", api.SendAddress)
|
||||
r.GET("/request", api.Request)
|
||||
return r
|
||||
}
|
Loading…
Reference in new issue