正在显示
3 个修改的文件
包含
29 行增加
和
9 行删除
| @@ -107,8 +107,9 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er | @@ -107,8 +107,9 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er | ||
| 107 | specialDIds = append(specialDIds, 0) | 107 | specialDIds = append(specialDIds, 0) |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | - log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v", uid, check, user.Id == uid)) | 110 | + log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v ", uid, check, user.Id == uid)) |
| 111 | for i := range items { | 111 | for i := range items { |
| 112 | + log.Debug("测试:", items[i].ChanceId, items[i].ChanceStatus) | ||
| 112 | if items[i].ChanceStatus != 0 { | 113 | if items[i].ChanceStatus != 0 { |
| 113 | continue | 114 | continue |
| 114 | } | 115 | } |
| @@ -135,9 +136,6 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er | @@ -135,9 +136,6 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er | ||
| 135 | } | 136 | } |
| 136 | switch check { | 137 | switch check { |
| 137 | case OpportunityCheckLv1: | 138 | case OpportunityCheckLv1: |
| 138 | - //if chanceUserId == uid { | ||
| 139 | - // continue | ||
| 140 | - //} | ||
| 141 | if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil { | 139 | if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil { |
| 142 | continue | 140 | continue |
| 143 | } | 141 | } |
| @@ -77,6 +77,11 @@ func ComputeRankScore() (err error) { | @@ -77,6 +77,11 @@ func ComputeRankScore() (err error) { | ||
| 77 | for i := 0; i < RankGoroutineNum; i++ { | 77 | for i := 0; i < RankGoroutineNum; i++ { |
| 78 | index := i | 78 | index := i |
| 79 | work := func() { | 79 | work := func() { |
| 80 | + defer func() { | ||
| 81 | + if p := recover(); p != nil { | ||
| 82 | + log.Error(p) | ||
| 83 | + } | ||
| 84 | + }() | ||
| 80 | if err = computeRankScore(index, wg, RankGoroutineNum, periods); err != nil { | 85 | if err = computeRankScore(index, wg, RankGoroutineNum, periods); err != nil { |
| 81 | log.Error(err) | 86 | log.Error(err) |
| 82 | } | 87 | } |
| @@ -428,7 +433,7 @@ func (rank RankComment) RankDepartment(o RankOption) (err error, result RankResu | @@ -428,7 +433,7 @@ func (rank RankComment) RankDepartment(o RankOption) (err error, result RankResu | ||
| 428 | var ( | 433 | var ( |
| 429 | sql = `select count(0) total from comment where user_id in (%v) and UNIX_TIMESTAMP(create_at) >=%v and UNIX_TIMESTAMP(create_at)<%v | 434 | sql = `select count(0) total from comment where user_id in (%v) and UNIX_TIMESTAMP(create_at) >=%v and UNIX_TIMESTAMP(create_at)<%v |
| 430 | ` | 435 | ` |
| 431 | - sqlUserDepartment = `select user_company_id from user_department where department_id=?` | 436 | + sqlUserDepartment = `select user_company_id from user_department where department_id=? and enable_status=1` |
| 432 | total int | 437 | total int |
| 433 | userIds []int | 438 | userIds []int |
| 434 | ) | 439 | ) |
| 1 | package rank | 1 | package rank |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "fmt" | ||
| 4 | "github.com/astaxie/beego/orm" | 5 | "github.com/astaxie/beego/orm" |
| 5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 6 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
| 6 | "opp/models" | 7 | "opp/models" |
| @@ -11,10 +12,12 @@ import ( | @@ -11,10 +12,12 @@ import ( | ||
| 11 | //排行榜 | 12 | //排行榜 |
| 12 | func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRequest) (rsp *protocol.GetRankListResponse, err error) { | 13 | func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRequest) (rsp *protocol.GetRankListResponse, err error) { |
| 13 | var ( | 14 | var ( |
| 14 | - ranks []protocol.RankItem | ||
| 15 | - selfRank *protocol.RankItem | ||
| 16 | - rankRange *models.RankRange | ||
| 17 | - itemKeys []string | 15 | + ranks []protocol.RankItem |
| 16 | + selfRank *protocol.RankItem | ||
| 17 | + rankType *models.RankType | ||
| 18 | + rankRange *models.RankRange | ||
| 19 | + rankPeriod *models.RankPeriod | ||
| 20 | + itemKeys []string | ||
| 18 | //itemNames []string | 21 | //itemNames []string |
| 19 | departments []*models.Department | 22 | departments []*models.Department |
| 20 | departmentId int64 | 23 | departmentId int64 |
| @@ -29,6 +32,20 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe | @@ -29,6 +32,20 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe | ||
| 29 | log.Error(err) | 32 | log.Error(err) |
| 30 | return | 33 | return |
| 31 | } | 34 | } |
| 35 | + | ||
| 36 | + { | ||
| 37 | + //测试日志 | ||
| 38 | + if rankType, err = models.GetRankTypeById(request.RankTypeId); err != nil { | ||
| 39 | + log.Error(err) | ||
| 40 | + return | ||
| 41 | + } | ||
| 42 | + if rankPeriod, err = models.GetRankPeriodById((request.RankPeriodId)); err != nil { | ||
| 43 | + log.Error(err) | ||
| 44 | + return | ||
| 45 | + } | ||
| 46 | + log.Debug(fmt.Sprintf("用户:%v 获取排行榜 :%v %v %v", header.UserId, rankType.Name, rankRange.Name, rankPeriod.SeasonName)) | ||
| 47 | + } | ||
| 48 | + | ||
| 32 | itemKeys = request.SortItemKeys | 49 | itemKeys = request.SortItemKeys |
| 33 | if len(itemKeys) == 0 { | 50 | if len(itemKeys) == 0 { |
| 34 | if itemKeys, _, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows { | 51 | if itemKeys, _, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows { |
-
请 注册 或 登录 后发表评论