You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.1 KiB

package initialize
import (
"net/http"
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
"bkb-seller/global"
"bkb-seller/middleware"
"bkb-seller/router"
)
// 初始化总路由
func Routers() *gin.Engine {
var Router = gin.Default()
Router.StaticFS(global.MG_CONFIG.Local.Path, http.Dir(global.MG_CONFIG.Local.Path)) // 为用户头像和文件提供静态地址
// 跨域
Router.Use(middleware.Cors()) // 如需跨域可以打开
Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
Router.Any("/ueditor/controller", nil) // 百度富文本编辑器
// 方便统一添加路由组前缀 多服务器上线使用
PublicGroup := Router.Group("")
{
router.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
router.InitCommonRouter(PublicGroup)
}
PrivateGroup := Router.Group("")
// PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
PrivateGroup.Use(middleware.JWTAuth())
{
// router.InitApiRouter(PrivateGroup) // 注册功能api路由
// router.InitUserRouter(PrivateGroup) // 注册用户路由
// router.InitMenuRouter(PrivateGroup) // 注册menu路由
// router.InitCasbinRouter(PrivateGroup) // 权限相关路由
// router.InitAuthorityRouter(PrivateGroup) // 注册角色路由
// router.InitSysOperationRecordRouter(PrivateGroup) // 操作记录
// router.InitJwtRouter(PrivateGroup) // jwt相关路由
// router.InitCustomerRouter(PrivateGroup) // 客户路由
// router.InitAutoCodeRouter(PrivateGroup) // 创建自动化代码
// router.InitSystemRouter(PrivateGroup) // system相关路由
// router.InitSimpleUploaderRouter(PrivateGroup) // 断点续传(插件版)
// router.InitEmailRouter(PrivateGroup) // 邮件相关路由
// router.InitSysDictionaryRouter(PrivateGroup) // 字典管理
// router.InitSysDictionaryDetailRouter(PrivateGroup) // 字典详情管理
// router.InitFileUploadAndDownloadRouter(PrivateGroup) // 文件上传下载功能路由
// router.InitExcelRouter(PrivateGroup) // 表格导入导出
// Code generated by bkb-seller Begin; DO NOT EDIT.
// Code generated by bkb-seller End; DO NOT EDIT.
router.InitTbAttributeRouter(PrivateGroup)
router.InitTbCategoryRouter(PrivateGroup)
router.InitTbGoodsRouter(PrivateGroup)
router.InitMissionRouter(PrivateGroup)
router.InitInfluencerWalletRouter(PrivateGroup) // 账户相关接口
router.InitInfluencerOrderRouter(PrivateGroup) // 订单相关
router.InitConsoleRouter(PrivateGroup) // 统计相关
router.InitInfluencerUserRouter(PrivateGroup) // 网红相关
router.InitBusinessRouter(PrivateGroup) // 商家相关
router.InitDictRouter(PrivateGroup) // 字典相关
router.InitSourceFileRouter(PrivateGroup) // 素材相关
router.InitSysSellerRouter(PrivateGroup) // 商家端子账号权限模块
}
global.MG_LOG.Info("router register success")
// router.InitApiEngineRouter(Router)
return Router
}