up
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
package routers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"saas/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
func Api_router(r *gin.RouterGroup) {
|
||||
func Router_api(r *gin.RouterGroup) {
|
||||
|
||||
r.GET("/", func(ctx *gin.Context) {
|
||||
Return_json(ctx, "api_ok", nil)
|
||||
@@ -33,8 +32,6 @@ func Api_router(r *gin.RouterGroup) {
|
||||
ctx.Set("data", &data_t)
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.Println("jsonerr", err)
|
||||
}
|
||||
|
||||
Use_login_from_cookie(ctx)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Def_router(r *gin.RouterGroup) {
|
||||
func Router_def(r *gin.RouterGroup) {
|
||||
|
||||
r.Use(func(ctx *gin.Context) {
|
||||
cookie_vel := ""
|
||||
|
||||
@@ -1 +1,40 @@
|
||||
package routers
|
||||
|
||||
//文件路由
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Router_file(r *gin.RouterGroup) {
|
||||
|
||||
r.Use(func(ctx *gin.Context) {
|
||||
cookie_value := ctx.PostForm("cookie")
|
||||
//fmt.Println(cookie_value)
|
||||
|
||||
ctx.Set("cookie_value", cookie_value)
|
||||
Use_login_from_cookie(ctx)
|
||||
|
||||
//先判断有没有登录
|
||||
_, is_login := ctx.Get("user_info")
|
||||
if is_login {
|
||||
|
||||
} else {
|
||||
Return_json(ctx, "user_no_sign", nil)
|
||||
}
|
||||
})
|
||||
|
||||
r.POST("/upload", func(ctx *gin.Context) {
|
||||
file, err := ctx.FormFile("file")
|
||||
if err == nil {
|
||||
fmt.Println("ok")
|
||||
} else {
|
||||
fmt.Println("err:", err)
|
||||
fmt.Println("file:", file)
|
||||
}
|
||||
Return_json(ctx, "api_ok", nil)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user