🎨 优化用户和分类相关接口,新增banner接口

This commit is contained in:
2025-06-23 17:04:44 +08:00
parent a5ae680f94
commit cf0f60d221
29 changed files with 695 additions and 299 deletions

View File

@@ -1,6 +1,7 @@
package initialize
import (
"git.echol.cn/loser/lckt/model/app"
"os"
"git.echol.cn/loser/lckt/global"
@@ -62,6 +63,8 @@ func RegisterTables() {
example.ExaFileChunk{},
example.ExaFileUploadAndDownload{},
example.ExaAttachmentCategory{},
app.Banner{},
)
if err != nil {
global.GVA_LOG.Error("register table failed", zap.Error(err))

View File

@@ -12,7 +12,14 @@ import (
func bizModel() error {
db := global.GVA_DB
err := db.AutoMigrate(category.Category{}, bot.Bot{}, article.Article{}, user.User{}, vip.Vip{}, notice.Notice{}, notice.Notice{})
err := db.AutoMigrate(
category.Category{},
bot.Bot{},
article.Article{},
user.User{},
vip.Vip{},
notice.Notice{},
)
if err != nil {
return err
}

View File

@@ -44,6 +44,7 @@ func Routers() *gin.Engine {
systemRouter := router.RouterGroupApp.System
exampleRouter := router.RouterGroupApp.Example
appRouter := router.RouterGroupApp.APP
// 如果想要不使用nginx代理前端网页可以修改 web/.env.production 下的
// VUE_APP_BASE_API = /
// VUE_APP_BASE_PATH = http://localhost
@@ -63,10 +64,12 @@ func Routers() *gin.Engine {
// 方便统一添加路由组前缀 多服务器上线使用
PublicGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
PublicGroup.Use(middleware.Cors()) // 直接放行全部跨域请求
PrivateGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler()).Use(middleware.Cors())
AppAuthGroup := Router.Group(global.GVA_CONFIG.System.RouterPrefix)
//AppAuthGroup.Use(middleware.UserJWTAuth()).Use(middleware.Cors())
{
// 健康监测
PublicGroup.GET("/health", func(c *gin.Context) {
@@ -99,6 +102,11 @@ func Routers() *gin.Engine {
exampleRouter.InitAttachmentCategoryRouterRouter(PrivateGroup) // 文件上传下载分类
}
//APP相关路由
{
appRouter.InitAppUserRouter(AppAuthGroup, PublicGroup)
appRouter.InitBannerRouter(PrivateGroup, PublicGroup) // Banner相关路由
}
//插件路由安装
InstallPlugin(PrivateGroup, PublicGroup, Router)

View File

@@ -28,7 +28,6 @@ func initBizRouter(routers ...*gin.RouterGroup) {
{
userRouter := router.RouterGroupApp.User
userRouter.InitUserRouter(privateGroup, publicGroup)
userRouter.InitAppUserRouter(publicGroup)
}
{
vipRouter := router.RouterGroupApp.Vip