diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index cd60006..995c54f 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -66,13 +66,13 @@ def init_key(): key = request.json.get("key", "").strip().strip("'").strip('"') my_wxid = request.json.get("my_wxid", "").strip().strip("'").strip('"') if not wx_path: - return ReJson(1001, body=f"wx_path is required: {wx_path}") + return ReJson(1002, body=f"wx_path is required: {wx_path}") if not os.path.exists(wx_path): - return ReJson(1002, body=f"wx_path not exists: {wx_path}") + return ReJson(1001, body=f"wx_path not exists: {wx_path}") if not key: - return ReJson(1001, body=f"key is required: {key}") + return ReJson(1002, body=f"key is required: {key}") if not my_wxid: - return ReJson(1001, body=f"my_wxid is required: {my_wxid}") + return ReJson(1002, body=f"my_wxid is required: {my_wxid}") out_path = os.path.join(g.tmp_path, "decrypted", my_wxid) if my_wxid else os.path.join(g.tmp_path, "decrypted") if os.path.exists(out_path): @@ -110,13 +110,13 @@ def init_nokey(): my_wxid = request.json.get("my_wxid", "").strip().strip("'").strip('"') if not wx_path: - return ReJson(1002) + return ReJson(1002, body=f"wx_path is required: {wx_path}") if not os.path.exists(wx_path): - return ReJson(1001, body=wx_path) + return ReJson(1001, body=f"wx_path not exists: {wx_path}") if not merge_path: - return ReJson(1002) + return ReJson(1002, body=f"merge_path is required: {merge_path}") if not my_wxid: - return ReJson(1002) + return ReJson(1002, body=f"my_wxid is required: {my_wxid}") key = read_session(g.sf, my_wxid, "key") diff --git a/pywxdump/api/rjson.py b/pywxdump/api/rjson.py index 2ebba85..2e87cf2 100644 --- a/pywxdump/api/rjson.py +++ b/pywxdump/api/rjson.py @@ -17,8 +17,8 @@ def ReJson(code: int, body: [dict, list] = None, msg: str = None, error: str = N 0: {'code': 0, 'body': body, 'msg': "success", "extra": extra}, # 100 开头代表 请求数据有问题 # 4*** 表示数据库查询结果存在异常 - 1001: {'code': 1001, 'body': body, 'msg': "请求数据格式存在错误!", "extra": extra}, - 1002: {'code': 1002, 'body': body, 'msg': "请求参数存在错误!", "extra": extra}, + 1001: {'code': 1001, 'body': body, 'msg': "请求数据格式存在错误!", "extra": extra}, # 请求数据格式存在错误,一般是数据类型错误 + 1002: {'code': 1002, 'body': body, 'msg': "请求参数存在错误!", "extra": extra}, # 请求参数存在错误,一般是缺少参数 2001: {'code': 2001, 'body': body, 'msg': "操作失败!", "extra": extra}, # 请求未能正确执行 4001: {'code': 4001, 'body': body, 'msg': "账号或密码错误!", "extra": extra}, # 表示用户没有权限(令牌、用户名、密码错误) 4003: {'code': 4003, 'body': body, 'msg': "禁止访问!", "extra": extra},