作者 yangfu

互动消息 机会补充

@@ -252,7 +252,7 @@ select id msg_id,message content,source_type,source_id,is_read,create_at msg_tim @@ -252,7 +252,7 @@ select id msg_id,message content,source_type,source_id,is_read,create_at msg_tim
252 where receive_user_id =? and (?=0 or id<?) and msg_type=? 252 where receive_user_id =? and (?=0 or id<?) and msg_type=?
253 )a left outer join chance b on a.chance_id = b.id 253 )a left outer join chance b on a.chance_id = b.id
254 )a left outer join chance_data b on a.chance_id = b.chance_id 254 )a left outer join chance_data b on a.chance_id = b.chance_id
255 -order by id desc 255 +order by msg_id desc
256 LIMIT ?` 256 LIMIT ?`
257 257
258 sqlCount := `select count(0) 258 sqlCount := `select count(0)
1 package protocol 1 package protocol
2 2
  3 +const (
  4 + RankRangeTypeAllCompanyUser = 1
  5 + RankRangeTypeSpecifyUser = 2
  6 + RankRangeTypeAllCompanyDepartment = 3
  7 + RankRangeTypeAllSpecifyDepartment = 4
  8 +)
  9 +
3 /*GetRankList 排行榜*/ 10 /*GetRankList 排行榜*/
4 type GetRankListRequest struct { 11 type GetRankListRequest struct {
5 RankTypeId int `json:"rankTypeId" valid:"Required"` //榜单类型编号(赛季榜、年榜) 12 RankTypeId int `json:"rankTypeId" valid:"Required"` //榜单类型编号(赛季榜、年榜)
@@ -11,13 +11,20 @@ import ( @@ -11,13 +11,20 @@ import (
11 var ComputeRankScoreFlag int32 11 var ComputeRankScoreFlag int32
12 12
13 type Rank interface { 13 type Rank interface {
14 - RankUser(o RankOption) error  
15 - RankDepartment(o RankOption) error 14 + RankUser(o RankOption) (error, RankResult)
  15 + RankDepartment(o RankOption) (error, RankResult)
16 } 16 }
17 17
18 type RankOption struct { 18 type RankOption struct {
  19 + Type int //RankRangeType
  20 + ObjectId int64 //对象id 用户编号 /部门编号
19 BeginTime time.Time 21 BeginTime time.Time
20 EndTime time.Time 22 EndTime time.Time
  23 + //*model.user_rank
  24 +}
  25 +
  26 +type RankResult struct {
  27 + //Params map[string]interface{}
21 } 28 }
22 29
23 //计算排行分 30 //计算排行分
@@ -40,5 +47,20 @@ func ComputeRankScore() error { @@ -40,5 +47,20 @@ func ComputeRankScore() error {
40 } 47 }
41 48
42 func computeRankScore() error { 49 func computeRankScore() error {
  50 + var (
  51 + //rankList []Rank = initRankList()
  52 + )
  53 + //1.从rank_period 查询进行中的赛季
  54 + //2.查询对应 rank_type_id 的rank_data
  55 + //按类型
  56 + //3.查询用户列表/部门列表
  57 + //4.调用统计接口列表
  58 + //5.汇聚所有的rankResult
  59 + //6.查询当前user_rank是否有这条记录,比较记录里面数据是否有变化
  60 + //7.更新到表/插入
43 return nil 61 return nil
44 } 62 }
  63 +
  64 +func initRankList() []Rank {
  65 + return []Rank{}
  66 +}