Documentation
¶
Index ¶
- Variables
- func AddScore(k string, v int64)
- func AddScoreAfter(k string, fc func(call *WorkCall))
- func AddScoreValid(k string, fc func(call *WorkCall) bool)
- func GenCommentRedisKey(mid string) string
- func GenLikeRedisKey(mid string) string
- type HotCallBase
- type Pair
- type PairList
- type WorkCall
- func (c *WorkCall) AddHotChange(ctx context.Context, eventName, fromUserId, toUserId, cityCode, ip string)
- func (c *WorkCall) ChangeLike(ctx context.Context, mid string, userId string, add bool) error
- func (c *WorkCall) GetAggregationRank(ctx context.Context) (today float64, city float64, all float64)
- func (c *WorkCall) GetAllRandomData(ctx context.Context, count int64) ([]string, error)
- func (c *WorkCall) GetAllRank(ctx context.Context) float64
- func (c *WorkCall) GetAllTopRank(ctx context.Context, max int64) ([]string, error)
- func (c *WorkCall) GetCityCountDistribute(ctx context.Context, cityCode string) map[string]int64
- func (c *WorkCall) GetCityRandomData(ctx context.Context, count int64, cityCode string) ([]string, error)
- func (c *WorkCall) GetCityRank(ctx context.Context) float64
- func (c *WorkCall) GetCityRankOfRange(ctx context.Context, Range hotRange) int64
- func (c *WorkCall) GetCommentCount(ctx context.Context, mid string) uint64
- func (c *WorkCall) GetCountDistribute(ctx context.Context) map[string]int64
- func (c *WorkCall) GetCountOfRangeInAll(ctx context.Context, Range []hotRange) int64
- func (c *WorkCall) GetCountOfRangeInCity(ctx context.Context, cityCode string, Range []hotRange) int64
- func (c *WorkCall) GetCountOfTimeRange(ctx context.Context, timer []time.Time) int64
- func (c *WorkCall) GetDayTopRank(ctx context.Context, t time.Time, max int64) ([]string, error)
- func (c *WorkCall) GetRankOfRange(ctx context.Context, Range hotRange) int64
- func (c *WorkCall) GetTimeRandomData(ctx context.Context, count int64, t time.Time) ([]string, error)
- func (c *WorkCall) GetTimeRank(ctx context.Context, t time.Time) int64
- func (c *WorkCall) GetTimeScore(ctx context.Context, t time.Time) float64
- func (c *WorkCall) GetTodayTopRank(ctx context.Context, max int64) ([]string, error)
- func (c *WorkCall) HasLike(ctx context.Context, mid string, userId string) bool
- func (c *WorkCall) RunCommentRedisChange(ctx context.Context, mid string, add bool, count int64) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddScoreAfter ¶
AddScoreAfter 新增评分增加成功过后回调
func AddScoreValid ¶
AddScoreValid 新增事件验证
Types ¶
type HotCallBase ¶
type HotCallBase struct { EventName string // 事件名 EventPrice int64 // 操作事件的价格 对应加分数 FromUserId string // 操作者 新增做功 ToUserId string // 接收者 接收做功 Rdb *redis.Client }
HotCallBase 热度计算单条信息基础
type PairList ¶
type PairList []Pair
A slice of Pairs that implements sort.Interface to sort by Value.
type WorkCall ¶
type WorkCall struct { HotCallBase // contains filtered or unexported fields }
WorkCall 作品计算
func (*WorkCall) AddHotChange ¶
func (c *WorkCall) AddHotChange(ctx context.Context, eventName, fromUserId, toUserId, cityCode, ip string)
AddHotChange 新增作品热度变化 分享 评论必传toUserId 匿名者访问 必传ip
func (*WorkCall) ChangeLike ¶
ChangeLike 点赞变更 考虑是否变更为bitmap方式
func (*WorkCall) GetAggregationRank ¶
func (c *WorkCall) GetAggregationRank(ctx context.Context) (today float64, city float64, all float64)
GetAggregationRank 聚合排名 所有排名 0是最高
func (*WorkCall) GetAllRandomData ¶
GetAllRandomData 总排行榜获取指定数量随机内容
func (*WorkCall) GetAllRank ¶
GetAllRank 获取作品的总排名
func (*WorkCall) GetAllTopRank ¶
GetAllTopRank 获取总榜的top k
func (*WorkCall) GetCityCountDistribute ¶
GetCityCountDistribute 获取某个城市区间数量分布情况
func (*WorkCall) GetCityRandomData ¶
func (c *WorkCall) GetCityRandomData(ctx context.Context, count int64, cityCode string) ([]string, error)
GetCityRandomData 获取指定数量的随机城市排行榜数据
func (*WorkCall) GetCityRank ¶
GetCityRank 获取自己的城市总排名
func (*WorkCall) GetCityRankOfRange ¶
GetCityRankOfRange 获取作品在城市某个区间的排名
func (*WorkCall) GetCommentCount ¶
GetCommentCount 获取评论计数
func (*WorkCall) GetCountDistribute ¶
GetCountDistribute 获取总区间数量分布情况
func (*WorkCall) GetCountOfRangeInAll ¶
GetCountOfRangeInAll 获取某个区间的总排行榜数量
func (*WorkCall) GetCountOfRangeInCity ¶
func (c *WorkCall) GetCountOfRangeInCity(ctx context.Context, cityCode string, Range []hotRange) int64
GetCountOfRangeInCity 获取某个区间的城市排行榜数量
func (*WorkCall) GetCountOfTimeRange ¶
GetCountOfTimeRange 获取某个时间段排行榜数量
func (*WorkCall) GetDayTopRank ¶
GetDayTopRank 获取指定天数的top k
func (*WorkCall) GetRankOfRange ¶
GetRankOfRange 获取作品在某个区间的排名
func (*WorkCall) GetTimeRandomData ¶
func (c *WorkCall) GetTimeRandomData(ctx context.Context, count int64, t time.Time) ([]string, error)
GetTimeRandomData 获取某个时间随机内容
func (*WorkCall) GetTimeRank ¶
GetTimeRank 获取作品某日排名
func (*WorkCall) GetTimeScore ¶
GetTimeScore 获取作品某日分数
func (*WorkCall) GetTodayTopRank ¶
GetTodayTopRank 获取今日top k