|
@@ -186,8 +186,15 @@ def create_seeker_dataList(dataList):
|
|
|
eduType = item['person'].get('eduType', '')
|
|
|
birthday = item['person'].get('birthday', '')
|
|
|
if birthday:
|
|
|
- age = datetime.now().year - datetime.utcfromtimestamp(birthday / 1000).year
|
|
|
- age_range = next((value for key, value in age_ranges.items() if age in key), "未知")
|
|
|
+ try:
|
|
|
+ # 将 birthday 时间戳转换为秒
|
|
|
+ birthday_timestamp = int(birthday) / 1000
|
|
|
+ birthday_datetime = datetime.utcfromtimestamp(birthday_timestamp)
|
|
|
+ age = datetime.now().year - birthday_datetime.year
|
|
|
+ age_range = next((value for key, value in age_ranges.items() if age in key), "未知")
|
|
|
+ except ValueError as e:
|
|
|
+ current_app.logger.error(f'Invalid birthday format: {birthday}')
|
|
|
+ age_range = None
|
|
|
else:
|
|
|
age_range = None
|
|
|
|