fix: door_auth bulk_create id bug
This commit is contained in:
parent
af105384fe
commit
6b6175803c
|
|
@ -233,11 +233,13 @@ class HrmService:
|
||||||
# raise APIException(**DH_REQUEST_ERROR)
|
# raise APIException(**DH_REQUEST_ERROR)
|
||||||
cls.save(ep, data={'dh_dchannels': dh_dchannels})
|
cls.save(ep, data={'dh_dchannels': dh_dchannels})
|
||||||
from apps.third.models import DoorAuth
|
from apps.third.models import DoorAuth
|
||||||
|
from apps.utils.snowflake import idWorker
|
||||||
DoorAuth.objects.filter(employee=ep).delete()
|
DoorAuth.objects.filter(employee=ep).delete()
|
||||||
drs = []
|
drs = []
|
||||||
for i in dh_dchannels:
|
for i in dh_dchannels:
|
||||||
|
id = idWorker.get_id()
|
||||||
drs.append(
|
drs.append(
|
||||||
DoorAuth(employee=ep, dchannel=TDevice.objects.get(code=i)))
|
DoorAuth(id=id, employee=ep, dchannel=TDevice.objects.get(code=i)))
|
||||||
DoorAuth.objects.bulk_create(drs)
|
DoorAuth.objects.bulk_create(drs)
|
||||||
return dh_dchannels
|
return dh_dchannels
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue