mirror of https://github.com/rocboss/paopao-ce
parent
97edac97a9
commit
05f3f3b77f
@ -1,41 +1,41 @@
|
|||||||
// Copyright 2023 ROC. All rights reserved.
|
// Copyright 2022 ROC. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT style
|
// Use of this source code is governed by a MIT style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package cs
|
package cs
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MetricActionCreateTweet uint8 = iota
|
MetricActionCreateTweet = iota + 1
|
||||||
MetricActionDeleteTweet
|
MetricActionDeleteTweet
|
||||||
)
|
)
|
||||||
|
|
||||||
type TweetMetric struct {
|
type TweetMetric struct {
|
||||||
PostId int64
|
PostId int64
|
||||||
CommentCount int64
|
IncentiveScore int
|
||||||
UpvoteCount int64
|
DecayFactor int
|
||||||
CollectionCount int64
|
}
|
||||||
ShareCount int64
|
|
||||||
ThumbsUpCount int64
|
func (m *TweetMetric) RankScore(motivationFactor int) int64 {
|
||||||
ThumbsDownCount int64
|
return int64(m.IncentiveScore * motivationFactor / m.DecayFactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommentMetric struct {
|
type CommentMetric struct {
|
||||||
CommentId int64
|
CommentId int64
|
||||||
|
IncentiveScore int
|
||||||
|
DecayFactor int
|
||||||
ReplyCount int32
|
ReplyCount int32
|
||||||
ThumbsUpCount int32
|
ThumbsUpCount int32
|
||||||
ThumbsDownCount int32
|
ThumbsDownCount int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *TweetMetric) RankScore(motivationFactor int) int64 {
|
|
||||||
if motivationFactor == 0 {
|
|
||||||
motivationFactor = 1
|
|
||||||
}
|
|
||||||
return (m.CommentCount + m.UpvoteCount*2 + m.CollectionCount*4 + m.ShareCount*8) * int64(motivationFactor)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *CommentMetric) RankScore(motivationFactor int) int64 {
|
func (m *CommentMetric) RankScore(motivationFactor int) int64 {
|
||||||
if motivationFactor == 0 {
|
return int64(m.IncentiveScore * motivationFactor / m.DecayFactor)
|
||||||
motivationFactor = 1
|
|
||||||
}
|
}
|
||||||
return int64(m.ReplyCount*2+m.ThumbsUpCount*4-m.ThumbsDownCount) * int64(motivationFactor)
|
|
||||||
|
// UserMetric 用户指标结构体
|
||||||
|
type UserMetric struct {
|
||||||
|
UserId int64
|
||||||
|
TweetsCount int
|
||||||
|
LatestTrendsOn int64
|
||||||
|
Experience int
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue