Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
8aa0b2ed
提交
8aa0b2ed
authored
9月 19, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
290e6fd6
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
6 行增加
和
2 行删除
+6
-2
init_app.go
application/init_app.go
+1
-0
xgin.go
gin/xgin/xgin.go
+4
-2
init.go
pkg/eventbus/init.go
+1
-0
没有找到文件。
application/init_app.go
浏览文件 @
8aa0b2ed
...
@@ -58,6 +58,7 @@ func (x *Application) Run() {
...
@@ -58,6 +58,7 @@ func (x *Application) Run() {
services
:=
CreateServices
(
x
.
h
())
services
:=
CreateServices
(
x
.
h
())
closes
:=
Close
(
services
)
closes
:=
Close
(
services
)
x
.
app
=
app
.
New
(
services
,
closes
)
x
.
app
=
app
.
New
(
services
,
closes
)
eventbus
.
Eb
.
Publish
(
context
.
TODO
(),
eventbus
.
TopicPrintSwagger
)
x
.
app
.
Run
()
x
.
app
.
Run
()
}
}
...
...
gin/xgin/xgin.go
浏览文件 @
8aa0b2ed
package
xgin
package
xgin
import
(
import
(
"context"
"fmt"
"fmt"
"net/http"
"net/http"
"time"
"time"
...
@@ -18,6 +19,7 @@ import (
...
@@ -18,6 +19,7 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/gin/prof"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/prof"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/validator"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/validator"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/eventbus"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/ips"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/ips"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/logger"
...
@@ -96,13 +98,13 @@ func New() *gin.Engine {
...
@@ -96,13 +98,13 @@ func New() *gin.Engine {
if
config
.
IsNotProd
()
{
if
config
.
IsNotProd
()
{
r
.
GET
(
consts
.
RootRoute
+
"/config"
,
gin
.
WrapF
(
errcode
.
ShowConfig
([]
byte
(
config
.
Show
()))))
r
.
GET
(
consts
.
RootRoute
+
"/config"
,
gin
.
WrapF
(
errcode
.
ShowConfig
([]
byte
(
config
.
Show
()))))
r
.
GET
(
consts
.
RootRoute
+
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
r
.
GET
(
consts
.
RootRoute
+
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
defer
func
(
)
{
eventbus
.
Eb
.
Subscribe
(
eventbus
.
TopicPrintSwagger
,
func
(
ctx
context
.
Context
)
{
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: http://localhost:%d"
+
consts
.
RootRoute
+
"/swagger/index.html"
,
httpCfg
.
Port
)))
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: http://localhost:%d"
+
consts
.
RootRoute
+
"/swagger/index.html"
,
httpCfg
.
Port
)))
ip
:=
ips
.
GetLocalHost
()
ip
:=
ips
.
GetLocalHost
()
if
ip
!=
""
{
if
ip
!=
""
{
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: https://%s:%d"
+
consts
.
RootRoute
+
"/swagger/index.html"
,
ip
,
httpCfg
.
Port
)))
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: https://%s:%d"
+
consts
.
RootRoute
+
"/swagger/index.html"
,
ip
,
httpCfg
.
Port
)))
}
}
}
(
)
})
}
}
r
.
GET
(
"/health"
,
handlerfunc
.
CheckHealth
)
r
.
GET
(
"/health"
,
handlerfunc
.
CheckHealth
)
...
...
pkg/eventbus/init.go
浏览文件 @
8aa0b2ed
...
@@ -9,5 +9,6 @@ const (
...
@@ -9,5 +9,6 @@ const (
TopicCacheInitFinish
string
=
"event:application:cache:init:finish"
// cache初始化完成
TopicCacheInitFinish
string
=
"event:application:cache:init:finish"
// cache初始化完成
TopicCronInitFinish
string
=
"event:application:cron:init:finish"
// 定时任务初始化完成
TopicCronInitFinish
string
=
"event:application:cron:init:finish"
// 定时任务初始化完成
TopicCoreInitFinish
string
=
"event:application:core:init:finish"
// 核心服务初始化完成
TopicCoreInitFinish
string
=
"event:application:core:init:finish"
// 核心服务初始化完成
TopicPrintSwagger
string
=
"event:swagger:print"
// 打印swagger doc info
TopicApplicationClose
string
=
"event:application:close"
// 应用关闭
TopicApplicationClose
string
=
"event:application:close"
// 应用关闭
)
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论