This commit is contained in:
coward
2024-08-06 14:49:05 +08:00
parent da7ffc9343
commit 4cc3c075ed
423 changed files with 115 additions and 7294 deletions

View File

@@ -19,6 +19,16 @@ func InitRouter() *gin.Engine {
r.ForwardedByClientIP = true
// 将请求打印至控制台
r.Use(gin.Logger())
//r.Use(cors.New(cors.Config{
// AllowOrigins: []string{"http://localhost:3100"},
// AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE"},
// AllowHeaders: []string{"Origin"},
// ExposeHeaders: []string{"Content-Length"},
// AllowCredentials: true,
// AllowOriginFunc: func(origin string) bool {
// return true
// },
//}))
if config.Config.File.Type == "local" {
r.Static("/assets", config.Config.File.Path)

View File

@@ -20,5 +20,6 @@ func UserApi(r *gin.RouterGroup) {
userApi.PUT("/change-password", api.User().ChangePassword) // 修改用户密码
userApi.PUT("/reset-password/:id", api.User().ResetPassword) // 重置用户密码
userApi.POST("/generate-avatar", api.User().GenerateAvatar) // 生成头像
userApi.POST("/logout", api.Login().Logout) // 退出登陆
}
}