176 lines
7.0 KiB
Go
176 lines
7.0 KiB
Go
package _type
|
|
|
|
import "time"
|
|
|
|
//配置结构体
|
|
|
|
// Config 配置结构
|
|
type Config struct {
|
|
Server Server `json:"server"`
|
|
Speed Speed `json:"speed"`
|
|
Minio Minio `json:"minio"`
|
|
Alive Alive `json:"alive"`
|
|
MysqlConfig MysqlConfig `json:"mysql_config"`
|
|
PsiMysqlConfig MysqlConfig `json:"psi_mysql_config"`
|
|
PoolConfig PoolConfig `json:"pool_config"`
|
|
RedisConfig []RedisConfig `json:"redis_config"`
|
|
PddConfig PddConfig `json:"pdd_config"`
|
|
KfzConfig KfzConfig `json:"kfz_config"`
|
|
TaobaoConfig TaobaoConfig `json:"taobao_config"`
|
|
AppBConfig AppBConfig `json:"app_b_config"`
|
|
HttpUrl HttpUrl `json:"http_url"`
|
|
FileUrl FileUrl `json:"file_url"`
|
|
}
|
|
|
|
// Server 服务器配置结构
|
|
type Server struct {
|
|
Port string `json:"port"`
|
|
FPort string `json:"f_port"`
|
|
Filter int `json:"filter"`
|
|
ReplaceMark string `json:"replace_mark"`
|
|
RedisExp int `json:"redis_exp"`
|
|
ReadDb string `json:"read_db"`
|
|
ErrPauseTime int `json:"err_pause_time"`
|
|
SignKey string `json:"sign_key"`
|
|
DataDay int `json:"data_day"`
|
|
IsC bool `json:"is_c"`
|
|
}
|
|
|
|
// Speed 限速器结构
|
|
type Speed struct {
|
|
PddSpeed int `json:"pdd_speed"`
|
|
XianyuSpeed int `json:"xianyu_speed"`
|
|
Watermark int `json:"watermark"`
|
|
}
|
|
|
|
// Minio 图片空间结构域
|
|
type Minio struct {
|
|
Url string `json:"url"`
|
|
AccessKeyID string `json:"access_key_id"`
|
|
SecretAccessKey string `json:"secret_access_key"`
|
|
BucketName string `json:"bucket_name"`
|
|
TargetDir string `json:"target_dir"`
|
|
UseSSL bool `json:"use_ssl"`
|
|
}
|
|
|
|
// Alive 存活状态结构
|
|
type Alive struct {
|
|
Fluent int `json:"fluent"`
|
|
Slow int `json:"slow"`
|
|
}
|
|
|
|
// MysqlConfig Mysql 配置结构
|
|
type MysqlConfig struct {
|
|
User string `json:"user"`
|
|
Password string `json:"password"`
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
DBName string `json:"db_name"`
|
|
Loglevel string `json:"loglevel"`
|
|
MaxRetryTimes int `json:"max_retry_times"`
|
|
BaseRetryInterval time.Duration `json:"base_retry_interval"`
|
|
MaxRetryInterval time.Duration `json:"max_retry_interval"`
|
|
MaxOpenConns int `json:"max_open_conns"`
|
|
MaxIdleConns int `json:"max_idle_conns"`
|
|
ConnMaxIdleTime time.Duration `json:"conn_max_idle_time"`
|
|
ConnMaxLifetime time.Duration `json:"conn_max_lifetime"`
|
|
}
|
|
|
|
// RedisConfig Redis 配置结构
|
|
type RedisConfig struct {
|
|
Addr string `json:"addr"`
|
|
Password string `json:"password"`
|
|
DB int `json:"db"`
|
|
PoolSize int `json:"pool_size"`
|
|
PoolTimeout int `json:"pool_timeout"`
|
|
ReadTimeout int `json:"read_timeout"`
|
|
WriteTimeout int `json:"write_timeout"`
|
|
DialTimeout int `json:"dial_timeout"`
|
|
IdleTimeout int `json:"idle_timeout"`
|
|
MinIdleConns int `json:"min_idle_conns"`
|
|
IdleCheckFrequency int `json:"idle_check_frequency"`
|
|
MaxRetries int `json:"max_retries"`
|
|
MaxRetryBackoff int `json:"max_retry_backoff"`
|
|
MinRetryBackoff int `json:"min_retry_backoff"`
|
|
}
|
|
|
|
// PoolConfig 协程池配置结构
|
|
type PoolConfig struct {
|
|
Size int `json:"size"` // 协程数
|
|
WithExpiryDuration int `json:"with_expiry_duration"` // 过期时间
|
|
WithPreAlloc bool `json:"with_pre_alloc"` // 预分配
|
|
WithMaxBlockingTasks int `json:"with_max_blocking_tasks"` // 最大阻塞任务数
|
|
WithNonblocking bool `json:"with_nonblocking"` // 非阻塞
|
|
}
|
|
|
|
// AppBConfig 应用配置结构
|
|
type AppBConfig struct {
|
|
AppName string `json:"app_name"` // 应用名称
|
|
AppDir string `json:"app_dir"` // 应用目录
|
|
}
|
|
|
|
// PddConfig 拼多多配置
|
|
type PddConfig struct {
|
|
ClientId string `json:"client_id"`
|
|
ClientSecret string `json:"client_secret"`
|
|
}
|
|
|
|
// KfzConfig 孔夫子配置
|
|
type KfzConfig struct {
|
|
AppId int `json:"app_id"`
|
|
AppSecret string `json:"app_secret"`
|
|
}
|
|
|
|
// TaobaoConfig 淘宝配置
|
|
type TaobaoConfig struct {
|
|
AppKey int `json:"app_key"` // 平台分配的 App Key
|
|
AppSecret string `json:"app_secret"` // App 密钥,用于 HMAC-MD5 签名计算
|
|
Ati string `json:"ati"` // 设备/用户标识
|
|
UserID string `json:"user_id"` // 当前操作用户 ID
|
|
CompanyID string `json:"company_id"` // 公司/店铺所属 ID
|
|
BaseURL string `json:"base_url"` // API 基础域名
|
|
LocalImgDir string `json:"local_img_dir"` // 图片本地缓存目录
|
|
RequestTimeout int `json:"request_timeout"` // 请求超时时间(秒)
|
|
Token string `json:"token"` //token
|
|
}
|
|
|
|
// HttpUrl 请求路径
|
|
type HttpUrl struct {
|
|
TaskUrl string `json:"task_url"`
|
|
}
|
|
|
|
type FileUrl struct {
|
|
PddDll string `json:"pdd_dll"`
|
|
KfzDll string `json:"kfz_dll"`
|
|
XianYuDll string `json:"xian_yu_dll"`
|
|
LogDll string `json:"log_dll"`
|
|
ImageDll string `json:"image_dll"`
|
|
BFileName string `json:"b_file_name"`
|
|
CFileName string `json:"c_file_name"`
|
|
DFileName string `json:"d_file_name"`
|
|
EFileName string `json:"e_file_name"`
|
|
FFileName string `json:"f_file_name"`
|
|
CreateTaskUrl string `json:"create_task_url"`
|
|
BannedWordSubstitutionUrl string `json:"banned_word_substitution_url"`
|
|
CreateTaskNoticeUrl string `json:"create_task_notice_url"`
|
|
CreateOperationTaskNoticeUrl string `json:"create_operation_task_notice_url"`
|
|
PddTokenUrl string `json:"pdd_token_url"`
|
|
DeductionUrl string `json:"deduction_url"`
|
|
PddGetGoodsUrl string `json:"pdd_get_goods_url"`
|
|
PddGetGoodsDetailUrl string `json:"pdd_get_goods_detail_url"`
|
|
PddAddGoodsUrl string `json:"pdd_add_goods_url"`
|
|
XianYuAddGoodsUrl string `json:"xianyu_add_goods_url"`
|
|
KfzAddGoodsUrl string `json:"kfz_add_goods_url"`
|
|
PddGetSkuId string `json:"pdd_get_sku_id"`
|
|
DelTaskUrl string `json:"del_task_url"`
|
|
BackupUrl string `json:"backup_url"`
|
|
PddGoodsDetailsUrl string `json:"pdd_goods_details_url"`
|
|
UpdateTokenUrl string `json:"update_token_url"`
|
|
KfzImgTempUrl string `json:"kfz_img_temp_url"`
|
|
KfzImgHttpUrl string `json:"kfz_img_http_url"`
|
|
GetPddGoodsShopIdIsbnUrl string `json:"get_pdd_goods_shopid_isbn_url"`
|
|
GetSubscriptionExpirationDateUrl string `json:"get_subscription_expiration_date_url"`
|
|
XYBannedWordSubstitutionUrl string `json:"xy_banned_word_substitution_url"`
|
|
PddImgTempUrl string `json:"pdd_img_temp_url"`
|
|
}
|