public_org.py
919 Bytes
from atdd.PcPost import PcPost
class PulbicOrg(PcPost):
def get_top_org(self):
url = "/Contact/Apicp/Department/List"
data = {
"_identifier": 'contact',
"limit": 99999
}
result = self.PcPost(url,data)
top_dpId = result['result']['list'][0]['dpId']
return top_dpId
# 查找所有部门的dpId,包括顶级部门,以list格式返回
def get_all_dpId(self):
url = "/Contact/Apicp/Department/ListChildren"
data = {
"dpParentId":self.get_top_org()
}
result = self.PcPost(url,data)
orglist = result['result']['list'] # 组织列表的list信息
dpIdList = []
for i in range(len(orglist)):
dpId = orglist[i]['dpId'].split()
# 将dpId加入到dpIdList中
dpIdList[len(dpIdList):len(dpIdList)] = dpId
return dpIdList