init project

This commit is contained in:
2023-04-24 17:19:41 +08:00
parent 84729ebb66
commit cdb5a4f9cd
51 changed files with 3328 additions and 1 deletions

15
router/app/login.go Normal file
View File

@@ -0,0 +1,15 @@
package app
import (
"Lee-WineList/api/app"
"Lee-WineList/middleware"
"github.com/gin-gonic/gin"
)
// 登录相关
func login(g *gin.RouterGroup) {
// 登录相关接口
g.POST("/token", app.LoginApi().Login)
g.POST("/token/refresh", app.LoginApi().Refresh)
g.POST("/token/logout", middleware.AuthorizeToken(), app.LoginApi().Logout)
}

12
router/app/route.go Normal file
View File

@@ -0,0 +1,12 @@
package app
import (
"Lee-WineList/middleware"
"github.com/gin-gonic/gin"
)
// InitRoute 初始化路由
func InitRoute(g *gin.RouterGroup) {
login(g) // 登录相关路由
user(g.Group("/user", middleware.AuthorizeToken())) // 用户相关路由
}

13
router/app/user.go Normal file
View File

@@ -0,0 +1,13 @@
package app
import (
"Lee-WineList/api/app"
"github.com/gin-gonic/gin"
)
// 用户相关路由
func user(g *gin.RouterGroup) {
g.GET("", app.UserApi().GetUser) // 获取当前登录用户信息
g.POST("/binding/wechat", app.UserApi().BindingWeChat) // 绑定微信
g.POST("/update", app.UserApi().UpdateUser) // 修改用户信息
}