332 lines
13 KiB
Plaintext
332 lines
13 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "70c9ccec",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"os.add_dll_directory(os.getcwd())\n",
|
|
"from pctoken import get_token\n",
|
|
"from requests import get,post"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "379f4db2",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"bN7Xn9xVdkyg\n"
|
|
]
|
|
},
|
|
{
|
|
"ename": "",
|
|
"evalue": "",
|
|
"output_type": "error",
|
|
"traceback": [
|
|
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
|
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
|
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
|
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"BASE_URL = 'http://192.168.0.10:9999'\n",
|
|
"USERNAME = '00000001CDSPTSZX'\n",
|
|
"PASSWORD = 'xia123456'\n",
|
|
"TOKEN = get_token(BASE_URL, USERNAME, PASSWORD)[\"access_token\"]\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "dcf475eb",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'ee5552cb-7dd8-46b4-b54a-e8cf57e90ddc'"
|
|
]
|
|
},
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"TOKEN"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 26,
|
|
"id": "820f6d23",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"headers = {\n",
|
|
" \"Authorization\": f\"Bearer {TOKEN}\",\n",
|
|
" \"HX-CLIENT\": \"hongxapp\",\n",
|
|
" 'hx-p-type':'WEB',\n",
|
|
" 'hx-t-type':'PLATFORM',\n",
|
|
"}\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 27,
|
|
"id": "dd5eb589",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"{'Authorization': 'Bearer 295b20e2-1ce0-44ab-8d74-384cdefc16bb',\n",
|
|
" 'HX-CLIENT': 'hongxapp',\n",
|
|
" 'hx-p-type': 'WEB',\n",
|
|
" 'hx-t-type': 'PLATFORM'}"
|
|
]
|
|
},
|
|
"execution_count": 27,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"headers"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "869391ea",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"post('http://192.168.0.10:8888/api/admin/user/v1/exist/add', headers=headers, json={\"userId\":\"2\",\"deptId\":\"19\",\"roleId\":\"2053724615032193025\"})\n",
|
|
"{\"userId\":\"2\",\"deptId\":\"110\",\"roleId\":\"2055118564695838722\"}\n",
|
|
"{\"userId\":\"2\",\"deptId\":\"119\",\"roleId\":\"2059515940711231489\"}"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"id": "7006382d",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"user_ids = [\n",
|
|
" 3,\n",
|
|
" 4,\n",
|
|
" 6,\n",
|
|
" 24,\n",
|
|
" 31,\n",
|
|
" 308,\n",
|
|
" 909,\n",
|
|
" 917,\n",
|
|
" 918,\n",
|
|
" 1145,\n",
|
|
" 3690,\n",
|
|
" 3698,\n",
|
|
" 3828,\n",
|
|
" 3842,\n",
|
|
" 3843,\n",
|
|
" 3844,\n",
|
|
" 3895,\n",
|
|
" 3899,\n",
|
|
" 3912,\n",
|
|
" 3913,\n",
|
|
" 3935,\n",
|
|
" 3936,\n",
|
|
" 3988,\n",
|
|
" 5440,\n",
|
|
" 5492,\n",
|
|
" 7696,\n",
|
|
" 7713,\n",
|
|
" 7714,\n",
|
|
" 7723,\n",
|
|
" 7728,\n",
|
|
" 2059454179031199746]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 29,
|
|
"id": "0e7366e2",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"==================================================\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"==================================================\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"==================================================\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"{\"code\":1,\"msg\":\"用户不存在\",\"data\":null,\"ok\":false}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"{\"code\":0,\"msg\":null,\"data\":true,\"ok\":true}\n",
|
|
"==================================================\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for user_id in user_ids:\n",
|
|
" resp = post('http://192.168.0.10:9999/admin/user/v1/exist/add', headers=headers, json={\"userId\":str(user_id),\"deptId\":\"110\",\"roleId\":\"2055118564695838722\"}).text\n",
|
|
" resp1 = post('http://192.168.0.10:9999/admin/user/v1/exist/add', headers=headers, json={\"userId\":str(user_id),\"deptId\":\"119\",\"roleId\":\"2059515940711231489\"}).text\n",
|
|
" resp2 = post('http://192.168.0.10:9999/admin/user/v1/exist/add', headers=headers, json={\"userId\":str(user_id),\"deptId\":\"19\",\"roleId\":\"2053724615032193025\"}).text\n",
|
|
" print(resp)\n",
|
|
" print(resp1)\n",
|
|
" print(resp2)\n",
|
|
" print(\"=\"*50)\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "base",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|