开卡 bug

This commit is contained in:
曹前明 2022-06-23 17:20:15 +08:00
parent 1399b1dbce
commit dc660cfb77
2 changed files with 6 additions and 6 deletions

View File

@ -78,7 +78,7 @@ class HrmService:
dh_face_card = cardNumber
else:
_, res = dhClient.request(**dhapis['person_gen_id'])
personId = res['id']
dh_id = res['id']
departmentId = 1
if ep.belong_dept:
try:
@ -87,7 +87,7 @@ class HrmService:
pass
json_data = {
"service": "ehs",
"id": personId,
"id": dh_id,
"name": ep.name,
"code": ep.number,
"paperType": 111,
@ -125,11 +125,11 @@ class HrmService:
"cardNumber": cardNumber,
"category": 0,
"cardType": 0,
"personId": personId,
"personId": dh_id,
"departmentId": departmentId,
"startDate": startDate,
"endDate": endDate
}
_, res = dhClient.request(**dhapis['card_add'], json=json_data)
dh_face_card = res['id']
return {'dh_id': personId, 'dh_photo': dh_photo, 'dh_face_card': dh_face_card}
return {'dh_id': dh_id, 'dh_photo': dh_photo, 'dh_face_card': dh_face_card}

View File

@ -72,8 +72,8 @@ class DhClient:
if raise_exception:
raise APIException(**DH_REQUEST_ERROR)
return 'error', DH_REQUEST_ERROR
# if settings.DEBUG:
# print_roundtrip(r)
if settings.DEBUG:
print_roundtrip(r)
if r.status_code == 200:
ret = r.json()
if ret.get('code') == '27001007':