536浏览
查看: 536|回复: 0

[项目分享] Flask_admin—快速搭建访客登记系统Web管理后台

[复制链接]
简介:在《App Inventor 2—自制身份证识别及人证比对验证系统》和《MySQL—访客登记系统数据库及Web服务搭建》的基础上,通过在云服务器上的Python程序中使用Flask_admin扩展,快速搭建数据库Web管理后台。通过整合上述实验,了解全栈开发的基本思路。   

在《App Inventor 2—自制身份证识别及人证比对验证系统》中,我们通过App Inventor 2调用万维易源的API接口,实现了身份证OCR识别和人脸验证比对功能,制作了一个基本的安卓版人证比对验证系统。在《MySQL—访客登记系统数据库及Web服务搭建》中,我们在前期人证比对验证系统的基础上,通过在云服务器上搭建MySQL数据库及相关的Web服务API接口,将人证比对系统数据存储到数据库,从而将人证比对系统拓展为访客登记系统。在本章,我们将在上面两个实验的基础上,通过在云服务器上的Python程序中使用Flask_admin扩展,快速搭建数据库的Web管理后台,实现PC端浏览器对数据库的访问及管理。通过实验,初步了解全栈开发的基本思路,从手机端采集数据,到云端存储数据,再到PC端管理数据的实现路径。   

Flask_admin—快速搭建访客登记系统Web管理后台图1

1.实验目标(1)初步了解全栈开发的概念
(2)学习实践Python的Flask_admin扩展库
(3)学习实践云服务器的管理使用
(4)学习实践创建虚拟数据进行模拟测试
2.实验所需资源
硬件:
(1)电脑
本实验所用的台式电脑为Windows7操作系统。
(2)手机
本实验使用手机为安卓系统。
(3)云服务器(或本地服务器)
本实验使用的是阿里云入门级云服务器,配置为2 vCPU 2 GiB,操作系统为CentOS 7.9。   
软件:
(1)云服务器安装宝塔面板
本实验使用宝塔面板为LNMP环境。
(2)电脑安装Mind+软件
本实验所用的Mind+软件版本为V1.8.0 RC1.1。
和前两个实验一样,本实验也需要有一定的基础知识,如MySQL数据库的基础知识,Python语言和Flask的基础知识,API接口的概念,Web请求的概念,常见的GET、POST请求的区别,请求和返回的数据类型,比如常见的JSON、字典、base64等数据类型的概念。

3.Python的Flask_admin扩展库简介

在之前的实验中,我们已经开发了采集数据的手机APP,还搭建了存储数据的云服务器MySQL数据库,但目前查看和管理数据还只能通过MySQL数据库管理工具phpMyAdmin进行管理,需要一定的专业知识,并且不利于数据安全,不适合于普通用户。针对此问题,我们需要一个PC浏览器能访问的数据库Web后台管理页面。按此前对Flask库的了解,我们可以通过搭建模型,编写视图函数,设计HTML模板的方式来从零搭建,但这个方法太过于费时费力,有没有更简单的方法?答案是肯定的,本次实验用到的Flask_admin就可以帮助开发者快速生成一个功能强大的数据库Web管理面板,进行数据的增删改查操作。它支持多种数据库和表单,具有高度的可定制性。   

4.在云服务器上的Python程序中添加Flask_admin扩展相关代码

使用宝塔面板登录云服务器后,点击左侧“文件”菜单,在“/www/wwwroot/mysqlapi”路径下找到上个实验创建的“mysqlapi.py”文件,双击打开进行编辑。

Flask_admin—快速搭建访客登记系统Web管理后台图2

如果只是简单的快速创建Web后台,针对这个项目,在导入Flask_admin模块后,只需在代码中添加下面这段代码就可以创建Web后台:
  1. <div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
  2. mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
  3. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  4. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#999999;border:
  5. solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
  6. mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;
  7. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  8. Consolas;color:#999999;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  9. padding:0cm;mso-font-kerning:0pt">配置</span><span lang="EN-US" style="font-size:
  10. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#999999;border:
  11. solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
  12. mso-font-kerning:0pt"> Flask-Admin</span><span lang="EN-US" style="font-size:
  13. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  14. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  15. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  16. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  17. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">admin </span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  18. 宋体;color:#67CDCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  19. padding:0cm;mso-font-kerning:0pt">=</span><span lang="EN-US" style="font-size:
  20. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  21. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> Admin</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  22. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  23. padding:0cm;mso-font-kerning:0pt">(</span><span lang="EN-US" style="font-size:
  24. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  25. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  26. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  27. padding:0cm;mso-font-kerning:0pt">,</span><span lang="EN-US" style="font-size:
  28. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  29. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> name</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  30. 宋体;color:#67CDCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  31. padding:0cm;mso-font-kerning:0pt">=</span><span lang="EN-US" style="font-size:
  32. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#7EC699;border:
  33. solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
  34. mso-font-kerning:0pt">'MyApp'</span><span lang="EN-US" style="font-size:9.0pt;
  35. font-family:Consolas;mso-fareast-font-family:宋体;color:#CCCCCC;border:solid windowtext 1.0pt;
  36. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">,</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  37. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  38. padding:0cm;mso-font-kerning:0pt"> template_mode</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  39. color:#67CDCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  40. padding:0cm;mso-font-kerning:0pt">=</span><span lang="EN-US" style="font-size:
  41. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#7EC699;border:
  42. solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
  43. mso-font-kerning:0pt">'bootstrap3'</span><span lang="EN-US" style="font-size:
  44. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#CCCCCC;border:
  45. solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
  46. mso-font-kerning:0pt">)</span><span lang="EN-US" style="font-size:9.0pt;
  47. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  48. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  49. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  50. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  51. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">admin</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  52. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  53. padding:0cm;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:
  54. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  55. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">add_view</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  56. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  57. padding:0cm;mso-font-kerning:0pt">(</span><span lang="EN-US" style="font-size:
  58. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  59. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">ModelView</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  60. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  61. padding:0cm;mso-font-kerning:0pt">(</span><span lang="EN-US" style="font-size:
  62. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  63. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">UserInfo</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  64. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  65. padding:0cm;mso-font-kerning:0pt">,</span><span lang="EN-US" style="font-size:
  66. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  67. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  68. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  69. padding:0cm;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:
  70. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  71. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">session</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  72. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  73. padding:0cm;mso-font-kerning:0pt">))</span><span lang="EN-US" style="font-size:
  74. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  75. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  76. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  77. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  78. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">admin</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  79. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  80. padding:0cm;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:
  81. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  82. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">add_view</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  83. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  84. padding:0cm;mso-font-kerning:0pt">(</span><span lang="EN-US" style="font-size:
  85. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  86. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">ModelView</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  87. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  88. padding:0cm;mso-font-kerning:0pt">(</span><span lang="EN-US" style="font-size:
  89. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  90. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">VisitorLog</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  91. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  92. padding:0cm;mso-font-kerning:0pt">,</span><span lang="EN-US" style="font-size:
  93. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  94. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  95. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  96. padding:0cm;mso-font-kerning:0pt">.</span><span lang="EN-US" style="font-size:
  97. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  98. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">session</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  99. 宋体;color:#CCCCCC;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  100. padding:0cm;mso-font-kerning:0pt">))</span><span lang="EN-US" style="font-size:
  101. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  102. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  103. </div>
复制代码

但为了进一步探索和了解Flask_admin的功能,我们在代码中使用了自定义模板、搜索、筛选等实用功能,在上一个项目的基础上,也只添加了少量代码(标红部分),完整代码如下:   
  1. <div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
  2. mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
  3. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  4. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  5. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
  6. flask import Flask, request, jsonify<o:p></o:p></span></p>
  7. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  8. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  9. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
  10. flask_sqlalchemy import SQLAlchemy<o:p></o:p></span></p>
  11. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  12. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  13. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
  14. sqlalchemy.exc import SQLAlchemyError<o:p></o:p></span></p>
  15. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  16. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  17. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  18. red;mso-font-kerning:0pt">from flask_admin import Admin<o:p></o:p></span></p>
  19. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  20. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  21. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  22. red;mso-font-kerning:0pt">from flask_admin.contrib.sqla import ModelView<o:p></o:p></span></p>
  23. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  24. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  25. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  26. red;mso-font-kerning:0pt">from flask_babel import Babel</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  27. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  28. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  29. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  30. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  31. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  32. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  33. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  34. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app =
  35. Flask(__name__)<o:p></o:p></span></p>
  36. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  37. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  38. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  39. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  40. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  41. 0cm;mso-font-kerning:0pt">配置</span><span lang="EN-US" style="font-size:9.0pt;
  42. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  43. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> MySQL </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  44. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  45. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  46. 0cm;mso-font-kerning:0pt">数据库连接</span><span lang="EN-US" style="font-size:9.0pt;
  47. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  48. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  49. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  50. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  51. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app.config['SQLALCHEMY_DATABASE_URI']
  52. = 'mysql+pymysql://visitor:</span><span style="font-size:9.0pt;font-family:
  53. 宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  54. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  55. padding:0cm;mso-font-kerning:0pt">你的数据库密码</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  56. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  57. padding:0cm;mso-font-kerning:0pt">@127.0.0.1/visitor'<o:p></o:p></span></p>
  58. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  59. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  60. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app.config['SQLALCHEMY_TRACK_MODIFICATIONS']
  61. = False<o:p></o:p></span></p>
  62. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  63. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  64. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">db =
  65. SQLAlchemy(app)<o:p></o:p></span></p>
  66. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  67. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  68. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  69. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  70. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  71. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  72. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  73. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  74. 0cm;mso-font-kerning:0pt">用户信息表模型</span><span lang="EN-US" style="font-size:9.0pt;
  75. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  76. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  77. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  78. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  79. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">class
  80. UserInfo(db.Model):<o:p></o:p></span></p>
  81. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  82. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  83. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    __tablename__ = 'user_info'<o:p></o:p></span></p>
  84. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  85. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  86. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    identity_number = db.Column(db.String(18),
  87. primary_key=True)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  88. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  89. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  90. 0cm;mso-font-kerning:0pt">身份证号码(主键)</span><span lang="EN-US" style="font-size:
  91. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  92. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  93. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  94. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  95. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    name = db.Column(db.String(50),
  96. nullable=False)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  97. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  98. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  99. 0cm;mso-font-kerning:0pt">用户姓名</span><span lang="EN-US" style="font-size:9.0pt;
  100. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  101. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  102. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  103. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  104. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    sex = db.Column(db.Enum('</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  105. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  106. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  107. 0cm;mso-font-kerning:0pt">男</span><span lang="EN-US" style="font-size:9.0pt;
  108. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  109. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">', '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  110. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  111. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  112. 0cm;mso-font-kerning:0pt">女</span><span lang="EN-US" style="font-size:9.0pt;
  113. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  114. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">'),
  115. nullable=False)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  116. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  117. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  118. 0cm;mso-font-kerning:0pt">性别</span><span lang="EN-US" style="font-size:9.0pt;
  119. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  120. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  121. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  122. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  123. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    birth_date = db.Column(db.Date,
  124. nullable=False)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  125. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  126. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  127. 0cm;mso-font-kerning:0pt">出生日期</span><span lang="EN-US" style="font-size:9.0pt;
  128. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  129. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  130. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  131. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  132. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    address = db.Column(db.String(255))  # </span><span style="font-size:9.0pt;
  133. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  134. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  135. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">地址</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  136. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  137. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  138. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  139. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  140. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    ethnicity = db.Column(db.String(20))  # </span><span style="font-size:9.0pt;
  141. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  142. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  143. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">民族</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  144. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  145. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  146. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  147. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  148. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    photo = db.Column(db.LargeBinary)  # </span><span style="font-size:9.0pt;
  149. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  150. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  151. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">身份证照片</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  152. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  153. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  154. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  155. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  156. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    face_comparison_result =
  157. db.Column(db.String(50))  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  158. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  159. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  160. 0cm;mso-font-kerning:0pt">人脸比对结果</span><span lang="EN-US" style="font-size:9.0pt;
  161. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  162. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  163. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  164. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  165. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    created_at = db.Column(db.DateTime,
  166. default=db.func.current_timestamp())  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  167. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  168. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  169. 0cm;mso-font-kerning:0pt">记录创建时间</span><span lang="EN-US" style="font-size:9.0pt;
  170. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  171. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  172. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  173. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  174. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  175. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  176. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  177. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  178. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  179. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  180. 0cm;mso-font-kerning:0pt">访客登记表模型</span><span lang="EN-US" style="font-size:9.0pt;
  181. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  182. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  183. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  184. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  185. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">class
  186. VisitorLog(db.Model):<o:p></o:p></span></p>
  187. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  188. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  189. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    __tablename__ = 'visitor_log'<o:p></o:p></span></p>
  190. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  191. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  192. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    id = db.Column(db.Integer, primary_key=True,
  193. autoincrement=True)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  194. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  195. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  196. 0cm;mso-font-kerning:0pt">唯一标识</span><span lang="EN-US" style="font-size:9.0pt;
  197. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  198. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  199. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  200. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  201. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    visitor_name = db.Column(db.String(50),
  202. nullable=False)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  203. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  204. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  205. 0cm;mso-font-kerning:0pt">访客姓名</span><span lang="EN-US" style="font-size:9.0pt;
  206. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  207. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  208. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  209. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  210. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    visitor_identity_number =
  211. db.Column(db.String(18), unique=True, nullable=False)  # </span><span style="font-size:9.0pt;
  212. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  213. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  214. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">访客身份证号码</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  215. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  216. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  217. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  218. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  219. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    visitor_phone =
  220. db.Column(db.String(20))  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  221. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  222. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  223. 0cm;mso-font-kerning:0pt">访客电话</span><span lang="EN-US" style="font-size:9.0pt;
  224. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  225. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  226. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  227. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  228. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    arrival_time = db.Column(db.DateTime,
  229. nullable=False)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  230. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  231. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  232. 0cm;mso-font-kerning:0pt">到访时间</span><span lang="EN-US" style="font-size:9.0pt;
  233. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  234. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  235. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  236. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  237. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    departure_time =
  238. db.Column(db.DateTime)  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  239. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  240. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  241. 0cm;mso-font-kerning:0pt">离开时间</span><span lang="EN-US" style="font-size:9.0pt;
  242. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  243. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  244. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  245. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  246. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    visit_purpose = db.Column(db.Text)  # </span><span style="font-size:9.0pt;
  247. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  248. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  249. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">访问目的</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  250. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  251. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  252. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  253. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  254. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    photo = db.Column(db.LargeBinary)  # </span><span style="font-size:9.0pt;
  255. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  256. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  257. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">访客照片</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  258. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  259. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  260. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  261. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  262. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    user_identity_number = db.Column(db.String(18),
  263. db.ForeignKey('user_info.identity_number'))
  264. # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  265. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  266. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  267. padding:0cm;mso-font-kerning:0pt">外键</span><span lang="EN-US" style="font-size:
  268. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  269. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  270. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  271. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  272. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    created_at = db.Column(db.DateTime,
  273. default=db.func.current_timestamp())  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  274. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  275. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  276. 0cm;mso-font-kerning:0pt">记录创建时间</span><span lang="EN-US" style="font-size:9.0pt;
  277. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  278. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  279. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  280. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  281. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  282. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  283. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  284. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  285. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  286. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  287. 0cm;mso-font-kerning:0pt">创建数据库表</span><span lang="EN-US" style="font-size:9.0pt;
  288. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  289. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  290. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  291. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  292. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">with
  293. app.app_context():<o:p></o:p></span></p>
  294. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  295. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  296. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    db.create_all()<o:p></o:p></span></p>
  297. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  298. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  299. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  300. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  301. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  302. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  303. red;mso-font-kerning:0pt">babel = Babel(app)<o:p></o:p></span></p>
  304. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  305. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  306. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  307. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  308. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  309. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  310. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  311. red;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:
  312. 宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  313. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  314. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">自定义</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  315. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  316. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"> ModelView </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  317. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  318. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  319. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">以支持中文名称</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  320. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  321. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  322. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  323. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  324. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  325. red;mso-font-kerning:0pt">class UserInfoView(ModelView):<o:p></o:p></span></p>
  326. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  327. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  328. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  329. red;mso-font-kerning:0pt">   
  330. column_labels = {<o:p></o:p></span></p>
  331. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  332. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  333. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  334. red;mso-font-kerning:0pt">      
  335. 'identity_number': '</span><span style="font-size:9.0pt;font-family:
  336. 宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  337. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  338. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">身份证号码</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  339. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  340. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  341. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  342. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  343. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  344. red;mso-font-kerning:0pt">        'name':
  345. '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  346. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  347. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  348. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">姓名</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  349. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  350. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  351. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  352. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  353. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  354. red;mso-font-kerning:0pt">        'sex':
  355. '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  356. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  357. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  358. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">性别</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  359. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  360. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  361. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  362. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  363. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  364. red;mso-font-kerning:0pt">      
  365. 'birth_date': '</span><span style="font-size:9.0pt;font-family:宋体;
  366. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  367. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  368. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">出生日期</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  369. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  370. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  371. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  372. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  373. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  374. red;mso-font-kerning:0pt">      
  375. 'address': '</span><span style="font-size:9.0pt;font-family:宋体;
  376. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  377. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  378. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">地址</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  379. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  380. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  381. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  382. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  383. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  384. red;mso-font-kerning:0pt">      
  385. 'ethnicity': '</span><span style="font-size:9.0pt;font-family:宋体;
  386. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  387. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  388. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">民族</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  389. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  390. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  391. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  392. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  393. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  394. red;mso-font-kerning:0pt">      
  395. 'photo': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  396. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  397. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  398. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">照片</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  399. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  400. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  401. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  402. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  403. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  404. red;mso-font-kerning:0pt">        'face_comparison_result':
  405. '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  406. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  407. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  408. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">人脸比对结果</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  409. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  410. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  411. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  412. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  413. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  414. red;mso-font-kerning:0pt">      
  415. 'created_at': '</span><span style="font-size:9.0pt;font-family:宋体;
  416. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  417. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  418. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">创建时间</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  419. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  420. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">'<o:p></o:p></span></p>
  421. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  422. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  423. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  424. red;mso-font-kerning:0pt">    }<o:p></o:p></span></p>
  425. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  426. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  427. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  428. red;mso-font-kerning:0pt">    # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  429. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  430. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  431. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">设置可以搜索的列</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  432. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  433. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  434. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  435. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  436. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  437. red;mso-font-kerning:0pt">   
  438. column_searchable_list = ['identity_number', 'name', 'sex',
  439. 'birth_date', 'address', 'ethnicity', 'face_comparison_result']<o:p></o:p></span></p>
  440. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  441. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  442. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  443. red;mso-font-kerning:0pt">    # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  444. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  445. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  446. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">设置可以筛选的列</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  447. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  448. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  449. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  450. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  451. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  452. red;mso-font-kerning:0pt">   
  453. column_filters = ['sex', 'birth_date', 'created_at']<o:p></o:p></span></p>
  454. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  455. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  456. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  457. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  458. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  459. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  460. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  461. red;mso-font-kerning:0pt">    def
  462. __init__(self, session, **kwargs):<o:p></o:p></span></p>
  463. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  464. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  465. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  466. red;mso-font-kerning:0pt">      
  467. super().__init__(UserInfo, session, name='</span><span style="font-size:
  468. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  469. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  470. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  471. red;mso-font-kerning:0pt">用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  472. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  473. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  474. red;mso-font-kerning:0pt">', **kwargs)<o:p></o:p></span></p>
  475. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  476. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  477. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  478. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  479. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  480. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  481. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  482. red;mso-font-kerning:0pt">class VisitorLogView(ModelView):<o:p></o:p></span></p>
  483. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  484. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  485. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  486. red;mso-font-kerning:0pt">   
  487. column_labels = {<o:p></o:p></span></p>
  488. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  489. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  490. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  491. red;mso-font-kerning:0pt">        'id': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  492. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  493. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  494. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">编号</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  495. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  496. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  497. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  498. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  499. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  500. red;mso-font-kerning:0pt">      
  501. 'visitor_name': '</span><span style="font-size:9.0pt;font-family:宋体;
  502. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  503. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  504. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访客姓名</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  505. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  506. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  507. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  508. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  509. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  510. red;mso-font-kerning:0pt">      
  511. 'visitor_identity_number': '</span><span style="font-size:9.0pt;
  512. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  513. mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
  514. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  515. red;mso-font-kerning:0pt">访客身份证号码</span><span lang="EN-US" style="font-size:9.0pt;
  516. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  517. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  518. red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  519. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  520. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  521. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  522. red;mso-font-kerning:0pt">      
  523. 'visitor_phone': '</span><span style="font-size:9.0pt;font-family:宋体;
  524. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  525. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  526. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访客电话</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  527. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  528. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  529. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  530. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  531. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  532. red;mso-font-kerning:0pt">      
  533. 'arrival_time': '</span><span style="font-size:9.0pt;font-family:宋体;
  534. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  535. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  536. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">到访时间</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  537. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  538. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  539. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  540. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  541. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  542. red;mso-font-kerning:0pt">      
  543. 'departure_time': '</span><span style="font-size:9.0pt;font-family:宋体;
  544. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  545. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  546. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">离开时间</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  547. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  548. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  549. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  550. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  551. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  552. red;mso-font-kerning:0pt">      
  553. 'visit_purpose': '</span><span style="font-size:9.0pt;font-family:宋体;
  554. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  555. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  556. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访问目的</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  557. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  558. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  559. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  560. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  561. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  562. red;mso-font-kerning:0pt">      
  563. 'photo': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  564. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  565. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  566. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访客照片</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  567. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  568. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  569. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  570. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  571. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  572. red;mso-font-kerning:0pt">      
  573. 'user_identity_number': '</span><span style="font-size:9.0pt;font-family:
  574. 宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  575. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  576. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">用户身份证号码</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  577. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  578. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
  579. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  580. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  581. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  582. red;mso-font-kerning:0pt">        'created_at':
  583. '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  584. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  585. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  586. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">创建时间</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  587. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  588. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">'<o:p></o:p></span></p>
  589. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  590. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  591. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  592. red;mso-font-kerning:0pt">    }<o:p></o:p></span></p>
  593. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  594. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  595. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  596. red;mso-font-kerning:0pt">    # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  597. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  598. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  599. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">设置可以搜索的列</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  600. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  601. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  602. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  603. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  604. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  605. red;mso-font-kerning:0pt">   
  606. column_searchable_list = ['visitor_name', 'visitor_identity_number',
  607. 'visitor_phone', 'arrival_time', 'visit_purpose']<o:p></o:p></span></p>
  608. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  609. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  610. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  611. red;mso-font-kerning:0pt">    # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  612. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  613. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  614. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">设置可以筛选的列</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  615. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  616. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  617. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  618. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  619. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  620. red;mso-font-kerning:0pt">   
  621. column_filters = ['arrival_time', 'departure_time', 'visit_purpose', 'user_identity_number',
  622. 'created_at']<o:p></o:p></span></p>
  623. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  624. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  625. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  626. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  627. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  628. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  629. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  630. red;mso-font-kerning:0pt">    def
  631. __init__(self, session, **kwargs):<o:p></o:p></span></p>
  632. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  633. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  634. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  635. red;mso-font-kerning:0pt">      
  636. super().__init__(VisitorLog, session, name='</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  637. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  638. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  639. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访客登记</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  640. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  641. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">', **kwargs)<o:p></o:p></span></p>
  642. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  643. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  644. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  645. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  646. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  647. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  648. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  649. red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  650. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  651. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  652. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  653. red;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:
  654. 宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  655. Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  656. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">增加</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  657. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  658. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"> Flask-Admin
  659. </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  660. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  661. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  662. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">管理界面</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  663. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  664. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
  665. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  666. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  667. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  668. red;mso-font-kerning:0pt">admin = Admin(app, name='</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  669. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  670. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  671. 0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">访客登记系统</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  672. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  673. padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',
  674. template_mode='bootstrap3')<o:p></o:p></span></p>
  675. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  676. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  677. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  678. red;mso-font-kerning:0pt">admin.add_view(UserInfoView(db.session))<o:p></o:p></span></p>
  679. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  680. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  681. mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
  682. red;mso-font-kerning:0pt">admin.add_view(VisitorLogView(db.session))</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  683. 宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  684. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  685. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  686. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  687. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  688. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  689. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  690. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  691. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  692. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  693. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  694. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  695. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  696. 0cm;mso-font-kerning:0pt">增加用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  697. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  698. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  699. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  700. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  701. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user',
  702. methods=['POST'])<o:p></o:p></span></p>
  703. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  704. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  705. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  706. add_user():<o:p></o:p></span></p>
  707. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  708. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  709. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  710. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  711. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  712. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        data = request.json<o:p></o:p></span></p>
  713. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  714. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  715. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        new_user = UserInfo(<o:p></o:p></span></p>
  716. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  717. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  718. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  719. identity_number=data['identity_number'],<o:p></o:p></span></p>
  720. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  721. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  722. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            name=data['name'],<o:p></o:p></span></p>
  723. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  724. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  725. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            sex=data['sex'],<o:p></o:p></span></p>
  726. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  727. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  728. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            birth_date=data['birth_date'],<o:p></o:p></span></p>
  729. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  730. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  731. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            address=data.get('address'),<o:p></o:p></span></p>
  732. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  733. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  734. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            ethnicity=data.get('ethnicity'),<o:p></o:p></span></p>
  735. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  736. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  737. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            photo=data.get('photo'),<o:p></o:p></span></p>
  738. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  739. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  740. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            face_comparison_result=data.get('face_comparison_result')<o:p></o:p></span></p>
  741. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  742. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  743. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        )<o:p></o:p></span></p>
  744. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  745. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  746. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.add(new_user)<o:p></o:p></span></p>
  747. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  748. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  749. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  750. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  751. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  752. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  753. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  754. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  755. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  756. padding:0cm;mso-font-kerning:0pt">用户信息添加成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  757. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  758. padding:0cm;mso-font-kerning:0pt">"}), 201<o:p></o:p></span></p>
  759. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  760. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  761. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  762. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  763. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  764. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  765. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  766. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  767. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  768. str(e)}), 400<o:p></o:p></span></p>
  769. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  770. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  771. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  772. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  773. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  774. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  775. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  776. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  777. 0cm;mso-font-kerning:0pt">查询用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  778. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  779. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  780. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  781. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  782. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
  783. methods=['GET'])<o:p></o:p></span></p>
  784. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  785. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  786. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  787. get_user(identity_number):<o:p></o:p></span></p>
  788. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  789. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  790. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  791. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  792. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  793. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user =
  794. UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
  795. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  796. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  797. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({<o:p></o:p></span></p>
  798. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  799. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  800. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "identity_number": user.identity_number,<o:p></o:p></span></p>
  801. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  802. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  803. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "name": user.name,<o:p></o:p></span></p>
  804. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  805. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  806. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "sex": user.sex,<o:p></o:p></span></p>
  807. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  808. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  809. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "birth_date":
  810. user.birth_date,<o:p></o:p></span></p>
  811. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  812. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  813. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "address": user.address,<o:p></o:p></span></p>
  814. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  815. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  816. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "ethnicity":
  817. user.ethnicity,<o:p></o:p></span></p>
  818. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  819. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  820. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "photo": user.photo,<o:p></o:p></span></p>
  821. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  822. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  823. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "face_comparison_result":
  824. user.face_comparison_result,<o:p></o:p></span></p>
  825. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  826. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  827. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "created_at":
  828. user.created_at<o:p></o:p></span></p>
  829. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  830. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  831. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        })<o:p></o:p></span></p>
  832. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  833. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  834. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  835. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  836. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  837. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  838. str(e)}), 400<o:p></o:p></span></p>
  839. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  840. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  841. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  842. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  843. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  844. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  845. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  846. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  847. 0cm;mso-font-kerning:0pt">修改用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  848. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  849. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  850. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  851. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  852. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
  853. methods=['PUT'])<o:p></o:p></span></p>
  854. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  855. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  856. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def update_user(identity_number):<o:p></o:p></span></p>
  857. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  858. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  859. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  860. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  861. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  862. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        data = request.json<o:p></o:p></span></p>
  863. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  864. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  865. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user =
  866. UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
  867. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  868. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  869. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.name = data.get('name', user.name)<o:p></o:p></span></p>
  870. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  871. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  872. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.sex = data.get('sex', user.sex)<o:p></o:p></span></p>
  873. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  874. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  875. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.birth_date = data.get('birth_date',
  876. user.birth_date)<o:p></o:p></span></p>
  877. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  878. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  879. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.address = data.get('address',
  880. user.address)<o:p></o:p></span></p>
  881. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  882. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  883. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.ethnicity = data.get('ethnicity',
  884. user.ethnicity)<o:p></o:p></span></p>
  885. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  886. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  887. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.photo = data.get('photo',
  888. user.photo)<o:p></o:p></span></p>
  889. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  890. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  891. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user.face_comparison_result =
  892. data.get('face_comparison_result', user.face_comparison_result)<o:p></o:p></span></p>
  893. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  894. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  895. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  896. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  897. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  898. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  899. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  900. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  901. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  902. padding:0cm;mso-font-kerning:0pt">用户信息更新成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  903. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  904. padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
  905. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  906. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  907. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  908. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  909. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  910. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  911. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  912. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  913. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  914. str(e)}), 400<o:p></o:p></span></p>
  915. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  916. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  917. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  918. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  919. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  920. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  921. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  922. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  923. 0cm;mso-font-kerning:0pt">删除用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  924. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  925. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  926. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  927. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  928. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
  929. methods=['DELETE'])<o:p></o:p></span></p>
  930. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  931. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  932. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  933. delete_user(identity_number):<o:p></o:p></span></p>
  934. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  935. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  936. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  937. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  938. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  939. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        user =
  940. UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
  941. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  942. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  943. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.delete(user)<o:p></o:p></span></p>
  944. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  945. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  946. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  947. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  948. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  949. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  950. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  951. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  952. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  953. padding:0cm;mso-font-kerning:0pt">用户信息删除成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  954. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  955. padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
  956. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  957. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  958. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  959. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  960. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  961. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  962. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  963. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  964. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  965. str(e)}), 400<o:p></o:p></span></p>
  966. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  967. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  968. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  969. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  970. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  971. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  972. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  973. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  974. 0cm;mso-font-kerning:0pt">查询所有用户信息</span><span lang="EN-US" style="font-size:
  975. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  976. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  977. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  978. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  979. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/users',
  980. methods=['GET'])<o:p></o:p></span></p>
  981. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  982. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  983. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  984. get_all_users():<o:p></o:p></span></p>
  985. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  986. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  987. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  988. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  989. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  990. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        users = UserInfo.query.all()<o:p></o:p></span></p>
  991. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  992. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  993. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        result = [{<o:p></o:p></span></p>
  994. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  995. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  996. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "identity_number":
  997. user.identity_number,<o:p></o:p></span></p>
  998. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  999. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1000. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "name": user.name,<o:p></o:p></span></p>
  1001. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1002. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1003. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "sex": user.sex,<o:p></o:p></span></p>
  1004. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1005. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1006. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "birth_date":
  1007. user.birth_date,<o:p></o:p></span></p>
  1008. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1009. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1010. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "address": user.address,<o:p></o:p></span></p>
  1011. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1012. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1013. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "ethnicity":
  1014. user.ethnicity,<o:p></o:p></span></p>
  1015. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1016. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1017. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "photo": user.photo,<o:p></o:p></span></p>
  1018. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1019. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1020. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "face_comparison_result":
  1021. user.face_comparison_result,<o:p></o:p></span></p>
  1022. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1023. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1024. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "created_at":
  1025. user.created_at<o:p></o:p></span></p>
  1026. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1027. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1028. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        } for user in users]<o:p></o:p></span></p>
  1029. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1030. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1031. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify(result)<o:p></o:p></span></p>
  1032. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1033. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1034. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1035. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1036. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1037. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1038. str(e)}), 400<o:p></o:p></span></p>
  1039. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1040. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1041. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1042. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1043. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1044. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  1045. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  1046. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  1047. 0cm;mso-font-kerning:0pt">增加访客登记</span><span lang="EN-US" style="font-size:9.0pt;
  1048. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1049. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  1050. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1051. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1052. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor',
  1053. methods=['POST'])<o:p></o:p></span></p>
  1054. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1055. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1056. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  1057. add_visitor():<o:p></o:p></span></p>
  1058. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1059. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1060. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  1061. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1062. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1063. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        data = request.json<o:p></o:p></span></p>
  1064. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1065. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1066. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        new_visitor = VisitorLog(<o:p></o:p></span></p>
  1067. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1068. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1069. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            visitor_name=data['visitor_name'],<o:p></o:p></span></p>
  1070. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1071. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1072. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1073. visitor_identity_number=data['visitor_identity_number'],<o:p></o:p></span></p>
  1074. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1075. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1076. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1077. visitor_phone=data.get('visitor_phone'),<o:p></o:p></span></p>
  1078. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1079. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1080. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            arrival_time=data['arrival_time'],<o:p></o:p></span></p>
  1081. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1082. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1083. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1084. departure_time=data.get('departure_time'),<o:p></o:p></span></p>
  1085. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1086. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1087. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1088. visit_purpose=data.get('visit_purpose'),<o:p></o:p></span></p>
  1089. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1090. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1091. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            photo=data.get('photo'),<o:p></o:p></span></p>
  1092. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1093. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1094. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1095. user_identity_number=data.get('user_identity_number')<o:p></o:p></span></p>
  1096. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1097. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1098. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        )<o:p></o:p></span></p>
  1099. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1100. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1101. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.add(new_visitor)<o:p></o:p></span></p>
  1102. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1103. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1104. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  1105. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1106. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1107. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  1108. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  1109. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  1110. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1111. padding:0cm;mso-font-kerning:0pt">访客登记添加成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  1112. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1113. padding:0cm;mso-font-kerning:0pt">"}), 201<o:p></o:p></span></p>
  1114. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1115. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1116. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1117. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1118. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1119. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  1120. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1121. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1122. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1123. str(e)}), 400<o:p></o:p></span></p>
  1124. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1125. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1126. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1127. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1128. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1129. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  1130. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  1131. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  1132. 0cm;mso-font-kerning:0pt">查询访客登记</span><span lang="EN-US" style="font-size:9.0pt;
  1133. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1134. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  1135. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1136. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1137. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
  1138. methods=['GET'])<o:p></o:p></span></p>
  1139. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1140. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1141. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  1142. get_visitor(id):<o:p></o:p></span></p>
  1143. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1144. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1145. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  1146. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1147. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1148. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor =
  1149. VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
  1150. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1151. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1152. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({<o:p></o:p></span></p>
  1153. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1154. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1155. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "id": visitor.id,<o:p></o:p></span></p>
  1156. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1157. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1158. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visitor_name":
  1159. visitor.visitor_name,<o:p></o:p></span></p>
  1160. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1161. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1162. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1163. "visitor_identity_number": visitor.visitor_identity_number,<o:p></o:p></span></p>
  1164. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1165. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1166. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visitor_phone":
  1167. visitor.visitor_phone,<o:p></o:p></span></p>
  1168. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1169. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1170. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "arrival_time":
  1171. visitor.arrival_time,<o:p></o:p></span></p>
  1172. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1173. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1174. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "departure_time": visitor.departure_time,<o:p></o:p></span></p>
  1175. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1176. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1177. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visit_purpose":
  1178. visitor.visit_purpose,<o:p></o:p></span></p>
  1179. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1180. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1181. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "photo": visitor.photo,<o:p></o:p></span></p>
  1182. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1183. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1184. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "user_identity_number":
  1185. visitor.user_identity_number,<o:p></o:p></span></p>
  1186. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1187. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1188. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "created_at":
  1189. visitor.created_at<o:p></o:p></span></p>
  1190. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1191. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1192. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        })<o:p></o:p></span></p>
  1193. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1194. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1195. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1196. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1197. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1198. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1199. str(e)}), 400<o:p></o:p></span></p>
  1200. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1201. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1202. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1203. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1204. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1205. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  1206. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  1207. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  1208. 0cm;mso-font-kerning:0pt">修改访客登记</span><span lang="EN-US" style="font-size:9.0pt;
  1209. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1210. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  1211. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1212. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1213. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
  1214. methods=['PUT'])<o:p></o:p></span></p>
  1215. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1216. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1217. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  1218. update_visitor(id):<o:p></o:p></span></p>
  1219. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1220. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1221. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  1222. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1223. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1224. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        data = request.json<o:p></o:p></span></p>
  1225. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1226. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1227. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor =
  1228. VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
  1229. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1230. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1231. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.visitor_name =
  1232. data.get('visitor_name', visitor.visitor_name)<o:p></o:p></span></p>
  1233. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1234. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1235. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.visitor_identity_number =
  1236. data.get('visitor_identity_number', visitor.visitor_identity_number)<o:p></o:p></span></p>
  1237. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1238. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1239. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.visitor_phone =
  1240. data.get('visitor_phone', visitor.visitor_phone)<o:p></o:p></span></p>
  1241. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1242. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1243. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.arrival_time =
  1244. data.get('arrival_time', visitor.arrival_time)<o:p></o:p></span></p>
  1245. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1246. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1247. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.departure_time =
  1248. data.get('departure_time', visitor.departure_time)<o:p></o:p></span></p>
  1249. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1250. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1251. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.visit_purpose =
  1252. data.get('visit_purpose', visitor.visit_purpose)<o:p></o:p></span></p>
  1253. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1254. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1255. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.photo = data.get('photo',
  1256. visitor.photo)<o:p></o:p></span></p>
  1257. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1258. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1259. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor.user_identity_number =
  1260. data.get('user_identity_number', visitor.user_identity_number)<o:p></o:p></span></p>
  1261. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1262. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1263. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  1264. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1265. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1266. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  1267. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  1268. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  1269. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1270. padding:0cm;mso-font-kerning:0pt">访客登记更新成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  1271. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1272. padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
  1273. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1274. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1275. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1276. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1277. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1278. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  1279. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1280. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1281. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1282. str(e)}), 400<o:p></o:p></span></p>
  1283. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1284. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1285. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1286. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1287. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1288. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  1289. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  1290. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  1291. 0cm;mso-font-kerning:0pt">删除访客登记</span><span lang="EN-US" style="font-size:9.0pt;
  1292. font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1293. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  1294. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1295. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1296. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
  1297. methods=['DELETE'])<o:p></o:p></span></p>
  1298. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1299. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1300. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  1301. delete_visitor(id):<o:p></o:p></span></p>
  1302. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1303. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1304. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  1305. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1306. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1307. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitor =
  1308. VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
  1309. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1310. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1311. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.delete(visitor)<o:p></o:p></span></p>
  1312. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1313. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1314. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.commit()<o:p></o:p></span></p>
  1315. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1316. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1317. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"message":
  1318. "</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  1319. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  1320. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1321. padding:0cm;mso-font-kerning:0pt">访客登记删除成功</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  1322. color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  1323. padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
  1324. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1325. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1326. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1327. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1328. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1329. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        db.session.rollback()<o:p></o:p></span></p>
  1330. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1331. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1332. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1333. str(e)}), 400<o:p></o:p></span></p>
  1334. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1335. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1336. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1337. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1338. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1339. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  1340. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  1341. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  1342. 0cm;mso-font-kerning:0pt">查询所有访客登记</span><span lang="EN-US" style="font-size:
  1343. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1344. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  1345. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1346. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1347. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitors',
  1348. methods=['GET'])<o:p></o:p></span></p>
  1349. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1350. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1351. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
  1352. get_all_visitors():<o:p></o:p></span></p>
  1353. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1354. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1355. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    try:<o:p></o:p></span></p>
  1356. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1357. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1358. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        visitors = VisitorLog.query.all()<o:p></o:p></span></p>
  1359. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1360. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1361. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        result = [{<o:p></o:p></span></p>
  1362. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1363. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1364. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "id": visitor.id,<o:p></o:p></span></p>
  1365. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1366. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1367. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visitor_name":
  1368. visitor.visitor_name,<o:p></o:p></span></p>
  1369. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1370. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1371. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">           
  1372. "visitor_identity_number": visitor.visitor_identity_number,<o:p></o:p></span></p>
  1373. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1374. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1375. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visitor_phone": visitor.visitor_phone,<o:p></o:p></span></p>
  1376. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1377. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1378. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "arrival_time":
  1379. visitor.arrival_time,<o:p></o:p></span></p>
  1380. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1381. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1382. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "departure_time":
  1383. visitor.departure_time,<o:p></o:p></span></p>
  1384. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1385. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1386. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "visit_purpose":
  1387. visitor.visit_purpose,<o:p></o:p></span></p>
  1388. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1389. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1390. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "photo": visitor.photo,<o:p></o:p></span></p>
  1391. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1392. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1393. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "user_identity_number":
  1394. visitor.user_identity_number,<o:p></o:p></span></p>
  1395. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1396. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1397. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">            "created_at":
  1398. visitor.created_at<o:p></o:p></span></p>
  1399. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1400. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1401. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        } for visitor in visitors]<o:p></o:p></span></p>
  1402. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1403. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1404. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify(result)<o:p></o:p></span></p>
  1405. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1406. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1407. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    except SQLAlchemyError as e:<o:p></o:p></span></p>
  1408. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1409. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1410. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">        return jsonify({"error":
  1411. str(e)}), 400<o:p></o:p></span></p>
  1412. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1413. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1414. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  1415. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1416. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1417. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">if
  1418. __name__ == '__main__':<o:p></o:p></span></p>
  1419. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  1420. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
  1421. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">    app.run(debug=True)<o:p></o:p></span></p>
  1422. </div>
复制代码

代码中已经包含详细的功能注释,不再展开说明。相较于简单的快速创建,这里对ModelView进行了自定义,搭配flask_babel翻译模块,实现了表头中文显示,表格内容搜索和筛选等功能。

5.重启网站中的Python项目,根据运行状态修改程序或添加模块

5.1 在上一步骤修改保存“mysqlapi.py”文件后,点击宝塔面板左侧的“网站”菜单,选择“Python项目”,重启正在进行的“mysqlapi”项目。   

Flask_admin—快速搭建访客登记系统Web管理后台图3

5.2 项目的运行状态可以通过“设置”里的“项目日志”进行查看,根据提示信息,检查修复Python程序。

Flask_admin—快速搭建访客登记系统Web管理后台图4

5.3 如果日志提示缺少相应模块,可以通过项目操作栏的“模块”按钮,添加相应模块。此步骤需要反复操作直到程序正常运行。   

Flask_admin—快速搭建访客登记系统Web管理后台图5

6.通过浏览器访问Web后台

程序正常运行后,在PC上通过浏览器访问“http://*.*.*.* (你的云服务器网址):5000/admin”即可登录数据库管理后台。

Flask_admin—快速搭建访客登记系统Web管理后台图6

7.创建虚拟数据进行模拟测试

至此,一个简单的访客登记系统,包括手机端、云端、PC端都已经具备。完整的测试应该是通过手机拍照识别并保存数据,然后在PC端访问Web后台查看数据。但由于项目的特殊性,需要较多的身份证和真人配合才能获得大量数据,目前暂时不具备这个测试条件。为测试数据库及API接口是否正常,我们将通过一段Python小程序创建虚拟数据进行模拟测试。   

7.1  在Mind+(或任意Python IDE)选择“python模式”,在“代码”模式下新建一个python程序,名称随意,输入以下代码:

Flask_admin—快速搭建访客登记系统Web管理后台图7

         
  1. <div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
  2. mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
  3. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  4. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  5. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  6. padding:0cm;mso-font-kerning:0pt">import requests<o:p></o:p></span></p>
  7. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  8. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  9. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  10. padding:0cm;mso-font-kerning:0pt">import random<o:p></o:p></span></p>
  11. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  12. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  13. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  14. padding:0cm;mso-font-kerning:0pt">from faker import Faker<o:p></o:p></span></p>
  15. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  16. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  17. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  18. padding:0cm;mso-font-kerning:0pt">from datetime import datetime<o:p></o:p></span></p>
  19. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  20. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  21. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  22. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  23. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  24. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  25. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  26. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  27. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  28. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  29. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  30. 0cm;mso-font-kerning:0pt">创建</span><span lang="EN-US" style="font-size:9.0pt;
  31. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  32. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  33. padding:0cm;mso-font-kerning:0pt"> Faker </span><span style="font-size:9.0pt;
  34. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  35. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  36. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  37. 0cm;mso-font-kerning:0pt">实例</span><span lang="EN-US" style="font-size:9.0pt;
  38. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  39. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  40. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  41. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  42. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  43. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  44. padding:0cm;mso-font-kerning:0pt">fake = Faker("zh_CN")<o:p></o:p></span></p>
  45. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  46. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  47. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  48. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  49. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  50. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  51. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  52. padding:0cm;mso-font-kerning:0pt"># Flask API </span><span style="font-size:
  53. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  54. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  55. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  56. 0cm;mso-font-kerning:0pt">地址</span><span lang="EN-US" style="font-size:9.0pt;
  57. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  58. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  59. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  60. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  61. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  62. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  63. padding:0cm;mso-font-kerning:0pt">base_url = "http://*.*.*.*</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  64. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  65. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  66. padding:0cm;mso-font-kerning:0pt">(你的服务器地址)</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;
  67. color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  68. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:5000"<o:p></o:p></span></p>
  69. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  70. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  71. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  72. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  73. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  74. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  75. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  76. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  77. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  78. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  79. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  80. 0cm;mso-font-kerning:0pt">生成随机性别</span><span lang="EN-US" style="font-size:9.0pt;
  81. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  82. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  83. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  84. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  85. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  86. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  87. padding:0cm;mso-font-kerning:0pt">def random_sex():<o:p></o:p></span></p>
  88. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  89. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  90. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  91. padding:0cm;mso-font-kerning:0pt">   
  92. return random.choice(["</span><span style="font-size:9.0pt;
  93. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  94. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  95. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  96. 0cm;mso-font-kerning:0pt">男</span><span lang="EN-US" style="font-size:9.0pt;
  97. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  98. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  99. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  100. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  101. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  102. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  103. 0cm;mso-font-kerning:0pt">女</span><span lang="EN-US" style="font-size:9.0pt;
  104. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  105. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  106. padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
  107. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  108. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  109. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  110. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  111. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  112. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  113. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  114. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  115. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  116. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  117. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  118. 0cm;mso-font-kerning:0pt">生成用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  119. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  120. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  121. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  122. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  123. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  124. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  125. padding:0cm;mso-font-kerning:0pt">def generate_user_data():<o:p></o:p></span></p>
  126. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  127. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  128. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  129. padding:0cm;mso-font-kerning:0pt">   
  130. identity_number = fake.ssn()<o:p></o:p></span></p>
  131. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  132. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  133. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  134. padding:0cm;mso-font-kerning:0pt">   
  135. name = fake.name()<o:p></o:p></span></p>
  136. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  137. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  138. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  139. padding:0cm;mso-font-kerning:0pt">    sex
  140. = random_sex()<o:p></o:p></span></p>
  141. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  142. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  143. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  144. padding:0cm;mso-font-kerning:0pt">   
  145. birth_date = fake.date_of_birth(minimum_age=18,
  146. maximum_age=90).strftime("%Y-%m-%d")<o:p></o:p></span></p>
  147. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  148. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  149. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  150. padding:0cm;mso-font-kerning:0pt">   
  151. address = fake.address()<o:p></o:p></span></p>
  152. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  153. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  154. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  155. padding:0cm;mso-font-kerning:0pt">   
  156. ethnicity = fake.word(ext_word_list=["</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  157. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  158. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  159. padding:0cm;mso-font-kerning:0pt">汉族</span><span lang="EN-US" style="font-size:
  160. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  161. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  162. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  163. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  164. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  165. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  166. 0cm;mso-font-kerning:0pt">回族</span><span lang="EN-US" style="font-size:9.0pt;
  167. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  168. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  169. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  170. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  171. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  172. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  173. 0cm;mso-font-kerning:0pt">藏族</span><span lang="EN-US" style="font-size:9.0pt;
  174. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  175. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  176. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  177. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  178. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  179. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  180. 0cm;mso-font-kerning:0pt">维吾尔族</span><span lang="EN-US" style="font-size:9.0pt;
  181. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  182. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  183. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  184. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  185. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  186. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  187. 0cm;mso-font-kerning:0pt">满族</span><span lang="EN-US" style="font-size:9.0pt;
  188. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  189. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  190. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  191. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  192. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  193. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  194. 0cm;mso-font-kerning:0pt">蒙古族</span><span lang="EN-US" style="font-size:9.0pt;
  195. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  196. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  197. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  198. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  199. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  200. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  201. 0cm;mso-font-kerning:0pt">壮族</span><span lang="EN-US" style="font-size:9.0pt;
  202. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  203. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  204. padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
  205. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  206. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  207. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  208. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  209. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  210. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  211. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  212. padding:0cm;mso-font-kerning:0pt">   
  213. photo = None  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  214. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  215. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  216. padding:0cm;mso-font-kerning:0pt">将</span><span lang="EN-US" style="font-size:
  217. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  218. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  219. padding:0cm;mso-font-kerning:0pt"> photo </span><span style="font-size:9.0pt;
  220. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  221. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  222. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  223. 0cm;mso-font-kerning:0pt">字段设置为</span><span lang="EN-US" style="font-size:9.0pt;
  224. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  225. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  226. padding:0cm;mso-font-kerning:0pt"> None<o:p></o:p></span></p>
  227. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  228. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  229. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  230. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  231. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  232. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  233. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  234. padding:0cm;mso-font-kerning:0pt">   
  235. face_comparison_result = random.choice(["</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  236. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  237. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  238. padding:0cm;mso-font-kerning:0pt">匹配</span><span lang="EN-US" style="font-size:
  239. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  240. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  241. padding:0cm;mso-font-kerning:0pt">", "</span><span style="font-size:
  242. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  243. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  244. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  245. 0cm;mso-font-kerning:0pt">不匹配</span><span lang="EN-US" style="font-size:9.0pt;
  246. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  247. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  248. padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
  249. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  250. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  251. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  252. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  253. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  254. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  255. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  256. padding:0cm;mso-font-kerning:0pt">   
  257. return {<o:p></o:p></span></p>
  258. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  259. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  260. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  261. padding:0cm;mso-font-kerning:0pt">      
  262. "identity_number": identity_number,<o:p></o:p></span></p>
  263. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  264. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  265. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  266. padding:0cm;mso-font-kerning:0pt">      
  267. "name": name,<o:p></o:p></span></p>
  268. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  269. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  270. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  271. padding:0cm;mso-font-kerning:0pt">      
  272. "sex": sex,<o:p></o:p></span></p>
  273. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  274. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  275. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  276. padding:0cm;mso-font-kerning:0pt">      
  277. "birth_date": birth_date,<o:p></o:p></span></p>
  278. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  279. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  280. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  281. padding:0cm;mso-font-kerning:0pt">      
  282. "address": address,<o:p></o:p></span></p>
  283. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  284. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  285. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  286. padding:0cm;mso-font-kerning:0pt">      
  287. "ethnicity": ethnicity,<o:p></o:p></span></p>
  288. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  289. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  290. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  291. padding:0cm;mso-font-kerning:0pt">      
  292. "photo": photo,<o:p></o:p></span></p>
  293. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  294. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  295. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  296. padding:0cm;mso-font-kerning:0pt">      
  297. "face_comparison_result": face_comparison_result<o:p></o:p></span></p>
  298. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  299. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  300. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  301. padding:0cm;mso-font-kerning:0pt">    }<o:p></o:p></span></p>
  302. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  303. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  304. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  305. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  306. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  307. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  308. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  309. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  310. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  311. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  312. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  313. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  314. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  315. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  316. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  317. 0cm;mso-font-kerning:0pt">生成访客登记信息</span><span lang="EN-US" style="font-size:
  318. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  319. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  320. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  321. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  322. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  323. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  324. padding:0cm;mso-font-kerning:0pt">def
  325. generate_visitor_data(user_identity_number):<o:p></o:p></span></p>
  326. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  327. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  328. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  329. padding:0cm;mso-font-kerning:0pt">   
  330. visitor_name = fake.name()<o:p></o:p></span></p>
  331. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  332. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  333. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  334. padding:0cm;mso-font-kerning:0pt">   
  335. visitor_identity_number = fake.unique.ssn()  # </span><span style="font-size:9.0pt;
  336. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  337. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  338. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  339. 0cm;mso-font-kerning:0pt">确保唯一性</span><span lang="EN-US" style="font-size:9.0pt;
  340. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  341. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  342. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  343. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  344. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  345. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  346. padding:0cm;mso-font-kerning:0pt">   
  347. visitor_phone = fake.phone_number()<o:p></o:p></span></p>
  348. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  349. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  350. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  351. padding:0cm;mso-font-kerning:0pt">   
  352. arrival_time = fake.date_time_this_year(before_now=True,
  353. after_now=False).strftime("%Y-%m-%d %H:%M:%S")<o:p></o:p></span></p>
  354. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  355. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  356. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  357. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  358. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  359. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  360. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  361. padding:0cm;mso-font-kerning:0pt">    # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  362. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  363. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  364. padding:0cm;mso-font-kerning:0pt">使用</span><span lang="EN-US" style="font-size:
  365. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  366. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  367. padding:0cm;mso-font-kerning:0pt"> datetime </span><span style="font-size:9.0pt;
  368. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  369. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  370. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  371. 0cm;mso-font-kerning:0pt">对象生成</span><span lang="EN-US" style="font-size:9.0pt;
  372. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  373. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  374. padding:0cm;mso-font-kerning:0pt"> departure_time</span><span style="font-size:
  375. 9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  376. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  377. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  378. 0cm;mso-font-kerning:0pt">,确保格式正确</span><span lang="EN-US" style="font-size:9.0pt;
  379. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  380. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  381. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  382. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  383. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  384. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  385. padding:0cm;mso-font-kerning:0pt">   
  386. departure_time = fake.date_time_between_dates(<o:p></o:p></span></p>
  387. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  388. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  389. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  390. padding:0cm;mso-font-kerning:0pt">      
  391. datetime_start=datetime.strptime(arrival_time, "%Y-%m-%d
  392. %H:%M:%S"),<o:p></o:p></span></p>
  393. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  394. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  395. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  396. padding:0cm;mso-font-kerning:0pt">      
  397. datetime_end=datetime.now()<o:p></o:p></span></p>
  398. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  399. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  400. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  401. padding:0cm;mso-font-kerning:0pt">   
  402. ).strftime("%Y-%m-%d %H:%M:%S")<o:p></o:p></span></p>
  403. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  404. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  405. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  406. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  407. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  408. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  409. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  410. padding:0cm;mso-font-kerning:0pt">   
  411. visit_purpose = fake.sentence(nb_words=6)<o:p></o:p></span></p>
  412. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  413. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  414. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  415. padding:0cm;mso-font-kerning:0pt">    <o:p></o:p></span></p>
  416. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  417. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  418. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  419. padding:0cm;mso-font-kerning:0pt">   
  420. photo = None  # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  421. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  422. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  423. padding:0cm;mso-font-kerning:0pt">将</span><span lang="EN-US" style="font-size:
  424. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  425. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  426. padding:0cm;mso-font-kerning:0pt"> photo </span><span style="font-size:9.0pt;
  427. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  428. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  429. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  430. 0cm;mso-font-kerning:0pt">字段设置为</span><span lang="EN-US" style="font-size:9.0pt;
  431. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  432. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  433. padding:0cm;mso-font-kerning:0pt"> None<o:p></o:p></span></p>
  434. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  435. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  436. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  437. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  438. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  439. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  440. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  441. padding:0cm;mso-font-kerning:0pt">   
  442. return {<o:p></o:p></span></p>
  443. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  444. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  445. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  446. padding:0cm;mso-font-kerning:0pt">      
  447. "visitor_name": visitor_name,<o:p></o:p></span></p>
  448. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  449. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  450. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  451. padding:0cm;mso-font-kerning:0pt">      
  452. "visitor_identity_number": visitor_identity_number,<o:p></o:p></span></p>
  453. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  454. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  455. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  456. padding:0cm;mso-font-kerning:0pt">      
  457. "visitor_phone": visitor_phone,<o:p></o:p></span></p>
  458. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  459. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  460. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  461. padding:0cm;mso-font-kerning:0pt">      
  462. "arrival_time": arrival_time,<o:p></o:p></span></p>
  463. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  464. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  465. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  466. padding:0cm;mso-font-kerning:0pt">      
  467. "departure_time": departure_time,<o:p></o:p></span></p>
  468. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  469. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  470. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  471. padding:0cm;mso-font-kerning:0pt">        "visit_purpose": visit_purpose,<o:p></o:p></span></p>
  472. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  473. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  474. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  475. padding:0cm;mso-font-kerning:0pt">      
  476. "photo": photo,<o:p></o:p></span></p>
  477. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  478. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  479. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  480. padding:0cm;mso-font-kerning:0pt">      
  481. "user_identity_number": user_identity_number<o:p></o:p></span></p>
  482. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  483. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  484. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  485. padding:0cm;mso-font-kerning:0pt">    }<o:p></o:p></span></p>
  486. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  487. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  488. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  489. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  490. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  491. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  492. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  493. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  494. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  495. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  496. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  497. 0cm;mso-font-kerning:0pt">添加用户信息</span><span lang="EN-US" style="font-size:9.0pt;
  498. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  499. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  500. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  501. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  502. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  503. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  504. padding:0cm;mso-font-kerning:0pt">def add_user(user_data):<o:p></o:p></span></p>
  505. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  506. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  507. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  508. padding:0cm;mso-font-kerning:0pt">   
  509. response = requests.post(f"{base_url}/user", json=user_data)<o:p></o:p></span></p>
  510. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  511. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  512. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  513. padding:0cm;mso-font-kerning:0pt">   
  514. try:<o:p></o:p></span></p>
  515. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  516. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  517. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  518. padding:0cm;mso-font-kerning:0pt">      
  519. user_response = response.json()<o:p></o:p></span></p>
  520. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  521. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  522. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  523. padding:0cm;mso-font-kerning:0pt">   
  524. except ValueError:<o:p></o:p></span></p>
  525. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  526. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  527. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  528. padding:0cm;mso-font-kerning:0pt">      
  529. print(f"Failed to decode JSON: {response.text}")<o:p></o:p></span></p>
  530. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  531. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  532. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  533. padding:0cm;mso-font-kerning:0pt">      
  534. user_response = response.text<o:p></o:p></span></p>
  535. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  536. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  537. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  538. padding:0cm;mso-font-kerning:0pt">   
  539. return response.status_code, user_response<o:p></o:p></span></p>
  540. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  541. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  542. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  543. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  544. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  545. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  546. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  547. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  548. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  549. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  550. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  551. 0cm;mso-font-kerning:0pt">添加访客登记</span><span lang="EN-US" style="font-size:9.0pt;
  552. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  553. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  554. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  555. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  556. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  557. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  558. padding:0cm;mso-font-kerning:0pt">def add_visitor(visitor_data):<o:p></o:p></span></p>
  559. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  560. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  561. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  562. padding:0cm;mso-font-kerning:0pt">   
  563. response = requests.post(f"{base_url}/visitor",
  564. json=visitor_data)<o:p></o:p></span></p>
  565. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  566. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  567. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  568. padding:0cm;mso-font-kerning:0pt">   
  569. try:<o:p></o:p></span></p>
  570. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  571. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  572. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  573. padding:0cm;mso-font-kerning:0pt">      
  574. visitor_response = response.json()<o:p></o:p></span></p>
  575. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  576. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  577. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  578. padding:0cm;mso-font-kerning:0pt">   
  579. except ValueError:<o:p></o:p></span></p>
  580. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  581. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  582. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  583. padding:0cm;mso-font-kerning:0pt">      
  584. print(f"Failed to decode JSON: {response.text}")<o:p></o:p></span></p>
  585. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  586. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  587. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  588. padding:0cm;mso-font-kerning:0pt">      
  589. visitor_response = response.text<o:p></o:p></span></p>
  590. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  591. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  592. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  593. padding:0cm;mso-font-kerning:0pt">   
  594. return response.status_code, visitor_response<o:p></o:p></span></p>
  595. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  596. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  597. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  598. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  599. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  600. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  601. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  602. padding:0cm;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;
  603. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  604. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  605. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  606. 0cm;mso-font-kerning:0pt">模拟填充</span><span lang="EN-US" style="font-size:9.0pt;
  607. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  608. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  609. padding:0cm;mso-font-kerning:0pt"> 100 </span><span style="font-size:9.0pt;
  610. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  611. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  612. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  613. 0cm;mso-font-kerning:0pt">条用户信息和</span><span lang="EN-US" style="font-size:9.0pt;
  614. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  615. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  616. padding:0cm;mso-font-kerning:0pt"> 100 </span><span style="font-size:9.0pt;
  617. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  618. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  619. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  620. 0cm;mso-font-kerning:0pt">条访客登记信息</span><span lang="EN-US" style="font-size:9.0pt;
  621. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  622. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  623. padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  624. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  625. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  626. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  627. padding:0cm;mso-font-kerning:0pt">for i in range(100):<o:p></o:p></span></p>
  628. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  629. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  630. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  631. padding:0cm;mso-font-kerning:0pt">   
  632. try:<o:p></o:p></span></p>
  633. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  634. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  635. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  636. padding:0cm;mso-font-kerning:0pt">      
  637. print(f"</span><span style="font-size:9.0pt;font-family:宋体;
  638. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  639. Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  640. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">正在生成第</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  641. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  642. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> {i +
  643. 1} </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  644. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  645. color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  646. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">条数据</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  647. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  648. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">")<o:p></o:p></span></p>
  649. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  650. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  651. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  652. padding:0cm;mso-font-kerning:0pt">      
  653. # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  654. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  655. color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  656. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">生成并添加用户信息</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  657. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  658. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  659. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  660. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  661. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  662. padding:0cm;mso-font-kerning:0pt">      
  663. user_data = generate_user_data()<o:p></o:p></span></p>
  664. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  665. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  666. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  667. padding:0cm;mso-font-kerning:0pt">      
  668. status_code, user_response = add_user(user_data)<o:p></o:p></span></p>
  669. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  670. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  671. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  672. padding:0cm;mso-font-kerning:0pt">      
  673. print(f"</span><span style="font-size:9.0pt;font-family:宋体;
  674. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  675. Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  676. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">添加用户</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  677. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  678. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">: {user_data['identity_number']},
  679. </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  680. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  681. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  682. padding:0cm;mso-font-kerning:0pt">状态码</span><span lang="EN-US" style="font-size:
  683. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  684. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  685. padding:0cm;mso-font-kerning:0pt">: {status_code}, </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  686. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  687. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  688. padding:0cm;mso-font-kerning:0pt">响应</span><span lang="EN-US" style="font-size:
  689. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  690. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  691. padding:0cm;mso-font-kerning:0pt">: {user_response}")<o:p></o:p></span></p>
  692. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  693. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  694. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  695. padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
  696. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  697. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  698. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  699. padding:0cm;mso-font-kerning:0pt">      
  700. # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  701. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  702. color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  703. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">生成并添加访客登记信息</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  704. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  705. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
  706. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  707. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  708. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  709. padding:0cm;mso-font-kerning:0pt">      
  710. visitor_data = generate_visitor_data(user_data['identity_number'])<o:p></o:p></span></p>
  711. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  712. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  713. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  714. padding:0cm;mso-font-kerning:0pt">      
  715. status_code, visitor_response = add_visitor(visitor_data)<o:p></o:p></span></p>
  716. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  717. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  718. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  719. padding:0cm;mso-font-kerning:0pt">      
  720. print(f"</span><span style="font-size:9.0pt;font-family:宋体;
  721. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  722. Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  723. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">添加访客</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  724. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  725. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:
  726. {visitor_data['visitor_identity_number']}, </span><span style="font-size:9.0pt;
  727. font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
  728. mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
  729. border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:
  730. 0cm;mso-font-kerning:0pt">状态码</span><span lang="EN-US" style="font-size:9.0pt;
  731. font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  732. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  733. padding:0cm;mso-font-kerning:0pt">: {status_code}, </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
  734. mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
  735. mso-themecolor:background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  736. padding:0cm;mso-font-kerning:0pt">响应</span><span lang="EN-US" style="font-size:
  737. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  738. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  739. padding:0cm;mso-font-kerning:0pt">: {visitor_response}")<o:p></o:p></span></p>
  740. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  741. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  742. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  743. padding:0cm;mso-font-kerning:0pt">   
  744. except Exception as e:<o:p></o:p></span></p>
  745. <p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
  746. 9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
  747. background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
  748. padding:0cm;mso-font-kerning:0pt">      
  749. print(f"</span><span style="font-size:9.0pt;font-family:宋体;
  750. mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
  751. Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  752. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">在生成第</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  753. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  754. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> {i +
  755. 1} </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
  756. Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
  757. color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  758. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">条数据时发生错误</span><span lang="EN-US" style="font-size:9.0pt;font-family:Consolas;mso-fareast-font-family:
  759. 宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
  760. mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:
  761. {e}")<o:p></o:p></span></p>
  762. </div>
复制代码

上面的Python程序通过Faker库生成数据库对应格式的虚拟信息,根据在云服务器上设置的API接口,通过requests库发送HTTP请求,将虚拟信息添加到MySQL数据库。在运行程序前,需要通过“库管理”,添加相应库到环境。准备就绪后,运行程序查看效果。

Flask_admin—快速搭建访客登记系统Web管理后台图8

根据提示,程序已成功添加100条信息到云服务器上的MySQL数据库。

7.2 在PC浏览器再次访问“http://*.*.*.* (你的云服务器网址):5000/admin”查看虚拟数据是否正常。   

Flask_admin—快速搭建访客登记系统Web管理后台图9

         

Flask_admin—快速搭建访客登记系统Web管理后台图10

100条虚拟数据已成功生成,可以直接在Web界面进行添加、修改、查询、修改操作进一步验证API接口和后台程序是否达到预期。

8.后记

近期的三个实验,搭建了一个包括移动端、云端、PC端的应用系统框架,不过也仅限于了解基本功能,起到学习了解技术栈的作用。每一个部分都还有较大的深化和优化的空间,需要一定的学习成本。但思路理清楚了,知道什么工具能实现什么功能,也可以少走一些学习的弯路。编程学无止境,围绕自己的需求,通过看书、看视频、AI搜索等渠道,不断探索,不断动手实践,总会有所收获。   



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail