提交 4d9148df authored 作者: mooncake9527's avatar mooncake9527

context path

上级 8f949fb3
......@@ -223,8 +223,9 @@ type Email struct {
}
type App struct {
CacheType string `yaml:"cacheType" json:"cacheType"`
Middleware Middleware `yaml:"middleware" json:"middleware"`
CacheType string `yaml:"cacheType" json:"cacheType"`
ContextPath string `yaml:"contextPath" json:"contextPath"`
Middleware Middleware `yaml:"middleware" json:"middleware"`
Env string `yaml:"env" json:"env"`
Host string `yaml:"host" json:"host"`
......
......@@ -17,7 +17,9 @@ func Init() {
func initLocalCron() {
var cron config.Cron
contextPath := ""
config.Read(func(c *config.Config) {
contextPath = c.App.ContextPath
_ = copier.Copy(&cron, c.Cron)
})
if !cron.Enable {
......@@ -34,6 +36,6 @@ func initLocalCron() {
initCron()
g := global.G.Engine
if g != nil {
engine.RegisterRouters(g, "/internal", CronRouterApis)
engine.RegisterRouters(g, contextPath+"/internal", CronRouterApis)
}
}
......@@ -15,7 +15,7 @@ func init() {
func cronJobRouter(group *gin.RouterGroup) {
c := controller.CronJobController
g := group.Group("/cronJob")
g := group.Group("/cron")
g.POST("/startByCode", c.StartByCode)
g.POST("/stopByCode", c.StopByCode)
g.POST("/callByCode", c.CallOnceByCode)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论