Documentation ¶
Index ¶
- Constants
- Variables
- func Init() (err error)
- type App
- type ArticleRuleConf
- type Config
- type CreditConf
- type CreditLog
- type CreditLogStateInfo
- type CreditScoreCalculateConfig
- type DB
- type HTTPClient
- type HTTPServers
- type Host
- type MC
- type MiscConfig
- type Monitor
- type Redis
- type RunStatJob
- type StateMachineState
- type Zookeeper
Constants ¶
View Source
const (
//ServiceName service name
ServiceName = "upcredit-service"
)
Variables ¶
View Source
var ( ConfPath string Conf = &Config{} CreditConfig = &CreditConf{} IsMaster = true )
Conf info.
Functions ¶
Types ¶
type ArticleRuleConf ¶
type ArticleRuleConf struct { AcceptOptypeData []int RejectOpTypeData []int // [score] ->[ optype list ] OptypeScoreData map[string][]int AcceptOptypeMap map[int]struct{} RejectOptypeMap map[int]struct{} // [optype] -> score OptypeScoreMap map[int]int InitState StateMachineState ArticleMaxOpenCount int }
ArticleRuleConf 稿件记分规则
func (*ArticleRuleConf) GetScore ¶
func (a *ArticleRuleConf) GetScore(typ int, opType int, reason int) (score int)
GetScore get score by type, opType, reason
func (*ArticleRuleConf) IsAccepted ¶
func (a *ArticleRuleConf) IsAccepted(typ int, opType int, reason int) (res bool)
IsAccepted is article accepted
func (*ArticleRuleConf) IsRejected ¶
func (a *ArticleRuleConf) IsRejected(typ int, opType int, reason int) (res bool)
IsRejected is article reject
type Config ¶
type Config struct { // bm BM *HTTPServers // db DB *DB // base // elk Xlog *log.Config // report log LogCli *log.AgentConfig // httpClinet HTTPClient *HTTPClient // tracer Tracer *trace.Config // Redis Redis *Redis // rpc server RPCServer *rpc.ServerConfig // auth Auth *permit.Config IsTest bool CreditLogSub *databus.Config BusinessBinLogSub *databus.Config RunStatJobConf *RunStatJob MiscConf *MiscConfig ElectionZooKeeper *Zookeeper }
Config struct.
type CreditConf ¶
type CreditConf struct { CalculateConf *CreditScoreCalculateConfig ArticleRule *ArticleRuleConf }
CreditConf 信用分数配置
type CreditLog ¶
type CreditLog struct {
NeedLogState map[int]CreditLogStateInfo
}
CreditLog 需要记录日志的那些稿件状态,在配置文件中配置。只有这些状态,才会记录信用日志
type CreditScoreCalculateConfig ¶
type CreditScoreCalculateConfig struct { // 时间衰减因子 // [离今年的差值] = 权重值 TimeWeight map[string]int TimeWeight2 map[int]int }
CreditScoreCalculateConfig 分数计算配置
func (*CreditScoreCalculateConfig) AfterLoad ¶
func (c *CreditScoreCalculateConfig) AfterLoad()
AfterLoad after load
type HTTPClient ¶
type HTTPClient struct { Normal *bm.ClientConfig Slow *bm.ClientConfig }
HTTPClient conf.
type HTTPServers ¶
type HTTPServers struct {
Inner *blademaster.ServerConfig
}
HTTPServers for http server.
type MiscConfig ¶
type MiscConfig struct { CreditLogWriteRoutineNum int BusinessBinLogLimitRate float64 // 每秒多少个,business bin log 消费速度 }
MiscConfig other config set
type Monitor ¶
type Monitor struct { Host string Moni string UserName string AppSecret string AppToken string IntervalAlarm time.Duration }
Monitor conf.
type RunStatJob ¶
RunStatJob 定时任务时间
type StateMachineState ¶
StateMachineState 状态机数据
Click to show internal directories.
Click to hide internal directories.