鲁浩 преди 10 месеца
родител
ревизия
9e9ab69a3c

+ 0 - 0
server/flaskProject/DownTask.py


+ 106 - 0
server/flaskProject/MoneyRecord.py

@@ -0,0 +1,106 @@
+from flask import jsonify
+
+import TokenUtils
+from data import MySQLTool
+from returnTemp import get_template, get_error_message
+
+
+class MoneyRecord:
+    def __init__(self, action, data, logger):
+        self.action = action
+        self.data = data
+        self.logger = logger
+
+    def money_record_router(self):
+        if self.action == "insert":
+            return self.insert()
+        elif self.action == "check":
+            return self.check()
+        else:
+            return self.test()
+
+    def insert(self):
+        print("---insert---")
+        return insert(self.data)
+
+    def check(self):
+        print("---check----")
+        return check(self.data)
+
+
+def insert(data):
+    # 检查参数是否存在
+    required_fields = ['cash_type', 'des', 'kind', 'location', 'mount', 'paytime', 'uid']
+    missing_fields = [field for field in required_fields if field not in data]
+
+    if missing_fields:
+        return get_template(2000, get_error_message(2000), {})
+
+    token = data["token"]
+    uid = data["uid"]
+    mount = data["mount"]
+    if token == "" or uid == "" or mount == "":
+        # 三个值必须存在
+        template = get_template(2000, get_error_message(2000), {})
+        return template
+    if not TokenUtils.verify_jwt_token(uid, token):
+        return get_template(2001, get_error_message(2001), {})
+    # 获取支付信息
+    kind = data["kind"]
+    mount = data["mount"]
+    des = data["des"]
+    paytime = data["paytime"]
+    cash_type = data["cash_type"]
+    location = data["location"]
+    # 插入数据
+    mysql_tool.connect()
+    columns = ['cash_type', 'des', 'kind', 'location', 'mount', 'paytime', 'uid']
+    values = [cash_type, des, kind, location, mount, paytime, uid]
+    insert_result = mysql_tool.insert(table='cash', columns=columns, values=values)
+    print(insert_result)
+    mysql_tool.disconnect()
+    return get_template(0, "记录成功", {})
+
+
+mysql_tool = MySQLTool(host='localhost', user='root', password='wyt615115@', database='apiserver')
+
+
+def check(data):
+    # 检查参数是否存在
+    required_fields = ['token', 'uid', 'start', 'end', 'type']
+    missing_fields = [field for field in required_fields if field not in data]
+
+    if missing_fields:
+        return get_template(2000, get_error_message(2000), {})
+
+    token = data["token"]
+    uid = data["uid"]
+    start = data["start"]
+    end = data["end"]
+    kindtype = data["type"]
+
+    if token == "" or uid == "" or start == "" or end == "" or kindtype == "":
+        # 三个值必须存在
+        template = get_template(2000, get_error_message(2000), {})
+        return template
+    if not TokenUtils.verify_jwt_token(uid, token):
+        return get_template(2001, get_error_message(2001), {})
+    # 组装查询参数
+    mysql_tool.connect()
+    conditions = {}
+    if kindtype != 0:
+        conditions['kind'] = kindtype
+    conditions['uid'] = uid
+    result = mysql_tool.select(table='cash', columns='*', conditions=conditions)
+    final_result = []
+    i_start = int(start)
+    i_end = int(end)
+    required_fields = ['id','cash_type', 'des', 'kind', 'location', 'mount', 'paytime', 'uid']
+    for r in result:
+        if i_start <= r[6] <= i_end:
+            temp = {}
+            for inx, val in enumerate(r):
+                temp[required_fields[inx]] = val
+            final_result.append(temp)
+    mysql_tool.disconnect()
+    return get_template(0, get_error_message(0), {"record": final_result})

+ 10 - 1
server/flaskProject/app.py

@@ -1,4 +1,6 @@
+import os
 from flask import Flask, request
+from MoneyRecord import MoneyRecord
 from user import User
 import logging
 from logging.handlers import TimedRotatingFileHandler
@@ -19,6 +21,13 @@ def user_action(action):
     return r
 
 
+@app.route('/money/<action>', methods=['POST'])
+def money_action(action):
+    data = request.get_json()
+    r = MoneyRecord(action=action, data=data, logger=logger).money_record_router()
+    return r
+
+
 class CustomLogger:
     def __init__(self, log_file):
         self.log_file = log_file
@@ -54,7 +63,7 @@ day = current_date.day
 
 # 将年月日格式化为字符串
 formatted_date = current_date.strftime("%Y-%m-%d")
-logger = CustomLogger(f'/Users/jasonphd/Desktop/gogs/JasonPhdWork/server/flaskProject/logs/{formatted_date}.log')
+logger = CustomLogger(f'{os.path.dirname(__file__)}/logs/{formatted_date}.log')
 
 
 # 自定义中间件

+ 4 - 0
server/flaskProject/logs/2024-02-23.log

@@ -37,3 +37,7 @@
 2024-02-23 INFO: url:http://127.0.0.1:5000/user/register params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'jasonphd11111'} method:POST ip:127.0.0.1
 2024-02-23 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'xixixixix'} method:POST ip:127.0.0.1
 2024-02-23 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-23 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-23 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-23 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-23 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1

+ 61 - 0
server/flaskProject/logs/2024-02-26.log

@@ -0,0 +1,61 @@
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'xixixixix'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'xixixixix'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': '1'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': '1'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token1': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token1': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token1': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind1': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind1': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': '', 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'xixixixix'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'jasonphd', 'password': 'jasonphd', 'uuid': 'xixixixix'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 12.0, 'des': '这是一瓶可乐', 'paytime': '1708916199', 'cash_type': 'CNY', 'location': '广州cbd'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 3, 'mount': 2.0, 'des': '车费', 'paytime': '1708916242', 'cash_type': 'CNY', 'location': '农场'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 1, 'mount': 22.0, 'des': '车费', 'paytime': '1708916242', 'cash_type': 'CNY', 'location': '农场'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 0} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/register params:{'login_type': '1', 'account': 'root', 'password': 'wyt615115@'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/login params:{'login_type': '1', 'account': 'root', 'password': 'wyt615115@'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/user/t params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA4NjgyMzE2fQ.xU0DZOE-RoPl0QkQnlbn-b51aZkIBM0-3U_NgoIn0ik', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708963200', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708916241', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/insert params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'kind': 3, 'mount': 1122.0, 'des': '车费', 'paytime': '1708916244', 'cash_type': 'CNY', 'location': '农场'} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708916241', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708916244', 'type': 1} method:POST ip:127.0.0.1
+2024-02-26 INFO: url:http://127.0.0.1:5000/money/check params:{'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN2YxMGViOWQtZWIwZC00ZWE2LWI2MTUtYmExOGEyNmUxNDUzIiwiZXhwIjoxNzA5NTIzMDU4fQ.NCuC2uttC1Oqo6Kh5XiNvvtcD-fknPW8JVH7W1xjdoo', 'uid': '7f10eb9d-eb0d-4ea6-b615-ba18a26e1453', 'start': '1707926400', 'end': '1708916244', 'type': 1} method:POST ip:127.0.0.1

+ 27 - 0
server/flaskProject/returnTemp.py

@@ -0,0 +1,27 @@
+def get_template(status, message, data):
+    # 构建返回模板
+    template = {
+        "status": status,
+        "message": message,
+        "data": data
+    }
+    return template
+
+
+def get_error_message(code):
+    error_messages = {
+        0: "success",
+        1001: "账号不能为空",
+        1002: "密码不能为空",
+        1003: "用户名已存在",
+        1004: "该用户暂未注册",
+        1005: "用户密码错误",
+        2000: "请求参数不完整",
+        2001: "token失效,请重新登录",
+        # 添加更多的错误码和错误信息
+    }
+
+    if code in error_messages:
+        return error_messages[code]
+    else:
+        return "未知错误"

+ 6 - 37
server/flaskProject/user.py

@@ -1,9 +1,8 @@
-from time import sleep
-
 from data import MySQLTool
 import hashlib
 import uuid
 import TokenUtils
+from returnTemp import get_template, get_error_message
 
 
 class User:
@@ -37,11 +36,8 @@ def test(data):
     token = data["token"]
     uid = data["uid"]
     newtoken = TokenUtils.generate_jwt_token(uid)
-    print(newtoken)
-    sleep(10)
     newt = TokenUtils.verify_jwt_token(uid, newtoken)
-    print(newt)
-    return "1"
+    return {"result": newt}
 
 
 def register(data):
@@ -65,7 +61,7 @@ def accountRegister(data):
         password = data["password"]
         if login_type == "" or account == "" or password == "":
             # 三个值必须存在
-            template = get_template(2004, get_error_message(2004), {})
+            template = get_template(2000, get_error_message(2000), {})
             return template
         hashed_password = hashlib.md5(password.encode()).hexdigest()
         print(hashed_password)
@@ -85,9 +81,9 @@ def accountRegister(data):
             insert_result = mysql_tool.insert(table='user', columns=columns, values=values)
             print(insert_result)
             mysql_tool.disconnect()
-            return get_template(200, "注册成功", {})
+            return get_template(0, "注册成功", {})
     else:
-        template = get_template(2004, get_error_message(2004), {})
+        template = get_template(2000, get_error_message(2000), {})
         return template
 
 
@@ -99,7 +95,7 @@ def accountLogin(data):
         password = data["password"]
         if login_type == "" or account == "" or password == "":
             # 三个值必须存在
-            template = get_template(2004, get_error_message(2004), {})
+            template = get_template(2000, get_error_message(2000), {})
             return template
         else:
             # 开始登录
@@ -153,31 +149,4 @@ def login(data):
         print("3333")
 
 
-def get_template(status, message, data):
-    # 构建返回模板
-    template = {
-        "status": status,
-        "message": message,
-        "data": data
-    }
-    return template
-
-
-def get_error_message(code):
-    error_messages = {
-        0: "success",
-        1001: "账号不能为空",
-        1002: "密码不能为空",
-        1003: "用户名已存在",
-        1004: "该用户暂未注册",
-        1005: "用户密码错误",
 
-        2000: "请求参数不完整",
-
-        # 添加更多的错误码和错误信息
-    }
-
-    if code in error_messages:
-        return error_messages[code]
-    else:
-        return "未知错误"