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端管理数据的实现路径。
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”文件,双击打开进行编辑。
如果只是简单的快速创建Web后台,针对这个项目,在导入Flask_admin模块后,只需在代码中添加下面这段代码就可以创建Web后台:
<div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#999999;border:
solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:#999999;border:solid windowtext 1.0pt;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:宋体;color:#999999;border:
solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
mso-font-kerning:0pt"> Flask-Admin</span><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#67CDCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#67CDCC;border:solid windowtext 1.0pt;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:宋体;color:#7EC699;border:
solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
mso-font-kerning:0pt">'MyApp'</span><span lang="EN-US" style="font-size:9.0pt;
font-family:Consolas;mso-fareast-font-family:宋体;color:#CCCCCC;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:宋体;
color:#67CDCC;border:solid windowtext 1.0pt;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:宋体;color:#7EC699;border:
solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;padding:0cm;
mso-font-kerning:0pt">'bootstrap3'</span><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:#CCCCCC;border:
solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:#CCCCCC;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
</div>
但为了进一步探索和了解Flask_admin的功能,我们在代码中使用了自定义模板、搜索、筛选等实用功能,在上一个项目的基础上,也只添加了少量代码(标红部分),完整代码如下:
<div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
flask import Flask, request, jsonify<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
flask_sqlalchemy import SQLAlchemy<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">from
sqlalchemy.exc import SQLAlchemyError<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">from flask_admin import Admin<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">from flask_admin.contrib.sqla import ModelView<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app =
Flask(__name__)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app.config['SQLALCHEMY_DATABASE_URI']
= 'mysql+pymysql://visitor:</span><span style="font-size:9.0pt;font-family:
宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">@127.0.0.1/visitor'<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">app.config['SQLALCHEMY_TRACK_MODIFICATIONS']
= False<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">db =
SQLAlchemy(app)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">class
UserInfo(db.Model):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> __tablename__ = 'user_info'<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> identity_number = db.Column(db.String(18),
primary_key=True)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> name = db.Column(db.String(50),
nullable=False)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">'),
nullable=False)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> birth_date = db.Column(db.Date,
nullable=False)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> photo = db.Column(db.LargeBinary)# </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> face_comparison_result =
db.Column(db.String(50))# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> created_at = db.Column(db.DateTime,
default=db.func.current_timestamp())# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">class
VisitorLog(db.Model):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> __tablename__ = 'visitor_log'<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> id = db.Column(db.Integer, primary_key=True,
autoincrement=True)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor_name = db.Column(db.String(50),
nullable=False)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor_identity_number =
db.Column(db.String(18), unique=True, nullable=False)# </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor_phone =
db.Column(db.String(20))# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> arrival_time = db.Column(db.DateTime,
nullable=False)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> departure_time =
db.Column(db.DateTime)# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> photo = db.Column(db.LargeBinary)# </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user_identity_number = db.Column(db.String(18),
db.ForeignKey('user_info.identity_number'))
# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> created_at = db.Column(db.DateTime,
default=db.func.current_timestamp())# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">with
app.app_context():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.create_all()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">babel = Babel(app)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:
宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">class UserInfoView(ModelView):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_labels = {<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'identity_number': '</span><span style="font-size:9.0pt;font-family:
宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> 'name':
'</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> 'sex':
'</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'birth_date': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'address': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'ethnicity': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'photo': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> 'face_comparison_result':
'</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'created_at': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">'<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> }<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_searchable_list = ['identity_number', 'name', 'sex',
'birth_date', 'address', 'ethnicity', 'face_comparison_result']<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_filters = ['sex', 'birth_date', 'created_at']<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> def
__init__(self, session, **kwargs):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
super().__init__(UserInfo, session, name='</span><span style="font-size:
9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">', **kwargs)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">class VisitorLogView(ModelView):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_labels = {<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> 'id': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'visitor_name': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'visitor_identity_number': '</span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'visitor_phone': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'arrival_time': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'departure_time': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'visit_purpose': '</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'photo': '</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
'user_identity_number': '</span><span style="font-size:9.0pt;font-family:
宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> 'created_at':
'</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">'<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> }<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_searchable_list = ['visitor_name', 'visitor_identity_number',
'visitor_phone', 'arrival_time', 'visit_purpose']<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> # </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
column_filters = ['arrival_time', 'departure_time', 'visit_purpose', 'user_identity_number',
'created_at']<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"> def
__init__(self, session, **kwargs):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">
super().__init__(VisitorLog, session, name='</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">', **kwargs)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt"># </span><span style="font-size:9.0pt;font-family:
宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"> Flask-Admin
</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">admin = Admin(app, name='</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;background:red;mso-highlight:red;mso-font-kerning:0pt">',
template_mode='bootstrap3')<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
red;mso-font-kerning:0pt">admin.add_view(UserInfoView(db.session))<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;background:red;mso-highlight:
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:
宋体;color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user',
methods=['POST'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
add_user():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> data = request.json<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> new_user = UserInfo(<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
identity_number=data['identity_number'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> name=data['name'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> sex=data['sex'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> birth_date=data['birth_date'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> address=data.get('address'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> ethnicity=data.get('ethnicity'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> photo=data.get('photo'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> )<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.add(new_user)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"}), 201<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
methods=['GET'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
get_user(identity_number):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user =
UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "identity_number": user.identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "name": user.name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "sex": user.sex,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "birth_date":
user.birth_date,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "address": user.address,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "ethnicity":
user.ethnicity,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "photo": user.photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "face_comparison_result":
user.face_comparison_result,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "created_at":
user.created_at<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> })<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
methods=['PUT'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def update_user(identity_number):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> data = request.json<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user =
UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user.birth_date = data.get('birth_date',
user.birth_date)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user.address = data.get('address',
user.address)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user.ethnicity = data.get('ethnicity',
user.ethnicity)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user.photo = data.get('photo',
user.photo)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user.face_comparison_result =
data.get('face_comparison_result', user.face_comparison_result)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/user/<identity_number>',
methods=['DELETE'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
delete_user(identity_number):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> user =
UserInfo.query.get_or_404(identity_number)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.delete(user)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/users',
methods=['GET'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
get_all_users():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> users = UserInfo.query.all()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> result = [{<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "identity_number":
user.identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "name": user.name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "sex": user.sex,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "birth_date":
user.birth_date,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "address": user.address,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "ethnicity":
user.ethnicity,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "photo": user.photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "face_comparison_result":
user.face_comparison_result,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "created_at":
user.created_at<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> } for user in users]<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify(result)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor',
methods=['POST'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
add_visitor():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> data = request.json<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> new_visitor = VisitorLog(<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor_name=data['visitor_name'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
visitor_identity_number=data['visitor_identity_number'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
visitor_phone=data.get('visitor_phone'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> arrival_time=data['arrival_time'],<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
departure_time=data.get('departure_time'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
visit_purpose=data.get('visit_purpose'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> photo=data.get('photo'),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
user_identity_number=data.get('user_identity_number')<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> )<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.add(new_visitor)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"}), 201<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
methods=['GET'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
get_visitor(id):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor =
VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "id": visitor.id,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visitor_name":
visitor.visitor_name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
"visitor_identity_number": visitor.visitor_identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visitor_phone":
visitor.visitor_phone,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "arrival_time":
visitor.arrival_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "departure_time": visitor.departure_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visit_purpose":
visitor.visit_purpose,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "photo": visitor.photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "user_identity_number":
visitor.user_identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "created_at":
visitor.created_at<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> })<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
methods=['PUT'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
update_visitor(id):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> data = request.json<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor =
VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.visitor_name =
data.get('visitor_name', visitor.visitor_name)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.visitor_identity_number =
data.get('visitor_identity_number', visitor.visitor_identity_number)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.visitor_phone =
data.get('visitor_phone', visitor.visitor_phone)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.arrival_time =
data.get('arrival_time', visitor.arrival_time)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.departure_time =
data.get('departure_time', visitor.departure_time)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.visit_purpose =
data.get('visit_purpose', visitor.visit_purpose)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.photo = data.get('photo',
visitor.photo)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor.user_identity_number =
data.get('user_identity_number', visitor.user_identity_number)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitor/<int:id>',
methods=['DELETE'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
delete_visitor(id):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitor =
VisitorLog.query.get_or_404(id)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.delete(visitor)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.commit()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"message":
"</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;border:solid windowtext 1.0pt;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:宋体;
color:white;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"})<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> db.session.rollback()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
border:solid windowtext 1.0pt;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:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">@app.route('/visitors',
methods=['GET'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">def
get_all_visitors():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> visitors = VisitorLog.query.all()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> result = [{<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "id": visitor.id,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visitor_name":
visitor.visitor_name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">
"visitor_identity_number": visitor.visitor_identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visitor_phone": visitor.visitor_phone,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "arrival_time":
visitor.arrival_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "departure_time":
visitor.departure_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "visit_purpose":
visitor.visit_purpose,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "photo": visitor.photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "user_identity_number":
visitor.user_identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> "created_at":
visitor.created_at<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> } for visitor in visitors]<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify(result)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> except SQLAlchemyError as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> return jsonify({"error":
str(e)}), 400<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">if
__name__ == '__main__':<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> app.run(debug=True)<o:p></o:p></span></p>
</div>
代码中已经包含详细的功能注释,不再展开说明。相较于简单的快速创建,这里对ModelView进行了自定义,搭配flask_babel翻译模块,实现了表头中文显示,表格内容搜索和筛选等功能。
5.重启网站中的Python项目,根据运行状态修改程序或添加模块
5.1 在上一步骤修改保存“mysqlapi.py”文件后,点击宝塔面板左侧的“网站”菜单,选择“Python项目”,重启正在进行的“mysqlapi”项目。
5.2 项目的运行状态可以通过“设置”里的“项目日志”进行查看,根据提示信息,检查修复Python程序。
5.3 如果日志提示缺少相应模块,可以通过项目操作栏的“模块”按钮,添加相应模块。此步骤需要反复操作直到程序正常运行。
6.通过浏览器访问Web后台
程序正常运行后,在PC上通过浏览器访问“http://*.*.*.* (你的云服务器网址):5000/admin”即可登录数据库管理后台。
7.创建虚拟数据进行模拟测试
至此,一个简单的访客登记系统,包括手机端、云端、PC端都已经具备。完整的测试应该是通过手机拍照识别并保存数据,然后在PC端访问Web后台查看数据。但由于项目的特殊性,需要较多的身份证和真人配合才能获得大量数据,目前暂时不具备这个测试条件。为测试数据库及API接口是否正常,我们将通过一段Python小程序创建虚拟数据进行模拟测试。
7.1在Mind+(或任意Python IDE)选择“python模式”,在“代码”模式下新建一个python程序,名称随意,输入以下代码:
<div style="mso-element:para-border-div;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm 0cm 0cm 0cm;background:#282C34">
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">import requests<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">import random<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">from faker import Faker<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">from datetime import datetime<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> Faker </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">fake = Faker("zh_CN")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"># Flask API </span><span style="font-size:
9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">base_url = "http://*.*.*.*</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;
color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:5000"<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">def random_sex():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
return random.choice(["</span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">def generate_user_data():<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
identity_number = fake.ssn()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
name = fake.name()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> sex
= random_sex()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
birth_date = fake.date_of_birth(minimum_age=18,
maximum_age=90).strftime("%Y-%m-%d")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
address = fake.address()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
ethnicity = fake.word(ext_word_list=["</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
photo = None# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> photo </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> None<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
face_comparison_result = random.choice(["</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">"])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
return {<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"identity_number": identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"name": name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"sex": sex,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"birth_date": birth_date,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"address": address,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"ethnicity": ethnicity,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"photo": photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"face_comparison_result": face_comparison_result<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> }<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">def
generate_visitor_data(user_identity_number):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_name = fake.name()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_identity_number = fake.unique.ssn()# </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_phone = fake.phone_number()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
arrival_time = fake.date_time_this_year(before_now=True,
after_now=False).strftime("%Y-%m-%d %H:%M:%S")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> datetime </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> departure_time</span><span style="font-size:
9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
departure_time = fake.date_time_between_dates(<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
datetime_start=datetime.strptime(arrival_time, "%Y-%m-%d
%H:%M:%S"),<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
datetime_end=datetime.now()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
).strftime("%Y-%m-%d %H:%M:%S")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visit_purpose = fake.sentence(nb_words=6)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> <o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
photo = None# </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> photo </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> None<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
return {<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"visitor_name": visitor_name,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"visitor_identity_number": visitor_identity_number,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"visitor_phone": visitor_phone,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"arrival_time": arrival_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"departure_time": departure_time,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> "visit_purpose": visit_purpose,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"photo": photo,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
"user_identity_number": user_identity_number<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> }<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">def add_user(user_data):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
response = requests.post(f"{base_url}/user", json=user_data)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
user_response = response.json()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
except ValueError:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"Failed to decode JSON: {response.text}")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
user_response = response.text<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
return response.status_code, user_response<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">def add_visitor(visitor_data):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
response = requests.post(f"{base_url}/visitor",
json=visitor_data)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_response = response.json()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
except ValueError:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"Failed to decode JSON: {response.text}")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_response = response.text<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
return response.status_code, visitor_response<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> 100 </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"> 100 </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">for i in range(100):<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
try:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> {i +
1} </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
user_data = generate_user_data()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
status_code, user_response = add_user(user_data)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">: {user_data['identity_number']},
</span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">: {status_code}, </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">: {user_response}")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;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;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
visitor_data = generate_visitor_data(user_data['identity_number'])<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
status_code, visitor_response = add_visitor(visitor_data)<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:
{visitor_data['visitor_identity_number']}, </span><span style="font-size:9.0pt;
font-family:宋体;mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;
mso-bidi-font-family:Consolas;color:white;mso-themecolor:background1;
border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">: {status_code}, </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Consolas;
mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;color:white;
mso-themecolor:background1;border:solid windowtext 1.0pt;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:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">: {visitor_response}")<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
except Exception as e:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border: none; padding: 0cm;"><span lang="EN-US" style="font-size:
9.0pt;font-family:Consolas;mso-fareast-font-family:宋体;color:white;mso-themecolor:
background1;border:solid windowtext 1.0pt;mso-border-alt:solid windowtext .25pt;
padding:0cm;mso-font-kerning:0pt">
print(f"</span><span style="font-size:9.0pt;font-family:宋体;
mso-ascii-font-family:Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:
Consolas;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt"> {i +
1} </span><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:
Consolas;mso-hansi-font-family:Consolas;mso-bidi-font-family:Consolas;
color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
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:
宋体;color:white;mso-themecolor:background1;border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .25pt;padding:0cm;mso-font-kerning:0pt">:
{e}")<o:p></o:p></span></p>
</div>
上面的Python程序通过Faker库生成数据库对应格式的虚拟信息,根据在云服务器上设置的API接口,通过requests库发送HTTP请求,将虚拟信息添加到MySQL数据库。在运行程序前,需要通过“库管理”,添加相应库到环境。准备就绪后,运行程序查看效果。
根据提示,程序已成功添加100条信息到云服务器上的MySQL数据库。
7.2 在PC浏览器再次访问“http://*.*.*.* (你的云服务器网址):5000/admin”查看虚拟数据是否正常。
100条虚拟数据已成功生成,可以直接在Web界面进行添加、修改、查询、修改操作进一步验证API接口和后台程序是否达到预期。
8.后记
近期的三个实验,搭建了一个包括移动端、云端、PC端的应用系统框架,不过也仅限于了解基本功能,起到学习了解技术栈的作用。每一个部分都还有较大的深化和优化的空间,需要一定的学习成本。但思路理清楚了,知道什么工具能实现什么功能,也可以少走一些学习的弯路。编程学无止境,围绕自己的需求,通过看书、看视频、AI搜索等渠道,不断探索,不断动手实践,总会有所收获。
页:
[1]