f75cb473 by 周伟奇

fix se bug

1 parent bb00ae7a
...@@ -62,7 +62,13 @@ class ECM: ...@@ -62,7 +62,13 @@ class ECM:
62 self.oauth_token = token 62 self.oauth_token = token
63 self.token_type = response.json().get(self.token_type_key, self.token_type) 63 self.token_type = response.json().get(self.token_type_key, self.token_type)
64 expires = response.json().get(self.expires_key, 3600) 64 expires = response.json().get(self.expires_key, 3600)
65 rh.set_ecm_token(self.oauth_token, expires) 65 if isinstance(expires, int):
66 expires_int = expires - 10
67 elif isinstance(expires, str):
68 expires_int = int(expires) - 10
69 else:
70 expires_int = 3600 - 10
71 rh.set_ecm_token(self.oauth_token, expires_int)
66 72
67 def get_oauth_token(self): 73 def get_oauth_token(self):
68 # if self.oauth_token is None: 74 # if self.oauth_token is None:
......
...@@ -2189,21 +2189,26 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -2189,21 +2189,26 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
2189 # 过期期限特殊处理 2189 # 过期期限特殊处理
2190 if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N: 2190 if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N:
2191 if no_key: 2191 if no_key:
2192 for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items(): 2192 if len(expiry_dates) == 0:
2193 expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2])
2194 if expiry_date_res == consts.RESULT_N:
2195 ocr_str = expiry_date
2196 img_path = date_img_path
2197 special_expiry_date_slice = True
2198 section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get(
2199 consts.SECTION_IMG_PATH_KEY_2, '')
2200 section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get(
2201 consts.ALL_POSITION_KEY_2, {})
2202 break
2203 else:
2204 ocr_str = empty_str 2193 ocr_str = empty_str
2205 result = consts.RESULT_Y 2194 result = consts.RESULT_N
2206 img_path = empty_str 2195 img_path = empty_str
2196 else:
2197 for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items():
2198 expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2])
2199 if expiry_date_res == consts.RESULT_N:
2200 ocr_str = expiry_date
2201 img_path = date_img_path
2202 special_expiry_date_slice = True
2203 section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get(
2204 consts.SECTION_IMG_PATH_KEY_2, '')
2205 section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get(
2206 consts.ALL_POSITION_KEY_2, {})
2207 break
2208 else:
2209 ocr_str = empty_str
2210 result = consts.RESULT_Y
2211 img_path = empty_str
2207 else: 2212 else:
2208 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '') 2213 img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '')
2209 special_expiry_date_slice = True 2214 special_expiry_date_slice = True
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!