mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
Manage的Codes和Workday共用一个客户端
This commit is contained in:
27
manage.go
27
manage.go
@@ -25,13 +25,21 @@ func NewManage(cfg *ManageConfig, op ...client.Option) (*Manage, error) {
|
||||
cfg.Dial = DialDefault
|
||||
}
|
||||
|
||||
//代码
|
||||
codesClient, err := cfg.Dial(op...)
|
||||
//通用客户端
|
||||
commonClient, err := cfg.Dial(op...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
codesClient.Wait.SetTimeout(time.Second * 5)
|
||||
codes, err := NewCodes(codesClient, cfg.CodesFilename)
|
||||
commonClient.Wait.SetTimeout(time.Second * 5)
|
||||
|
||||
//代码管理
|
||||
codes, err := NewCodes(commonClient, cfg.CodesFilename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//工作日管理
|
||||
workday, err := NewWorkday(commonClient, cfg.WorkdayFileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,17 +52,6 @@ func NewManage(cfg *ManageConfig, op ...client.Option) (*Manage, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//工作日
|
||||
workdayClient, err := cfg.Dial(op...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
workdayClient.Wait.SetTimeout(time.Second * 5)
|
||||
workday, err := NewWorkday(workdayClient, cfg.WorkdayFileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Manage{
|
||||
Pool: p,
|
||||
Config: cfg,
|
||||
|
||||
Reference in New Issue
Block a user