浏览代码

修改了一些问题

majt 4 年之前
父节点
当前提交
1e775e7de0
共有 7 个文件被更改,包括 90 次插入14 次删除
  1. 2 1
      .gitignore
  2. 21 5
      PN532data.py
  3. 17 4
      app.py
  4. 40 0
      app.spec
  5. 0 4
      decodeChipData.py
  6. 二进制
      dist/app.exe
  7. 10 0
      templates/index.html

+ 2 - 1
.gitignore

@@ -2,4 +2,5 @@
 .idea
 *.iws
 *.iml
-*.ipr
+*.ipr
+/build/*

文件差异内容过多而无法显示
+ 21 - 5
PN532data.py


+ 17 - 4
app.py

@@ -1,19 +1,32 @@
 from flask import Flask, jsonify
 from PN532data import readChip
+import webbrowser
+from threading import Timer
+from flask import render_template
 
 app = Flask(__name__)
 
 
 @app.route('/readChip')
-def hello_world():
+def read_chip():
     try:
         result = readChip()
         print(result)
-        return jsonify({'code': 200, 'msg': '读取成功', 'data': {'list': result[0], 'chipNumber': result[1]}})
+        return jsonify({'code': 200, 'msg': '读取成功',
+                        'data': {'list': result[0], 'chipNumber': result[1], 'vaccinationCipher': result[2]}})
     except Exception as e:
         print(e)
-        return jsonify({'code': 500, 'msg': '读取失败请稍后重试'})
+        return jsonify({'code': 500, 'msg': '请见检查芯片是否放好或读卡器连接是否正常'})
+
+@app.route('/')
+def index():
+    return render_template('index.html')
+
+
+def open_browser():
+    webbrowser.open_new('http://127.0.0.1:9000/')
 
 
 if __name__ == '__main__':
-    app.run(host='0.0.0.0', port=9000, debug=True)
+    Timer(1, open_browser).start();
+    app.run(port=9000, debug=True)

+ 40 - 0
app.spec

@@ -0,0 +1,40 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+
+block_cipher = None
+
+
+a = Analysis(['app.py'],
+             pathex=['F:\\pn532_python'],
+             binaries=[],
+             datas=[],
+             hiddenimports=[],
+             hookspath=[],
+             hooksconfig={},
+             runtime_hooks=[],
+             excludes=[],
+             win_no_prefer_redirects=False,
+             win_private_assemblies=False,
+             cipher=block_cipher,
+             noarchive=False)
+pyz = PYZ(a.pure, a.zipped_data,
+             cipher=block_cipher)
+
+exe = EXE(pyz,
+          a.scripts,
+          a.binaries,
+          a.zipfiles,
+          a.datas,  
+          [],
+          name='app',
+          debug=False,
+          bootloader_ignore_signals=False,
+          strip=False,
+          upx=True,
+          upx_exclude=[],
+          runtime_tmpdir=None,
+          console=True,
+          disable_windowed_traceback=False,
+          target_arch=None,
+          codesign_identity=None,
+          entitlements_file=None )

文件差异内容过多而无法显示
+ 0 - 4
decodeChipData.py


二进制
dist/app.exe


+ 10 - 0
templates/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>PN532</title>
+</head>
+<body>
+<h1>欢饮使用evvm系统</h1>
+</body>
+</html>

部分文件因为文件数量过多而无法显示