Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
a755f601
提交
a755f601
authored
9月 18, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
ea1c2441
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
269 行增加
和
61 行删除
+269
-61
xpkg.yaml
conf/xpkg.yaml
+168
-0
config.go
config/config.go
+18
-7
init.go
config/init.go
+1
-11
init.go
init.go
+22
-0
dxsf.go
utils/dxsf/dxsf.go
+10
-16
xsf.go
utils/xsf/xsf.go
+36
-18
cron.go
xcron/cron.go
+3
-1
cron_job.go
xcron/dao/cron_job.go
+0
-8
var.go
xcron/dao/var.go
+11
-0
没有找到文件。
conf/xpkg.yaml
0 → 100644
浏览文件 @
a755f601
app
:
name
:
"
xpkg"
env
:
"
dev"
version
:
"
v0.0.1"
host
:
"
0.0.0.0"
enableStat
:
false
enableMetrics
:
true
enableHTTPProfile
:
true
enableLimit
:
false
enableCircuitBreaker
:
false
enableTrace
:
false
tracingSamplingRate
:
1.0
registryDiscoveryType
:
"
"
cacheType
:
"
memory"
ipRateLimiter
:
enable
:
true
window
:
1m
maxRequests
:
600
sync
:
true
hideSensitiveFields
:
"
smtpPassword"
idGeneration
:
type
:
leaf
# snowflake leaf
leaf
:
addr
:
http://leaf.qitu
showLog
:
true
retryCount
:
2
snowflake
:
node
:
1
http
:
port
:
8080
timeout
:
0
logger
:
level
:
"
debug"
format
:
"
console"
isSave
:
true
logFileConfig
:
filename
:
"
/tmp/xpkg.log"
maxSize
:
100
maxBackups
:
100000
maxAge
:
360
isCompression
:
true
rd
:
nacos
:
ips
:
192.168.1.140
port
:
8848
namespace
:
92f5f471-d181-4028-be08-a3ee89bad9ed
context
:
groupName
:
qitu
clusterName
:
public
weight
:
10
enable
:
true
healthy
:
true
ephemeral
:
true
database
:
-
name
:
"
operator"
driver
:
"
mysql"
default
:
true
mysql
:
dsn
:
"
root:123456@tcp(localhost:30006)/qitu_operator?parseTime=true&loc=Local&charset=utf8,utf8mb4"
enableLog
:
true
maxIdleConns
:
10
maxOpenConns
:
100
connMaxLifetime
:
30
-
name
:
"
pay"
driver
:
"
mysql"
mysql
:
dsn
:
"
root:123456@tcp(localhost:30006)/qt-pay?parseTime=true&loc=Local&charset=utf8,utf8mb4"
enableLog
:
true
maxIdleConns
:
10
maxOpenConns
:
100
connMaxLifetime
:
30
-
name
:
"
athena"
driver
:
"
mysql"
mysql
:
dsn
:
"
root:123456@tcp(localhost:30006)/qitu_athena?parseTime=true&loc=Local&charset=utf8,utf8mb4"
enableLog
:
true
maxIdleConns
:
10
maxOpenConns
:
100
connMaxLifetime
:
30
redis
:
dsn
:
"
default:password123@localhost:30079/6"
dialTimeout
:
10
readTimeout
:
2
writeTimeout
:
2
auth
:
enable
:
true
expire
:
6h
signKey
:
6m2KywHIPEaWWIxffGpp8Dfl3z5SjE5WeeDStc1T64klnpoAqHrHN01vneteCAGE
cron
:
enable
:
true
oss
:
endpoint
:
https://oss-cn-hangzhou.aliyuncs.com
access-key-id
:
LTAI5tD3VA4pi1pcz48yYgXL
access-key-secret
:
sus17wfcbjB6J9hDeJXXFtJf9LPN0S
bucket-name
:
test-wz-main
base-path
:
fota/upgrade
region-id
:
oss-cn-hangzhou
bucket-url
:
https://test-wz-main.oss-cn-hangzhou.aliyuncs.com
extend
:
third-party
:
baofu
:
bct-terminal-id
:
"
"
bct-member-id
:
"
"
bct-version
:
"
1.0.0"
wx
:
appId
:
"
"
appSecret
:
"
"
pay
:
addr
:
http://pay.qitu
reconciliation
:
pull
:
/pay/reconciliationSummary/pull
pullNotify
:
/pay/reconciliationSummary/pullNotify
notify
:
/pay/reconciliationSummary/notify
service
:
operator
:
# 麒兔运营商服务
server-addr
:
"
http://athena-prime.qitu"
site-list
:
"
/internal/operation/siteList"
# 运营商下站点列表
pay-notify
:
"
/internal/notifyPay"
# 支付成功通知
refund-notify
:
"
/internal/notifyRefund"
# 退款通知
login-token
:
"
/internal/partner/getLoginToken"
# 获取运营商登录token
intake-notify
:
"
/internal/operation/create"
# 进件通知
notify-pay-success
:
"
/internal/notifyPay"
# 支付成功通知
notify-refund
:
"
/internal/notifyRefund"
# 退款通知
public
:
# 公共服务
server-addr
:
"
http://car-public.car-iot:18306"
validate-sms
:
"
/sms/validate"
# 验证验证码
sms-send
:
"
/sms/fishSend"
# 发送短信(批量)
qt-pay
:
server-addr
:
"
http://qt-pay.qitu"
withdraw
:
"
/pay/acc/sub-account/withdraw"
withdraw-query
:
"
/pay/acc/sub-account/withdraw/query"
query-balance
:
"
/pay/acc/sub-account/balance/query"
baofu-intake
:
server-addr
:
"
https://dev-mid.hzqitu.com/baofu-entry"
sms-send
:
"
/insrv/common/sendCode"
upload
:
"
/insrv/common/uploadFile"
login
:
"
/front/user/login"
intake
:
"
/front/entry/register"
intake-query
:
"
/front/entry/registerInfo"
intake-qr-code
:
"
/front/entry/getAuthQrCode"
app-id
:
"
9285809280"
app-secret
:
"
dx2LE3dovc51ycjqiezOcd0r0c9taKTeAqCVaR4LBs4"
pay-center
:
server-addr
:
"
http://service-pay.wz-service:18306"
# 支付中心
dg-pay
:
"
/pay/dougong"
# 斗拱支付
dg-refund
:
"
/refund/dougong"
# 斗拱退款
dg-refund-query
:
"
/refund/dougong_query"
# 斗拱支付退款查询
user
:
# 用户中心服务
server-addr
:
"
http://user-center2.wz-service:9901"
entry-record
:
"
/settle/getSettleListByMemberId"
# 入账记录
save-share-rate
:
"
/agent/shareGroupAddMulti"
# 保存合伙人分账
order
:
# 订单服务
server-addr
:
"
http://share.qitu"
profit
:
"
/profit/getProfitCurve"
# 最近两天收益
share-profit
:
"
/profit/getShareDayProfit"
# 合伙人日收益
big-data
:
# 数据中台
server-addr
:
"
http://mid-bigdata.wz-service:8000"
profit-report
:
"
/qitu/profit/report"
# 收益报表
share-income
:
"
/qitu/income/shareList"
# 合伙人收益列表
config/config.go
浏览文件 @
a755f601
...
@@ -111,11 +111,14 @@ type Config struct {
...
@@ -111,11 +111,14 @@ type Config struct {
Logger
Logger
`yaml:"logger" json:"logger"`
Logger
Logger
`yaml:"logger" json:"logger"`
Redis
Redis
`yaml:"redis" json:"redis"`
Redis
Redis
`yaml:"redis" json:"redis"`
CronJobs
Cron
`yaml:"cron" json:"cron"`
CronJobs
Cron
`yaml:"cron" json:"cron"`
Leaf
Leaf
`yaml:"leaf" json:"leaf"`
Oss
oss
.
AliOssConfig
`yaml:"oss" json:"oss"`
Oss
oss
.
AliOssConfig
`yaml:"oss" json:"oss"`
Content
[]
byte
`yaml:"-" json:"-"`
Content
[]
byte
`yaml:"-" json:"-"`
}
}
type
Snowflake
struct
{
Node
int
`yaml:"node" json:"node"`
}
// 选择哪个配置中心
// 选择哪个配置中心
type
ConfCenter
struct
{
type
ConfCenter
struct
{
Local
Local
`yaml:"-" json:"local"`
Local
Local
`yaml:"-" json:"local"`
...
@@ -201,7 +204,7 @@ type ServerSecure struct {
...
@@ -201,7 +204,7 @@ type ServerSecure struct {
Type
string
`yaml:"type" json:"type"`
Type
string
`yaml:"type" json:"type"`
}
}
type
Email
Config
struct
{
type
Email
struct
{
SMTPServer
string
`yaml:"smtpServer" json:"smtpServer"`
SMTPServer
string
`yaml:"smtpServer" json:"smtpServer"`
SMTPPort
int
`yaml:"smtpPort" json:"smtpPort"`
SMTPPort
int
`yaml:"smtpPort" json:"smtpPort"`
SMTPUsername
string
`yaml:"smtpUsername" json:"smtpUsername"`
SMTPUsername
string
`yaml:"smtpUsername" json:"smtpUsername"`
...
@@ -226,11 +229,19 @@ type App struct {
...
@@ -226,11 +229,19 @@ type App struct {
Version
string
`yaml:"version" json:"version"`
Version
string
`yaml:"version" json:"version"`
IPRateLimiter
IPRateLimiter
`yaml:"ipRateLimiter" json:"ipRateLimiter"`
IPRateLimiter
IPRateLimiter
`yaml:"ipRateLimiter" json:"ipRateLimiter"`
HideSensitiveFields
string
`yaml:"hideSensitiveFields" json:"hideSensitiveFields"`
HideSensitiveFields
string
`yaml:"hideSensitiveFields" json:"hideSensitiveFields"`
ConfPath
string
`yaml:"-" json:"confPath"`
ConfPath
string
`yaml:"-" json:"confPath"`
PodName
string
`yaml:"-" json:"podName"`
PodName
string
`yaml:"-" json:"podName"`
WebLog
WebLog
`yaml:"webLog" json:"webLog"`
WebLog
WebLog
`yaml:"webLog" json:"webLog"`
Email
EmailConfig
`yaml:"email" json:"email"`
Email
Email
`yaml:"email" json:"email"`
Snowflake
Snowflake
`yaml:"snowflake" json:"snowflake"`
IDGeneration
IDGeneration
`yaml:"idGeneration" json:"idGeneration"`
}
type
IDGeneration
struct
{
Type
string
`yaml:"type" json:"type"`
// snowflake or leaf
Leaf
Leaf
`yaml:"leaf" json:"leaf"`
Snowflake
Snowflake
`yaml:"snowflake" json:"snowflake"`
}
}
type
WebLog
struct
{
type
WebLog
struct
{
...
...
config/init.go
浏览文件 @
a755f601
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cast"
"github.com/spf13/viper"
"github.com/spf13/viper"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/sliceUtils"
)
)
var
(
var
(
...
@@ -20,16 +19,7 @@ type IExtend interface {
...
@@ -20,16 +19,7 @@ type IExtend interface {
Unlock
()
Unlock
()
}
}
func
init
()
{
func
Parse
()
(
err
error
)
{
if
err
:=
parse
();
err
!=
nil
{
logger
.
Fatal
(
"init failed"
,
logger
.
Err
(
err
))
}
}
func
parse
()
(
err
error
)
{
if
confType
,
ok
:=
os
.
LookupEnv
(
"CONF_TYPE"
);
(
ok
&&
sliceUtils
.
NotContains
([]
string
{
"local"
,
"nacos"
,
"consul"
},
confType
))
||
!
ok
{
return
}
if
hostname
:=
os
.
Getenv
(
"HOSTNAME"
);
hostname
!=
""
{
if
hostname
:=
os
.
Getenv
(
"HOSTNAME"
);
hostname
!=
""
{
Cfg
.
App
.
PodName
=
hostname
Cfg
.
App
.
PodName
=
hostname
}
}
...
...
init.go
浏览文件 @
a755f601
...
@@ -3,6 +3,7 @@ package xpkg
...
@@ -3,6 +3,7 @@ package xpkg
import
(
import
(
"context"
"context"
"fmt"
"fmt"
"os"
"strconv"
"strconv"
"github.com/jinzhu/copier"
"github.com/jinzhu/copier"
...
@@ -15,9 +16,30 @@ import (
...
@@ -15,9 +16,30 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/rd/nacos"
"gitlab.wanzhuangkj.com/tush/xpkg/rd/nacos"
"gitlab.wanzhuangkj.com/tush/xpkg/stat"
"gitlab.wanzhuangkj.com/tush/xpkg/stat"
"gitlab.wanzhuangkj.com/tush/xpkg/tracer"
"gitlab.wanzhuangkj.com/tush/xpkg/tracer"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/dxsf"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/sliceUtils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xsf"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
)
func
init
()
{
if
confType
,
ok
:=
os
.
LookupEnv
(
"CONF_TYPE"
);
(
ok
&&
sliceUtils
.
NotContains
([]
string
{
"local"
,
"nacos"
,
"consul"
},
confType
))
||
!
ok
{
return
}
if
err
:=
config
.
Parse
();
err
!=
nil
{
logger
.
Fatal
(
err
.
Error
())
}
if
err
:=
xsf
.
Init
();
err
!=
nil
{
logger
.
Fatal
(
err
.
Error
())
}
if
err
:=
dxsf
.
Init
();
err
!=
nil
{
logger
.
Fatal
(
err
.
Error
())
}
if
err
:=
Init
();
err
!=
nil
{
logger
.
Fatal
(
err
.
Error
())
}
}
func
Init
()
(
err
error
)
{
func
Init
()
(
err
error
)
{
conf
:=
config
.
Cfg
conf
:=
config
.
Cfg
if
err
:=
initLogger
(
conf
);
err
!=
nil
{
if
err
:=
initLogger
(
conf
);
err
!=
nil
{
...
...
utils/dxsf/dxsf.go
浏览文件 @
a755f601
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"net/http"
"net/http"
"os"
"time"
"time"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
...
@@ -18,7 +17,7 @@ var (
...
@@ -18,7 +17,7 @@ var (
XSF_TYPE
=
"SF"
XSF_TYPE
=
"SF"
retryCount
=
3
retryCount
=
3
showLog
=
false
showLog
=
false
xsfAddr
string
=
"http://leaf.qitu"
addr
string
=
"http://leaf.qitu"
api
=
&
client
{
api
=
&
client
{
cli
:
httpcli
.
NewClient
(
cli
:
httpcli
.
NewClient
(
&
http
.
Client
{
&
http
.
Client
{
...
@@ -35,28 +34,23 @@ type client struct {
...
@@ -35,28 +34,23 @@ type client struct {
cli
*
httpcli
.
Client
cli
*
httpcli
.
Client
}
}
func
init
()
{
func
Init
()
error
{
if
xsfType
:=
os
.
Getenv
(
"XSF_TYPE"
);
xsfType
!=
""
{
if
config
.
Cfg
.
App
.
IDGeneration
.
Leaf
.
Addr
!=
""
{
XSF_TYPE
=
xsfType
addr
=
config
.
Cfg
.
App
.
IDGeneration
.
Leaf
.
Addr
}
if
addr
:=
os
.
Getenv
(
"XSF_ADDR"
);
addr
!=
""
{
xsfAddr
=
addr
}
if
config
.
Cfg
.
Leaf
.
Addr
!=
""
{
xsfAddr
=
config
.
Cfg
.
Leaf
.
Addr
}
}
config
.
Read
(
func
(
c
*
config
.
Config
)
{
config
.
Read
(
func
(
c
*
config
.
Config
)
{
if
c
.
Leaf
.
ShowLog
{
if
c
.
App
.
IDGeneration
.
Leaf
.
ShowLog
{
showLog
=
true
showLog
=
true
}
}
if
c
.
Leaf
.
RetryCount
>
0
{
if
c
.
App
.
IDGeneration
.
Leaf
.
RetryCount
>
0
{
retryCount
=
c
.
Leaf
.
RetryCount
retryCount
=
c
.
App
.
IDGeneration
.
Leaf
.
RetryCount
}
}
})
})
return
nil
}
}
func
GenerateID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
func
GenerateID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
if
XSF_TYPE
==
"
SF
"
{
if
XSF_TYPE
==
"
snowflake
"
{
return
GenerateSFID
(
ctx
,
bizTag
)
return
GenerateSFID
(
ctx
,
bizTag
)
}
else
{
}
else
{
return
GenerateApiID
(
ctx
,
bizTag
)
return
GenerateApiID
(
ctx
,
bizTag
)
...
@@ -68,7 +62,7 @@ func GenerateSFID(ctx context.Context, bizTag string) (xsf.ID, error) {
...
@@ -68,7 +62,7 @@ func GenerateSFID(ctx context.Context, bizTag string) (xsf.ID, error) {
}
}
func
GenerateApiID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
func
GenerateApiID
(
ctx
context
.
Context
,
bizTag
string
)
(
xsf
.
ID
,
error
)
{
url
:=
fmt
.
Sprintf
(
`%s/api/leaf?biz_tag=%s`
,
xsfA
ddr
,
bizTag
)
url
:=
fmt
.
Sprintf
(
`%s/api/leaf?biz_tag=%s`
,
a
ddr
,
bizTag
)
var
id
xsf
.
ID
var
id
xsf
.
ID
reply
:=
&
IDReply
{
reply
:=
&
IDReply
{
Data
:
&
id
,
Data
:
&
id
,
...
...
utils/xsf/xsf.go
浏览文件 @
a755f601
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"time"
"time"
"github.com/bwmarrin/snowflake"
"github.com/bwmarrin/snowflake"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
)
...
@@ -80,32 +81,49 @@ func (j JSONSyntaxError) Error() string {
...
@@ -80,32 +81,49 @@ func (j JSONSyntaxError) Error() string {
}
}
// n [1,1023]
// n [1,1023]
func
init
()
{
func
Init
()
error
{
var
(
n
:=
getConfigN
()
n
int64
delta
:=
getNodeFromPodName
()
e
error
if
delta
>
0
{
)
n
=
n
+
delta
if
podName
:=
os
.
Getenv
(
"POD_NAME"
);
podName
!=
""
{
parts
:=
strings
.
Split
(
podName
,
"-"
)
if
len
(
parts
)
==
2
{
lastPart
:=
parts
[
len
(
parts
)
-
1
]
n
,
_
=
strconv
.
ParseInt
(
lastPart
,
10
,
64
)
}
}
if
xsfNode
:=
os
.
Getenv
(
"XSF_NODE"
);
xsfNode
!=
""
{
n
,
_
=
strconv
.
ParseInt
(
xsfNode
,
10
,
64
)
}
}
if
n
<=
0
{
if
n
<=
0
{
r
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
n
=
getRandomN
()
n
=
int64
(
r
.
Intn
(
1023
)
+
1
)
}
}
nod
,
e
:=
snowflake
.
NewNode
(
n
)
config
.
Write
(
func
(
c
*
config
.
Config
)
{
c
.
App
.
IDGeneration
.
Snowflake
.
Node
=
n
})
nod
,
e
:=
snowflake
.
NewNode
(
int64
(
n
))
if
e
!=
nil
{
if
e
!=
nil
{
panic
(
e
)
return
e
}
}
node
=
nod
node
=
nod
return
nil
}
}
func
getConfigN
()
int
{
n
:=
0
config
.
Read
(
func
(
c
*
config
.
Config
)
{
n
=
c
.
App
.
Snowflake
.
Node
})
return
n
}
func
getRandomN
()
int
{
r
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
n
:=
int
(
r
.
Intn
(
1023
)
+
1
)
return
n
}
func
getNodeFromPodName
()
int
{
if
podName
:=
os
.
Getenv
(
"POD_NAME"
);
podName
!=
""
{
parts
:=
strings
.
Split
(
podName
,
"-"
)
if
len
(
parts
)
==
2
{
lastPart
:=
parts
[
len
(
parts
)
-
1
]
n
,
_
:=
strconv
.
ParseInt
(
lastPart
,
10
,
64
)
return
int
(
n
)
}
}
return
0
}
func
(
x
ID
)
String
()
string
{
func
(
x
ID
)
String
()
string
{
return
snowflake
.
ID
(
x
)
.
String
()
return
snowflake
.
ID
(
x
)
.
String
()
}
}
...
...
xcron/cron.go
浏览文件 @
a755f601
...
@@ -110,7 +110,9 @@ func (x *cronJobController) CallOnceByCode(c *gin.Context) {
...
@@ -110,7 +110,9 @@ func (x *cronJobController) CallOnceByCode(c *gin.Context) {
response
.
Success
(
c
)
response
.
Success
(
c
)
}
}
func
Init
(
handlers
map
[
string
]
Fn
)
error
{
func
Init
(
schema
string
,
handlers
map
[
string
]
Fn
)
error
{
dao
.
Init
(
schema
)
ctx
:=
context
.
TODO
()
ctx
:=
context
.
TODO
()
TaskRegisterMaps
=
handlers
TaskRegisterMaps
=
handlers
if
!
config
.
CronOpen
()
{
if
!
config
.
CronOpen
()
{
...
...
xcron/dao/cron_job.go
浏览文件 @
a755f601
...
@@ -6,11 +6,9 @@ import (
...
@@ -6,11 +6,9 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/consts"
"gitlab.wanzhuangkj.com/tush/xpkg/consts"
"gitlab.wanzhuangkj.com/tush/xpkg/database"
"gitlab.wanzhuangkj.com/tush/xpkg/database"
"gitlab.wanzhuangkj.com/tush/xpkg/xcommon/odao"
"gitlab.wanzhuangkj.com/tush/xpkg/xcommon/odao"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/cache"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/enums"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/enums"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/models"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/models"
"gitlab.wanzhuangkj.com/tush/xpkg/eventbus"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xsf"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xsf"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"golang.org/x/sync/singleflight"
"golang.org/x/sync/singleflight"
...
@@ -31,12 +29,6 @@ var CronJobDao = &cronJobDao{
...
@@ -31,12 +29,6 @@ var CronJobDao = &cronJobDao{
},
},
}
}
func
init
()
{
_
=
eventbus
.
Eb
.
Subscribe
(
eventbus
.
TopicCacheInitFinish
,
func
(
ctx
context
.
Context
)
{
CronJobDao
.
ODao
.
Cache
=
cache
.
NewCronJobCache
(
database
.
GetCacheType
())
})
}
func
(
x
*
cronJobDao
)
GetByJobCode
(
ctx
context
.
Context
,
jobCode
string
)
(
*
models
.
CronJob
,
error
)
{
func
(
x
*
cronJobDao
)
GetByJobCode
(
ctx
context
.
Context
,
jobCode
string
)
(
*
models
.
CronJob
,
error
)
{
if
jobCode
==
""
{
if
jobCode
==
""
{
return
nil
,
nil
return
nil
,
nil
...
...
xcron/dao/var.go
浏览文件 @
a755f601
package
dao
package
dao
import
(
"context"
"gitlab.wanzhuangkj.com/tush/xpkg/database"
"gitlab.wanzhuangkj.com/tush/xpkg/eventbus"
"gitlab.wanzhuangkj.com/tush/xpkg/xcron/cache"
)
var
(
var
(
Schema
string
Schema
string
)
)
func
Init
(
schema
string
)
{
func
Init
(
schema
string
)
{
Schema
=
schema
Schema
=
schema
_
=
eventbus
.
Eb
.
Subscribe
(
eventbus
.
TopicCacheInitFinish
,
func
(
ctx
context
.
Context
)
{
CronJobDao
.
ODao
.
Cache
=
cache
.
NewCronJobCache
(
database
.
GetCacheType
())
})
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论