开卡 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 dh_face_card = cardNumber
else: else:
_, res = dhClient.request(**dhapis['person_gen_id']) _, res = dhClient.request(**dhapis['person_gen_id'])
personId = res['id'] dh_id = res['id']
departmentId = 1 departmentId = 1
if ep.belong_dept: if ep.belong_dept:
try: try:
@ -87,7 +87,7 @@ class HrmService:
pass pass
json_data = { json_data = {
"service": "ehs", "service": "ehs",
"id": personId, "id": dh_id,
"name": ep.name, "name": ep.name,
"code": ep.number, "code": ep.number,
"paperType": 111, "paperType": 111,
@ -125,11 +125,11 @@ class HrmService:
"cardNumber": cardNumber, "cardNumber": cardNumber,
"category": 0, "category": 0,
"cardType": 0, "cardType": 0,
"personId": personId, "personId": dh_id,
"departmentId": departmentId, "departmentId": departmentId,
"startDate": startDate, "startDate": startDate,
"endDate": endDate "endDate": endDate
} }
_, res = dhClient.request(**dhapis['card_add'], json=json_data) _, res = dhClient.request(**dhapis['card_add'], json=json_data)
dh_face_card = res['id'] 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: if raise_exception:
raise APIException(**DH_REQUEST_ERROR) raise APIException(**DH_REQUEST_ERROR)
return 'error', DH_REQUEST_ERROR return 'error', DH_REQUEST_ERROR
# if settings.DEBUG: if settings.DEBUG:
# print_roundtrip(r) print_roundtrip(r)
if r.status_code == 200: if r.status_code == 200:
ret = r.json() ret = r.json()
if ret.get('code') == '27001007': if ret.get('code') == '27001007':