Skip to content

Commit 10c051a

Browse files
committed
fix
1 parent c4e4a54 commit 10c051a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pywxdump/api/api.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ def init_key():
6666
key = request.json.get("key", "").strip().strip("'").strip('"')
6767
my_wxid = request.json.get("my_wxid", "").strip().strip("'").strip('"')
6868
if not wx_path:
69-
return ReJson(1001, body=f"wx_path is required: {wx_path}")
69+
return ReJson(1002, body=f"wx_path is required: {wx_path}")
7070
if not os.path.exists(wx_path):
71-
return ReJson(1002, body=f"wx_path not exists: {wx_path}")
71+
return ReJson(1001, body=f"wx_path not exists: {wx_path}")
7272
if not key:
73-
return ReJson(1001, body=f"key is required: {key}")
73+
return ReJson(1002, body=f"key is required: {key}")
7474
if not my_wxid:
75-
return ReJson(1001, body=f"my_wxid is required: {my_wxid}")
75+
return ReJson(1002, body=f"my_wxid is required: {my_wxid}")
7676

7777
out_path = os.path.join(g.tmp_path, "decrypted", my_wxid) if my_wxid else os.path.join(g.tmp_path, "decrypted")
7878
if os.path.exists(out_path):
@@ -110,13 +110,13 @@ def init_nokey():
110110
my_wxid = request.json.get("my_wxid", "").strip().strip("'").strip('"')
111111

112112
if not wx_path:
113-
return ReJson(1002)
113+
return ReJson(1002, body=f"wx_path is required: {wx_path}")
114114
if not os.path.exists(wx_path):
115-
return ReJson(1001, body=wx_path)
115+
return ReJson(1001, body=f"wx_path not exists: {wx_path}")
116116
if not merge_path:
117-
return ReJson(1002)
117+
return ReJson(1002, body=f"merge_path is required: {merge_path}")
118118
if not my_wxid:
119-
return ReJson(1002)
119+
return ReJson(1002, body=f"my_wxid is required: {my_wxid}")
120120

121121
key = read_session(g.sf, my_wxid, "key")
122122

pywxdump/api/rjson.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def ReJson(code: int, body: [dict, list] = None, msg: str = None, error: str = N
1717
0: {'code': 0, 'body': body, 'msg': "success", "extra": extra},
1818
# 100 开头代表 请求数据有问题
1919
# 4*** 表示数据库查询结果存在异常
20-
1001: {'code': 1001, 'body': body, 'msg': "请求数据格式存在错误!", "extra": extra},
21-
1002: {'code': 1002, 'body': body, 'msg': "请求参数存在错误!", "extra": extra},
20+
1001: {'code': 1001, 'body': body, 'msg': "请求数据格式存在错误!", "extra": extra}, # 请求数据格式存在错误,一般是数据类型错误
21+
1002: {'code': 1002, 'body': body, 'msg': "请求参数存在错误!", "extra": extra}, # 请求参数存在错误,一般是缺少参数
2222
2001: {'code': 2001, 'body': body, 'msg': "操作失败!", "extra": extra}, # 请求未能正确执行
2323
4001: {'code': 4001, 'body': body, 'msg': "账号或密码错误!", "extra": extra}, # 表示用户没有权限(令牌、用户名、密码错误)
2424
4003: {'code': 4003, 'body': body, 'msg': "禁止访问!", "extra": extra},

0 commit comments

Comments
 (0)