简道云成员id与字段监控分离

This commit is contained in:
z66
2025-08-28 11:03:46 +08:00
parent 5879eb7842
commit 2840d4871a
6 changed files with 951 additions and 169 deletions
+202
View File
@@ -0,0 +1,202 @@
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "## 外部成员结构",
"id": "a58995e7e8657dce"
},
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-08-27T03:11:49.414114Z",
"start_time": "2025-08-27T03:11:49.016794Z"
}
},
"source": [
"from api import API\n",
"\n",
"api_instance = API()\n",
"\n",
"payload = {\n",
" \"api_key\": \"6694d3c4fcb69ca9a111a6c4\",\n",
" \"entry_id\": \"68ae76ddedae9bffae06a911\",\n",
"}\n",
"df = api_instance.entry_data_list(payload, replace=True)\n",
"print(df)"
],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001B[92m2025-08-27 11:11:49,228 - api.py - task_logger - INFO - 已获取 1 条数据\u001B[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"进行了替换\n",
"{'data': [{'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-08-27T03:09:49.522Z', 'updateTime': '2025-08-27T03:09:49.522Z', 'deleteTime': None, '成员单选': {'name': '申晨', 'username': 'R-688c8ba43678deccfcb5c386-jdy-jv71cd380jlj', 'status': 1, 'type': 2, 'departments': [-979913651]}, '成员多选': [{'name': '申晨', 'username': 'R-688c8ba43678deccfcb5c386-jdy-jv71cd380jlj', 'status': 1, 'type': 2, 'departments': [-979913651]}, {'name': '张阳', 'username': '4210192048793363', 'status': 1, 'type': 0, 'departments': [449008196], 'integrate_id': '4210192048793363'}], '_id': '68ae76fd74ad62855e55e195', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '68ae76ddedae9bffae06a911'}]}\n"
]
}
],
"execution_count": 2
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 向表格内写入外部成员",
"id": "e311761d3eff6179"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-08-27T03:13:40.574272Z",
"start_time": "2025-08-27T03:13:40.428525Z"
}
},
"cell_type": "code",
"source": [
"from api import API\n",
"\n",
"api_instance = API()\n",
"payload = {\n",
" \"api_key\": \"6694d3c4fcb69ca9a111a6c4\",\n",
" \"entry_id\": \"68ae76ddedae9bffae06a911\",\n",
" \"data\":{\"_widget_1756264157512\":{\"value\":\"R-688c8ba43678deccfcb5c386-jdy-jv71cd380jlj\"}}\n",
"}\n",
"dict = api_instance.data_batch_create(payload)\n",
"\n",
"print(dict)"
],
"id": "80256c669800af2f",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'data': {'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-08-27T03:13:40.349Z', 'updateTime': '2025-08-27T03:13:40.349Z', 'deleteTime': None, '_widget_1756264157512': {'name': '申晨', 'username': 'R-688c8ba43678deccfcb5c386-jdy-jv71cd380jlj', 'status': 1, 'type': 2, 'departments': [-979913651]}, '_widget_1756264157513': [], '_id': '68ae77e44b356b9bc83e338d', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '68ae76ddedae9bffae06a911'}}\n"
]
}
],
"execution_count": 3
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 获取关联企业",
"id": "714a210b956fe262"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-08-27T03:16:34.842344Z",
"start_time": "2025-08-27T03:16:34.456948Z"
}
},
"cell_type": "code",
"source": [
"import requests\n",
"import json\n",
"\n",
"url = \"https://api.jiandaoyun.com/api/v5/corp/guest/department/list\"\n",
"\n",
"headers = {\n",
" 'Authorization': 'Bearer qygHulymo1fekJk4CIZyNKjyQAzG8CFN',\n",
" 'Content-Type': 'application/json'\n",
"}\n",
"response = requests.post(url, headers=headers)\n",
"print(response.json())\n",
"dept_list = response.json().get(\"dept_list\",[])\n",
"for dept in dept_list:\n",
" print(dept.get(\"name\"))"
],
"id": "d14ea7a6ab8b00dc",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'dept_list': [{'dept_no': -12, 'name': 'CASTROL LIMITED', 'type': 2, 'status': 1}, {'dept_no': -979913650, 'name': '曹伟手机号注册所处公司', 'type': 2, 'status': 1}, {'dept_no': -979913651, 'name': '申晨', 'type': 2, 'status': 1}]}\n"
]
}
],
"execution_count": 5
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## 获取关联企业对接人",
"id": "28355f7a1f5b7a3a"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-08-27T03:19:09.922520Z",
"start_time": "2025-08-27T03:19:09.839699Z"
}
},
"cell_type": "code",
"source": [
"import requests\n",
"import json\n",
"url = \"https://api.jiandaoyun.com/api/v5/corp/guest/user/list\"\n",
"\n",
"\n",
"headers = {\n",
" 'Authorization': 'Bearer qygHulymo1fekJk4CIZyNKjyQAzG8CFN',\n",
" 'Content-Type': 'application/json'\n",
"}\n",
"\n",
"response = requests.post(url, headers=headers)\n",
"all_data = []\n",
"member_list = response.json().get(\"member_list\",[])\n",
"for member in member_list:\n",
" name = member.get(\"name\")\n",
" username = member.get(\"username\") # 用户id\n",
" all_data.append({\"name\":name,\"username\":username})\n"
],
"id": "11fd29cc47185320",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sylvia7203@gmail.com\n",
"金鹏测试\n",
"曹伟手机号注册\n",
"葡萄\n",
"申晨\n"
]
}
],
"execution_count": 7
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}