|
@@ -14,7 +14,16 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, |
|
@@ -14,7 +14,16 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, |
|
14
|
checkMap map[int]int
|
14
|
checkMap map[int]int
|
|
15
|
specialDIds []int64
|
15
|
specialDIds []int64
|
|
16
|
userDIds []int64
|
16
|
userDIds []int64
|
|
|
|
17
|
+ company *models.Company
|
|
17
|
)
|
18
|
)
|
|
|
|
19
|
+ if company, err = models.GetCompanyById(cid); err != nil {
|
|
|
|
20
|
+ log.Error(err)
|
|
|
|
21
|
+ return
|
|
|
|
22
|
+ }
|
|
|
|
23
|
+ //公司管理员有所有权限
|
|
|
|
24
|
+ if company.AdminId == uid {
|
|
|
|
25
|
+ check = 4
|
|
|
|
26
|
+ } else {
|
|
18
|
if op, e := GetUserPermission(uid); e == nil {
|
27
|
if op, e := GetUserPermission(uid); e == nil {
|
|
19
|
for i := range op.CheckOption.Departments {
|
28
|
for i := range op.CheckOption.Departments {
|
|
20
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
29
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
@@ -25,7 +34,8 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, |
|
@@ -25,7 +34,8 @@ func GetChancePool(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, |
|
25
|
if len(specialDIds) == 0 {
|
34
|
if len(specialDIds) == 0 {
|
|
26
|
specialDIds = append(specialDIds, 0)
|
35
|
specialDIds = append(specialDIds, 0)
|
|
27
|
}
|
36
|
}
|
|
28
|
- log.Debug(fmt.Sprintf("user:%v check:%v", uid, check))
|
37
|
+ }
|
|
|
|
38
|
+ log.Debug(fmt.Sprintf("user:%v check:%v is_amdin:%v", uid, check, company.AdminId == uid))
|
|
29
|
switch check {
|
39
|
switch check {
|
|
30
|
case OpportunityCheckLv1:
|
40
|
case OpportunityCheckLv1:
|
|
31
|
return models.GetChancePoolMyself(uid, cid, chanceTypeId, lastId, pageSize, v)
|
41
|
return models.GetChancePoolMyself(uid, cid, chanceTypeId, lastId, pageSize, v)
|
|
@@ -59,7 +69,16 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er |
|
@@ -59,7 +69,16 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er |
|
59
|
checkMap map[int]int
|
69
|
checkMap map[int]int
|
|
60
|
specialDIds []int64
|
70
|
specialDIds []int64
|
|
61
|
userDIds []int64
|
71
|
userDIds []int64
|
|
|
|
72
|
+ company *models.Company
|
|
62
|
)
|
73
|
)
|
|
|
|
74
|
+ if company, err = models.GetCompanyById(cid); err != nil {
|
|
|
|
75
|
+ log.Error(err)
|
|
|
|
76
|
+ return
|
|
|
|
77
|
+ }
|
|
|
|
78
|
+ //公司管理员有所有权限
|
|
|
|
79
|
+ if company.AdminId == uid {
|
|
|
|
80
|
+ check = 4
|
|
|
|
81
|
+ } else {
|
|
63
|
if op, e := GetUserPermission(uid); e == nil {
|
82
|
if op, e := GetUserPermission(uid); e == nil {
|
|
64
|
for i := range op.CheckOption.Departments {
|
83
|
for i := range op.CheckOption.Departments {
|
|
65
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
84
|
specialDIds = append(specialDIds, op.CheckOption.Departments[i].Id)
|
|
@@ -73,7 +92,8 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er |
|
@@ -73,7 +92,8 @@ func ValidChancePermission(uid, cid int64, items []*protocol.CommonListItem) (er |
|
73
|
if len(specialDIds) == 0 {
|
92
|
if len(specialDIds) == 0 {
|
|
74
|
specialDIds = append(specialDIds, 0)
|
93
|
specialDIds = append(specialDIds, 0)
|
|
75
|
}
|
94
|
}
|
|
76
|
- log.Debug(fmt.Sprintf("user:%v check:%v", uid, check))
|
95
|
+ }
|
|
|
|
96
|
+ log.Debug(fmt.Sprintf("user:%v check:%v is_admin:%v", uid, check, company.AdminId == uid))
|
|
77
|
for i := range items {
|
97
|
for i := range items {
|
|
78
|
if items[i].ChanceStatus != 0 {
|
98
|
if items[i].ChanceStatus != 0 {
|
|
79
|
continue
|
99
|
continue
|