...
|
...
|
@@ -14,18 +14,28 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, |
|
|
checkMap map[int]int
|
|
|
specialDIds []int64
|
|
|
userDIds []int64
|
|
|
company *models.Company
|
|
|
)
|
|
|
if op, e := GetUserPermission(uid); e == nil {
|
|
|
for i := range op.CheckOption.Departments {
|
|
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
|
}
|
|
|
check = op.Check
|
|
|
checkMap = op.CheckMap
|
|
|
if company, err = models.GetCompanyById(cid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if len(specialDIds) == 0 {
|
|
|
specialDIds = append(specialDIds, 0)
|
|
|
//公司管理员有所有权限
|
|
|
if company.AdminId == uid {
|
|
|
check = 4
|
|
|
} else {
|
|
|
if op, e := GetUserPermission(uid); e == nil {
|
|
|
for i := range op.CheckOption.Departments {
|
|
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
|
}
|
|
|
check = op.Check
|
|
|
checkMap = op.CheckMap
|
|
|
}
|
|
|
if len(specialDIds) == 0 {
|
|
|
specialDIds = append(specialDIds, 0)
|
|
|
}
|
|
|
}
|
|
|
log.Debug(fmt.Sprintf("user:%v check:%v", uid, check))
|
|
|
log.Debug(fmt.Sprintf("user:%v check:%v is_amdin:%v", uid, check, company.AdminId == uid))
|
|
|
switch check {
|
|
|
case OpportunityCheckLv1:
|
|
|
return models.GetChancePoolMyself(uid, cid, chanceTypeId, lastId, pageSize, v)
|
...
|
...
|
@@ -59,21 +69,31 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er |
|
|
checkMap map[int]int
|
|
|
specialDIds []int64
|
|
|
userDIds []int64
|
|
|
company *models.Company
|
|
|
)
|
|
|
if op, e := GetUserPermission(uid); e == nil {
|
|
|
for i := range op.CheckOption.Departments {
|
|
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
|
}
|
|
|
checkMap = op.CheckMap
|
|
|
check = op.Check
|
|
|
} else {
|
|
|
if company, err = models.GetCompanyById(cid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if len(specialDIds) == 0 {
|
|
|
specialDIds = append(specialDIds, 0)
|
|
|
//公司管理员有所有权限
|
|
|
if company.AdminId == uid {
|
|
|
check = 4
|
|
|
} else {
|
|
|
if op, e := GetUserPermission(uid); e == nil {
|
|
|
for i := range op.CheckOption.Departments {
|
|
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
|
}
|
|
|
checkMap = op.CheckMap
|
|
|
check = op.Check
|
|
|
} else {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if len(specialDIds) == 0 {
|
|
|
specialDIds = append(specialDIds, 0)
|
|
|
}
|
|
|
}
|
|
|
log.Debug(fmt.Sprintf("user:%v check:%v", uid, check))
|
|
|
log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v", uid, check, company.AdminId == uid))
|
|
|
for i := range items {
|
|
|
if items[i].ChanceStatus != 0 {
|
|
|
continue
|
...
|
...
|
|