优化工单相关接口

This commit is contained in:
jinling.yang
2024-02-22 14:26:56 +08:00
parent 65b5f7f30a
commit 0d755a50ae
2 changed files with 19 additions and 15 deletions

View File

@@ -34,6 +34,8 @@ class Http(models.AbstractModel):
# if abs(int(datas['HTTP_TIMESTAMP']) - timestamp_str) > deltime.seconds:
# raise AuthenticationError('请求已过期')
post_time = int(datas['HTTP_TIMESTAMP'])
_logger.info('HTTP_TIMESTAMP:%s' % post_time)
_logger.info('HTTP_CHECKSTR:%s' % datas['HTTP_CHECKSTR'])
datetime_post = datetime.fromtimestamp(post_time)
datetime_now = datetime.now().replace(microsecond=0)
datetime_del = datetime_now + timedelta(seconds=5)
@@ -42,7 +44,8 @@ class Http(models.AbstractModel):
check_str = '%s%s%s' % (datas['HTTP_TOKEN'], post_time, factory_secret.sf_secret_key)
check_sf_str = hashlib.sha1(check_str.encode('utf-8')).hexdigest()
_logger.info('check_str:%s' % check_sf_str)
if check_sf_str != datas['HTTP_CHECKSTR']:
raise AuthenticationError('数据校验不通过')
_logger.info('check_sf_str:%s' % check_sf_str)
# if check_sf_str != datas['HTTP_CHECKSTR']:
# raise AuthenticationError('数据校验不通过')
else:
raise AuthenticationError('请求参数中无token')