diff --git a/config.go b/config.go index c379b98..ed7fd41 100644 --- a/config.go +++ b/config.go @@ -99,18 +99,9 @@ func (proxies *YamlProxies) MarshalYAML() (interface{}, error) { return content, nil } -// Config 任务加载的默认配置 -type Config struct { - // Session int `yaml:"session"` - Mode int `yaml:"mode"` - Proxies *YamlProxies `yaml:"proxies"` - Retry int `yaml:"retry"` - Priority int `yaml:"priority"` - Curls YamlCurls `yaml:"curls"` - - Crontab string `yaml:"crontab"` - ITask string `yaml:"task"` - +// ADInfo ad 的一些属性,基础信息等 +type ADInfo struct { + Priority int `yaml:"priority"` Device string `yaml:"device"` Platform string `yaml:"platform"` AreaCC string `yaml:"area_cc"` @@ -120,22 +111,38 @@ type Config struct { CatchAccountID int `yaml:"catch_account_id"` } +// Config 任务加载的默认配置 +type Config struct { + // Session int `yaml:"session"` + Mode int `yaml:"mode"` + Proxies *YamlProxies `yaml:"proxies"` + Retry int `yaml:"retry"` + + Curls YamlCurls `yaml:"curls"` + + Crontab string `yaml:"crontab"` + ITask string `yaml:"task"` + + ADInfo `yaml:",inline"` +} + // newDefaultConfig create a default config func newDefaultConfig() *Config { conf := &Config{ // Session: 1, - Mode: 0, - Retry: 0, - Priority: 10000, - Crontab: "", + Mode: 0, + Retry: 0, + Crontab: "", - Device: "", - Platform: "", - AreaCC: "", - Channel: -1, - Media: -1, - SpiderID: -1, - CatchAccountID: -1, + ADInfo: ADInfo{ + Device: "", + Platform: "", + AreaCC: "", + Channel: -1, + Media: -1, + SpiderID: -1, + CatchAccountID: -1, + }, } return conf }