Documentation ¶
Index ¶
Constants ¶
View Source
const ( //ScoreRange score range, max - min ScoreRange = float32(2000) //MaxScore max score MaxScore = float32(1000) //WeightRelative relative weight WeightRelative = float32(0.5) )
View Source
const ( //Day day Day = time.Hour * 24 / time.Second //Month month Month = 30 * Day //Year year Year = 365 * Day )
View Source
const ( //StateOpen open StateOpen = "st_open" //StateClose close StateClose = "st_close" //EventOpen ev open EventOpen = "open" //EventClose ev close EventClose = "close" )
Variables ¶
View Source
var ( //RuleList rule list RuleList = []Rule{rule1} )
Functions ¶
This section is empty.
Types ¶
type ArticleStateMachine ¶
type ArticleStateMachine struct { State int Round int Reason int Fsm *fsm.FSM // contains filtered or unexported fields }
ArticleStateMachine state machine
func CreateArticleStateMachine ¶
func CreateArticleStateMachine(state int, round int, reason int) (asm *ArticleStateMachine)
CreateArticleStateMachine 这里的state, round, reason是稿件的state, round, reason
func CreateArticleStateMachineWithInitState ¶
func CreateArticleStateMachineWithInitState() (asm *ArticleStateMachine)
CreateArticleStateMachineWithInitState create init machine
func (*ArticleStateMachine) OnLog ¶
func (a *ArticleStateMachine) OnLog(l *upcrmmodel.SimpleCreditLog, callback OnLogResult)
OnLog -----------------state machine
type CreditScoreCalculator ¶
type CreditScoreCalculator struct {
CreditScoreOutputChan chan<- *upcrmmodel.UpScoreHistory
}
CreditScoreCalculator score calculator
func (*CreditScoreCalculator) CalcLogTable ¶
func (c *CreditScoreCalculator) CalcLogTable(tableNum int, currentDate time.Time, overall *OverAllStatistic) (err error)
CalcLogTable calculate all table
type OnLogResult ¶
type OnLogResult func(e *fsm.Event, l *upcrmmodel.SimpleCreditLog, a *ArticleStateMachine)
OnLogResult on log function
type OverAllStatistic ¶
type OverAllStatistic struct { MaxScore int SectionCount int // 分数段人数统计, map[分数段:0~9]int人数 ScoreSection map[int]int // contains filtered or unexported fields }
OverAllStatistic score statistics
func NewOverAllStatistic ¶
func NewOverAllStatistic(maxScore int, sectionCount int) *OverAllStatistic
NewOverAllStatistic create empty
func (*OverAllStatistic) AddScore ¶
func (s *OverAllStatistic) AddScore(score int, exceptScore int)
AddScore add score params: score, 分数 exceptScore,不统计的分数,主要是默认分数,不进行统计
func (*OverAllStatistic) GetScore ¶
func (s *OverAllStatistic) GetScore(section int) int
GetScore no record will return default int(0)
type Rule ¶
type Rule func(log upcrmmodel.SimpleCreditLog, stat *creditStat, args ...interface{})
Rule rule function
Click to show internal directories.
Click to hide internal directories.