Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
694dc42f
提交
694dc42f
authored
10月 27, 2025
作者:
mooncake
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
3d3f2557
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
15 行增加
和
129 行删除
+15
-129
config.go
config/config.go
+4
-3
consts.go
consts/consts.go
+0
-14
database.go
database/database.go
+1
-1
xgin.go
gin/xgin/xgin.go
+5
-5
xsf_utils.go
pkg/email/xsf_utils/xsf_utils.go
+0
-101
init.go
pkg/eventbus/init.go
+1
-1
dxsf.go
xutils/dxsf/dxsf.go
+4
-4
没有找到文件。
config/config.go
浏览文件 @
694dc42f
...
...
@@ -354,13 +354,14 @@ type Redis struct {
WriteTimeout
int
`yaml:"writeTimeout" json:"writeTimeout" mapstructure:"writeTimeout"`
}
// 目前仅支持mysql
type
Database
struct
{
Name
string
`yaml:"name" json:"name" mapstructure:"name"`
Driver
string
`yaml:"driver" json:"driver" mapstructure:"driver"`
Mongodb
Mongodb
`yaml:"mongodb" json:"mongodb" mapstructure:"mongodb"`
//
Mongodb Mongodb `yaml:"mongodb" json:"mongodb" mapstructure:"mongodb"`
Mysql
Mysql
`yaml:"mysql" json:"mysql" mapstructure:"mysql"`
Postgresql
Mysql
`yaml:"postgresql" json:"postgresql" mapstructure:"postgresql"`
Sqlite
Sqlite
`yaml:"sqlite" json:"sqlite" mapstructure:"sqlite"`
//
Postgresql Mysql `yaml:"postgresql" json:"postgresql" mapstructure:"postgresql"`
//
Sqlite Sqlite `yaml:"sqlite" json:"sqlite" mapstructure:"sqlite"`
}
type
Mongodb
struct
{
...
...
consts/consts.go
deleted
100644 → 0
浏览文件 @
3d3f2557
package
consts
var
(
// DefaultSchema string
RootRoute
string
)
// func SetDefaultSchema(schema string) {
// DefaultSchema = schema
// }
func
SetRootRoute
(
v
string
)
{
RootRoute
=
v
}
database/database.go
浏览文件 @
694dc42f
...
...
@@ -54,7 +54,7 @@ func (x XDB) DB() *sgorm.DB {
func
DB
(
name
string
)
*
sgorm
.
DB
{
conn
,
ok
:=
gdbs
[
name
]
if
!
ok
{
err
:=
xerror
.
Newf
(
"
gdb
[%s] not initialized"
,
name
)
err
:=
xerror
.
Newf
(
"
database
[%s] not initialized"
,
name
)
panic
(
err
)
}
return
conn
...
...
gin/xgin/xgin.go
浏览文件 @
694dc42f
...
...
@@ -12,7 +12,6 @@ import (
swaggerFiles
"github.com/swaggo/files"
ginSwagger
"github.com/swaggo/gin-swagger"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
"gitlab.wanzhuangkj.com/tush/xpkg/consts"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/handlerfunc"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/middleware"
metrics
"gitlab.wanzhuangkj.com/tush/xpkg/gin/middleware/metrics_wz"
...
...
@@ -125,13 +124,14 @@ func New() *gin.Engine {
weblogutils
.
Init
()
if
config
.
IsNotProd
()
{
r
.
GET
(
consts
.
RootRoute
+
"/config"
,
gin
.
WrapF
(
errcode
.
ShowConfig
([]
byte
(
config
.
Show
()))))
r
.
GET
(
consts
.
RootRoute
+
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
contextPath
:=
app
.
ContextPath
r
.
GET
(
contextPath
+
"/config"
,
gin
.
WrapF
(
errcode
.
ShowConfig
([]
byte
(
config
.
Show
()))))
r
.
GET
(
contextPath
+
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
eventbus
.
Eb
.
Subscribe
(
eventbus
.
TopicPrintSwagger
,
func
(
ctx
context
.
Context
)
{
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: http://localhost:%d"
+
con
sts
.
RootRoute
+
"/swagger/index.html"
,
httpCfg
.
Port
)))
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: http://localhost:%d"
+
con
textPath
+
"/swagger/index.html"
,
httpCfg
.
Port
)))
ip
:=
ips
.
GetLocalHost
()
if
ip
!=
""
{
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: https://%s:%d"
+
con
sts
.
RootRoute
+
"/swagger/index.html"
,
ip
,
httpCfg
.
Port
)))
fmt
.
Println
(
text
.
Blue
(
fmt
.
Sprintf
(
"swagger: https://%s:%d"
+
con
textPath
+
"/swagger/index.html"
,
ip
,
httpCfg
.
Port
)))
}
})
}
...
...
pkg/email/xsf_utils/xsf_utils.go
浏览文件 @
694dc42f
...
...
@@ -11,58 +11,14 @@ import (
)
const
(
bizTag_agent
=
"qt.operator.agent.id"
bizTag_agent_operator
=
"qt.operator.agent.operator.id"
bizTag_api_notify
=
"qt.operator.api.notify.id"
bizTag_app_module
=
"qt.operator.app.module.id"
bizTag_auth_role
=
"qt.operator.auth.role.id"
bizTag_cron_job
=
"qt.operator.cron.job.id"
bizTag_cron_job_log
=
"qt.operator.cron.job.log.id"
bizTag_cron_job_record
=
"qt.operator.cron.job.record.id"
bizTag_email
=
"qt.operator.email.id"
bizTag_email_receiver
=
"qt.operator.email.receiver.id"
bizTag_email_send
=
"qt.operator.email.send.id"
bizTag_email_send_log
=
"qt.operator.email.send.log.id"
bizTag_email_tpl
=
"qt.operator.email.tpl.id"
bizTag_email_tpl_receiver
=
"qt.operator.email.tpl.receiver.id"
bizTag_intake
=
"qt.operator.intake.id"
bizTag_operator
=
"qt.operator.operator.id"
bizTag_platform_config
=
"qt.operator.platform.config.id"
bizTag_share
=
"qt.operator.share.id"
bizTag_site
=
"qt.operator.site.id"
bizTag_site_share
=
"qt.operator.site.share.id"
bizTag_site_user
=
"qt.operator.site.user.id"
bizTag_sms_code
=
"qt.operator.sms.code.id"
bizTag_user
=
"qt.operator.user.id"
bizTag_user_token
=
"qt.operator.user.token.id"
bizTag_web_log
=
"qt.operator.web.log.id"
bizTag_withdraw
=
"qt.operator.withdraw.id"
)
func
AgentID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_agent
)
}
func
AgentOperatorID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_agent_operator
)
}
func
ApiNotifyID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_api_notify
)
}
func
AppModuleID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_app_module
)
}
func
AuthRoleID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_auth_role
)
}
func
CronJobID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_cron_job
)
}
func
CronJobLogID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_cron_job_log
)
}
func
CronJobRecordID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_cron_job_record
)
}
func
EmailID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_email
)
}
...
...
@@ -81,43 +37,6 @@ func EmailTplID(ctx context.Context) xsf.ID {
func
EmailTplReceiverID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_email_tpl_receiver
)
}
func
IntakeID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_intake
)
}
func
OperatorID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_operator
)
}
func
PlatformConfigID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_platform_config
)
}
func
ShareID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_share
)
}
func
SiteID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_site
)
}
func
SiteShareID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_site_share
)
}
func
SiteUserID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_site_user
)
}
func
SmsCodeID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_sms_code
)
}
func
UserID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_user
)
}
func
UserTokenID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_user_token
)
}
func
WebLogID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_web_log
)
}
func
WithdrawID
(
ctx
context
.
Context
)
xsf
.
ID
{
return
generateID
(
ctx
,
bizTag_withdraw
)
}
func
generateID
(
ctx
context
.
Context
,
bizTag
string
)
xsf
.
ID
{
xsf
,
err
:=
dxsf
.
GenerateID
(
ctx
,
bizTag
)
if
err
!=
nil
{
...
...
@@ -127,29 +46,9 @@ func generateID(ctx context.Context, bizTag string) xsf.ID {
return
xsf
}
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.agent.id',100000,2000,'qt.operator.agent.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.agent.operator.id',100000,2000,'qt.operator.agent.operator.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.api.notify.id',100000,2000,'qt.operator.api.notify.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.app.module.id',100000,2000,'qt.operator.app.module.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.auth.role.id',100000,2000,'qt.operator.auth.role.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.cron.job.id',100000,2000,'qt.operator.cron.job.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.cron.job.log.id',100000,2000,'qt.operator.cron.job.log.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.cron.job.record.id',100000,2000,'qt.operator.cron.job.record.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.id',100000,2000,'qt.operator.email.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.receiver.id',100000,2000,'qt.operator.email.receiver.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.send.id',100000,2000,'qt.operator.email.send.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.send.log.id',100000,2000,'qt.operator.email.send.log.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.tpl.id',100000,2000,'qt.operator.email.tpl.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.email.tpl.receiver.id',100000,2000,'qt.operator.email.tpl.receiver.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.intake.id',100000,2000,'qt.operator.intake.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.operator.id',100000,2000,'qt.operator.operator.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.platform.config.id',100000,2000,'qt.operator.platform.config.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.share.id',100000,2000,'qt.operator.share.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.site.id',100000,2000,'qt.operator.site.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.site.share.id',100000,2000,'qt.operator.site.share.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.site.user.id',100000,2000,'qt.operator.site.user.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.sms.code.id',100000,2000,'qt.operator.sms.code.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.user.id',100000,2000,'qt.operator.user.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.user.token.id',100000,2000,'qt.operator.user.token.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.web.log.id',100000,2000,'qt.operator.web.log.id');
// insert into leaf_alloc(biz_tag,max_id,step,description) values ('qt.operator.withdraw.id',100000,2000,'qt.operator.withdraw.id');
pkg/eventbus/init.go
浏览文件 @
694dc42f
...
...
@@ -19,6 +19,6 @@ const (
TopicRdInit
string
=
"event:application:rd:init"
//
TopicRdInitFinish
string
=
"event:application:rd:init:finish"
//
TopicGinEngineCreated
string
=
"event:application:gin:engine:created"
//
TopicPrintSwagger
string
=
"event:
swagger:print"
//
TopicPrintSwagger
string
=
"event:
application:swagger:print"
//
TopicApplicationClose
string
=
"event:application:close"
//
)
xutils/dxsf/dxsf.go
浏览文件 @
694dc42f
...
...
@@ -55,17 +55,17 @@ func Init() error {
func
GenerateID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
if
idGenerateType
==
"snowflake"
{
return
G
enerateSFID
(
ctx
,
bizTag
)
return
g
enerateSFID
(
ctx
,
bizTag
)
}
else
{
return
G
enerateApiID
(
ctx
,
bizTag
)
return
g
enerateApiID
(
ctx
,
bizTag
)
}
}
func
GenerateSFID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
func
generateSFID
(
_
context
.
Context
,
_
string
)
(
xsf
.
ID
,
error
)
{
return
xsf
.
GenerateID
(),
nil
}
func
G
enerateApiID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
func
g
enerateApiID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
url
:=
fmt
.
Sprintf
(
`%s/api/leaf?biz_tag=%s`
,
leafAddr
,
bizTag
)
var
id
xsf
.
ID
reply
:=
&
IDReply
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论