Browse Source

perf: Replace Feishu to obtain user information interface

pull/13961/head
feng 3 months ago committed by Bryan
parent
commit
6b00ba271f
  1. 14
      apps/common/sdk/im/feishu/__init__.py

14
apps/common/sdk/im/feishu/__init__.py

@ -151,9 +151,17 @@ class FeiShu(RequestMixin):
}
def get_user_detail(self, user_id, **kwargs):
# get_user_id_by_code 已经返回个人信息,这里直接解析
data = kwargs['other_info']
data['user_id'] = user_id
# https://open.feishu.cn/document/server-docs/contact-v3/user/get
data = {}
try:
data = self._requests.get(
self.url_instance.get_user_detail(user_id),
{'user_id_type': 'user_id'}
)
data = data['data']['user']
except Exception as e:
logger.error(f'Get user detail error: {e} data={data}')
info = flatten_dict(data)
default_detail = self.default_user_detail(data, user_id)
detail = map_attributes(default_detail, info, self.attributes)

Loading…
Cancel
Save