Browse Source

提交代码

yulongyan_citu 1 year ago
parent
commit
d581dc34bc
3 changed files with 12 additions and 6 deletions
  1. 3 3
      app.py
  2. 9 2
      functions/solve_graph.py
  3. 0 1
      requirements.txt

+ 3 - 3
app.py

@@ -38,10 +38,10 @@ except Exception as e:
 def run_app():
     time.sleep(5)
     plat = platform.system().lower()
-    # if plat == 'windows':
-    #     app.run(host='0.0.0.0', port=3333, debug=True, use_reloader=True)
     if plat == 'windows':
-        app.run(host='0.0.0.0', port=3333, debug=False, processes=1)
+        app.run(host='0.0.0.0', port=3333, debug=True, use_reloader=True)
+    elif plat == 'linux':
+        app.run(host='0.0.0.0', port=3333, debug=False, processes=3)
 
 if __name__ == '__main__':
     run_app()

+ 9 - 2
functions/solve_graph.py

@@ -186,8 +186,15 @@ def create_seeker_dataList(dataList):
                 eduType = item['person'].get('eduType', '')
                 birthday = item['person'].get('birthday', '')
                 if birthday:
-                    age = datetime.now().year - datetime.utcfromtimestamp(birthday / 1000).year
-                    age_range = next((value for key, value in age_ranges.items() if age in key), "未知")
+                    try:
+                        # 将 birthday 时间戳转换为秒
+                        birthday_timestamp = int(birthday) / 1000
+                        birthday_datetime = datetime.utcfromtimestamp(birthday_timestamp)
+                        age = datetime.now().year - birthday_datetime.year
+                        age_range = next((value for key, value in age_ranges.items() if age in key), "未知")
+                    except ValueError as e:
+                        current_app.logger.error(f'Invalid birthday format: {birthday}')
+                        age_range = None
                 else:
                     age_range = None
 

+ 0 - 1
requirements.txt

@@ -72,7 +72,6 @@ pylint==2.16.2
 PySocks==1.7.1
 python-nacos==0.1.1
 pytz==2021.3
-pywin32==306
 requests==2.31.0
 six==1.16.0
 sniffio==1.3.1