From c7545f239538537185efbf31ea858a064055caf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Thu, 8 Sep 2022 11:26:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E9=92=89=E9=92=89=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?depid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crud/crud_user.py | 2 +- utils/dingding.py | 10 +++++++--- utils/func.py | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crud/crud_user.py b/crud/crud_user.py index cd07db7..0dade1a 100644 --- a/crud/crud_user.py +++ b/crud/crud_user.py @@ -27,7 +27,7 @@ class CRUDUser(CRUDBase): return res #获取用户信息(list) async def get_users(self, db: AsyncIOMotorDatabase, user_id: list): - res = await db[self.coll_name].find_many({'user_id':{'$in': user_id}}, {'name': 1,'user_id':1}) + res = await self.find_many(db,{'user_id':{'$in': user_id}}, {'name': 1,'user_id':1}) return res async def edit_profile(self, db: AsyncIOMotorDatabase, data_id: schemas.UserProfileEdit, user_id): diff --git a/utils/dingding.py b/utils/dingding.py index 2f2673a..e829e55 100644 --- a/utils/dingding.py +++ b/utils/dingding.py @@ -148,7 +148,10 @@ def get_section(): da_s.append(k) if v != 'NBD': da_dict[v] = da_s - return da_dict + depid = {} + for k, v in section.items(): + depid[v] = k + return da_dict, depid def get_all_uid(): @@ -156,11 +159,12 @@ def get_all_uid(): 获取所有部门的钉钉用户id :return: list """ - date_s = get_section() + date_s,depid = get_section() res_c = [] for k, v in date_s.items(): res = {} res['section_name'] = k + res['depid'] = depid[k] res_list = [] for i in v: user_list = get_uid(i) @@ -270,5 +274,5 @@ def get_alluid_list(): if __name__ == '__main__': #a = user_details('16371426094531014') - a=get_alluid_list() + a=get_all_uid() pprint.pprint(a) diff --git a/utils/func.py b/utils/func.py index 2ce9819..9f72555 100644 --- a/utils/func.py +++ b/utils/func.py @@ -359,4 +359,7 @@ def doc2pdf(fn, path_data, filename): if __name__ == '__main__': - get_every_months('2022-01-01', '2022-12-31') + fn=r'C:\Users\Administrator\Desktop\面试简历\智联招聘_张双琪_Web开发工程师_中文.doc' + path_data=r'C:\Users\Administrator\Desktop\面试简历\\' + filename='智联招聘_张双琪_Web开发工程师_中文.doc' + doc2pdf(fn, path_data, filename)