|
@@ -9,6 +9,7 @@ import (
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
IC "jyBXSubscribe/rpc/init"
|
|
|
"jyBXSubscribe/rpc/type/bxsubscribe"
|
|
|
+ "log"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
@@ -59,6 +60,7 @@ func (p *PersonSubscribe) IsEmpty() bool {
|
|
|
// eStatus 是否有企业订阅 -1 无企业订阅 1 有企业订阅
|
|
|
// pStatus 是否有个人订阅 -1 无个人订阅 1 有个人订阅
|
|
|
func GetStaffSubscribeList(entId, entUserId int, query string, eStatus, pStatus, pageNum, pageSize int64) (total int64, list []*bxsubscribe.StaffSubscribe) {
|
|
|
+ log.Println("222222222222222", entId, entUserId, query, eStatus, pStatus, pageNum, pageSize)
|
|
|
userEnt := EntInfo(entId, entUserId)
|
|
|
// 非管理员无权限查询
|
|
|
if !(userEnt.Role_admin_system || userEnt.Role_admin_department) {
|
|
@@ -67,7 +69,7 @@ func GetStaffSubscribeList(entId, entUserId int, query string, eStatus, pStatus,
|
|
|
// 当检索是否有个人订阅时,因为无法关联查询,需要提前加载员工是否有个人订阅
|
|
|
pSubscribeList := getEntPersonOrderList(entId)
|
|
|
// 加载当前企业所有企业分发数据
|
|
|
- ruleIds := getEntSubscirbeList(entId, userEnt.Dept.Id, userEnt.Role_admin_system)
|
|
|
+ ruleIds := getEntSubscirbeList(entId, userEnt.Dept.Id, (userEnt.Role_admin_system || userEnt.Role_admin_department))
|
|
|
|
|
|
allRule := ""
|
|
|
if len(ruleIds) > 0 {
|
|
@@ -173,9 +175,11 @@ WHERE`
|
|
|
|
|
|
countSql := fmt.Sprintf("SELECT count(id) %s %s", sql, strings.Join(queryArr, " AND "))
|
|
|
total = IC.MainMysql.CountBySql(countSql, valueArr...)
|
|
|
+ fmt.Println(countSql, valueArr)
|
|
|
if total > 0 {
|
|
|
finalSql := fmt.Sprintf("SELECT * %s %s ORDER BY createtime DESC LIMIT %d,%d", sql, strings.Join(queryArr, " AND "), common.If(pageNum >= 0, pageNum, 0).(int64)*pageSize, pageSize)
|
|
|
finalRes := IC.MainMysql.SelectBySql(finalSql, valueArr...)
|
|
|
+ fmt.Println(countSql, valueArr)
|
|
|
if finalRes != nil && len(*finalRes) > 0 {
|
|
|
for _, m := range *finalRes {
|
|
|
eUser := common.Int64All(m["id"])
|