mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-05 03:21:30 +08:00
优化功能,通知功能,任务功能
This commit is contained in:
@@ -3,6 +3,7 @@ package utils
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/kakuilan/kgo"
|
||||
"log"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
@@ -68,3 +69,29 @@ func IdsStrToIdsIntGroup(keys string) []int64 {
|
||||
}
|
||||
return IDS
|
||||
}
|
||||
|
||||
// 获取部门
|
||||
// isP 是父ID 否则子ID
|
||||
func DeptPCIds(deptIds []string, id int64, isP bool) []int64 {
|
||||
pRes := make([]int64, 0)
|
||||
cRes := make([]int64, 0)
|
||||
is := true
|
||||
for _, deptId := range deptIds {
|
||||
did := kgo.KConv.Str2Int64(deptId)
|
||||
log.Println(did)
|
||||
if is {
|
||||
pRes = append(pRes, did)
|
||||
}
|
||||
if kgo.KConv.Str2Int64(deptId) == id {
|
||||
is = false
|
||||
}
|
||||
if !is {
|
||||
cRes = append(cRes, did)
|
||||
}
|
||||
}
|
||||
if isP {
|
||||
return pRes
|
||||
} else {
|
||||
return cRes
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user