|
@@ -72,16 +72,14 @@ def save_staff_profile():
|
|
|
else:
|
|
|
try:
|
|
|
profile_info_list = json.loads(staff_profile)
|
|
|
- profile_dict = {}
|
|
|
- for profile_info in profile_info_list:
|
|
|
- field_name = profile_info['field_name']
|
|
|
- profile_dict[field_name] = profile_info['field_value']
|
|
|
-
|
|
|
+ profile_dict = {item['field_name']: item['field_value'] for item in profile_info_list}
|
|
|
affected_rows = app.staff_manager.save_staff_profile(staff_id, profile_dict)
|
|
|
+
|
|
|
if not affected_rows:
|
|
|
return wrap_response(500, msg='save staff profile failed')
|
|
|
else:
|
|
|
return wrap_response(200, msg='save staff profile success')
|
|
|
+
|
|
|
except json.decoder.JSONDecodeError:
|
|
|
return wrap_response(400, msg='profile is not a valid json')
|
|
|
|