Skip to content

Commit 4701083

Browse files
committed
* 初始化的时候就需要校验feature id 是否存在
1 parent 0c8210e commit 4701083

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
### 更新日志
22

3-
#### PyLdkV1.1.3 - 2023-05-08
4-
* 支持自定义授权ID登录
5-
* 自动打包使用最新的ubuntu
3+
#### PyLdkV1.1.4 - 2023-05-08
4+
* 初始化的时候就需要校验feature id 是否存在
65
---
76

7+
88
<details onclose>
99
<summary>查看更多更新日志</summary>
1010

11+
#### PyLdkV1.1.3 - 2023-05-08
12+
* 支持自定义授权ID登录
13+
* 自动打包使用最新的ubuntu
14+
---
15+
1116
#### PyLdkV1.1.2 - 2023-03-24
1217
* login直接返回haspStruct
1318
---

pyldk/pyldk.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ def get_feature_id(self):
3737
feature_id = self.adapter.get_info()
3838
return feature_id
3939

40-
def login(self):
40+
def login(self,feature_id=None):
4141
## 首先判断加密狗是否存在
4242
login_status = False
43-
haspStruct = self.adapter.login(0)
44-
feature_id = 0
43+
if feature_id is None:
44+
feature_id = 0
45+
haspStruct = self.adapter.login(feature_id)
4546
if haspStruct.status == 0:
4647
self.adapter.logout(haspStruct.handle)
47-
feature_id = self.get_feature_id()
48+
if feature_id == 0:
49+
feature_id = self.get_feature_id()
4850
haspStruct = self.adapter.login(feature_id)
4951
if haspStruct.status == 0:
5052
if feature_id > 0:
@@ -55,8 +57,8 @@ def login(self):
5557
else:
5658
self.adapter.log("加密狗初始化失败",haspStruct.status)
5759
else:
58-
self.adapter.show_staus("加密狗初始化失败", haspStruct.status)
59-
return haspStruct,feature_id
60+
self.adapter.show_staus("加密狗初始化失败", haspStruct.status,feature_id)
61+
return haspStruct,feature_id,login_status
6062

6163

6264
def get_ldk(self,feature_id):

0 commit comments

Comments
 (0)