作者 yangfu

部门统计修改

... ... @@ -107,8 +107,9 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er
specialDIds = append(specialDIds, 0)
}
}
log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v", uid, check, user.Id == uid))
log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v ", uid, check, user.Id == uid))
for i := range items {
log.Debug("测试:", items[i].ChanceId, items[i].ChanceStatus)
if items[i].ChanceStatus != 0 {
continue
}
... ... @@ -135,9 +136,6 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er
}
switch check {
case OpportunityCheckLv1:
//if chanceUserId == uid {
// continue
//}
if _, e := models.ExitsChanceByAuditUser(chanceId, uid); e == nil {
continue
}
... ...
... ... @@ -77,6 +77,11 @@ func ComputeRankScore() (err error) {
for i := 0; i < RankGoroutineNum; i++ {
index := i
work := func() {
defer func() {
if p := recover(); p != nil {
log.Error(p)
}
}()
if err = computeRankScore(index, wg, RankGoroutineNum, periods); err != nil {
log.Error(err)
}
... ... @@ -428,7 +433,7 @@ func (rank RankComment) RankDepartment(o RankOption) (err error, result RankResu
var (
sql = `select count(0) total from comment where user_id in (%v) and UNIX_TIMESTAMP(create_at) >=%v and UNIX_TIMESTAMP(create_at)<%v
`
sqlUserDepartment = `select user_company_id from user_department where department_id=?`
sqlUserDepartment = `select user_company_id from user_department where department_id=? and enable_status=1`
total int
userIds []int
)
... ...
package rank
import (
"fmt"
"github.com/astaxie/beego/orm"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
"opp/models"
... ... @@ -11,10 +12,12 @@ import (
//排行榜
func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRequest) (rsp *protocol.GetRankListResponse, err error) {
var (
ranks []protocol.RankItem
selfRank *protocol.RankItem
rankRange *models.RankRange
itemKeys []string
ranks []protocol.RankItem
selfRank *protocol.RankItem
rankType *models.RankType
rankRange *models.RankRange
rankPeriod *models.RankPeriod
itemKeys []string
//itemNames []string
departments []*models.Department
departmentId int64
... ... @@ -29,6 +32,20 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
log.Error(err)
return
}
{
//测试日志
if rankType, err = models.GetRankTypeById(request.RankTypeId); err != nil {
log.Error(err)
return
}
if rankPeriod, err = models.GetRankPeriodById((request.RankPeriodId)); err != nil {
log.Error(err)
return
}
log.Debug(fmt.Sprintf("用户:%v 获取排行榜 :%v %v %v", header.UserId, rankType.Name, rankRange.Name, rankPeriod.SeasonName))
}
itemKeys = request.SortItemKeys
if len(itemKeys) == 0 {
if itemKeys, _, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows {
... ...