后端部分调整
This commit is contained in:
parent
d93d7bbd17
commit
6603170081
|
@ -170,5 +170,8 @@ class TestViewSet(CustomGenericViewSet):
|
|||
},
|
||||
}
|
||||
}
|
||||
# url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token'+wxClient.token
|
||||
# print(url)
|
||||
# rt = requests.post(url=url, json=data).text
|
||||
res = wxClient.send_tem_msg(data=data)
|
||||
return Response(res)
|
||||
|
|
|
@ -68,6 +68,9 @@ class EmployeeCreateUpdateSerializer(CustomModelSerializer):
|
|||
instance = super().update(instance, validated_data)
|
||||
if settings.DAHUA_ENABLED and dhClient:
|
||||
HrmService.sync_dahua_employee(ep=instance, old_photo=old_photo)
|
||||
if instance.job_state == 20 and instance.user: # 如果离职了关闭账户
|
||||
instance.user.is_active = False
|
||||
instance.user.save()
|
||||
return instance
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ class HrmService:
|
|||
}
|
||||
)
|
||||
dhClient.request(**dhapis['person_update'], json=json_data)
|
||||
ep = cls.save(ep, data={'dh_face_card': dh_face_card})
|
||||
else:
|
||||
_, res = dhClient.request(**dhapis['person_gen_id'])
|
||||
dh_id = res['id']
|
||||
|
@ -186,12 +185,6 @@ class HrmService:
|
|||
ti.update(data)
|
||||
ep.third_info = ti
|
||||
ep.save()
|
||||
if ep.user:
|
||||
if ep.user.phone != ep.phone:
|
||||
ep.user.phone = ep.phone
|
||||
if ep.user.type != ep.type:
|
||||
ep.user.type = ep.type
|
||||
ep.user.save()
|
||||
return ep
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -3,11 +3,13 @@ from apps.hrm.errors import PHONE_EXIST
|
|||
from apps.hrm.models import Certificate, Employee
|
||||
from apps.hrm.services import HrmService
|
||||
from apps.system.models import User, UserPost
|
||||
from apps.utils.tools import ranstr
|
||||
from apps.wf.models import Ticket, Transition
|
||||
from apps.rpm.models import Rcertificate, Rfile, Rpj, Rpjcertificate, Rpjfile, Rpjmember
|
||||
from rest_framework.exceptions import ParseError
|
||||
from django.contrib.auth.hashers import make_password
|
||||
|
||||
|
||||
def bind_rpj(ticket: Ticket, transition: Transition, new_ticket_data: dict):
|
||||
rpj = Rpj.objects.get(id=new_ticket_data['rpj'])
|
||||
# ticket_data = ticket.ticket_data
|
||||
|
@ -45,10 +47,12 @@ def rpj_audit_end(ticket):
|
|||
pass
|
||||
else:
|
||||
user_e = User()
|
||||
user_e.username = 'RE_' + ranstr(10)
|
||||
user_e.name = rep.name
|
||||
user_e.phone = rep.phone
|
||||
user_e.type = 'remployee'
|
||||
user_e.password = make_password('0000')
|
||||
user_e.belong_dept = rpj_dept
|
||||
user_e.save()
|
||||
ep.user = user_e
|
||||
ep.save()
|
||||
|
|
|
@ -30,7 +30,7 @@ class WxClient:
|
|||
self.app_id = app_id
|
||||
self.app_secret = app_secret
|
||||
self.isRuning = True
|
||||
self.token = cache.get(self.app_id + '_token', None) # 普通token
|
||||
self.token = None # 普通token
|
||||
self.t = None # 线程
|
||||
self.log = {}
|
||||
self.setup()
|
||||
|
@ -45,7 +45,7 @@ class WxClient:
|
|||
_, ret = self.request(url='/cgi-bin/token', params=parmas, method='get')
|
||||
self.token = ret['access_token']
|
||||
cache.set(self.app_id + '_token', self.token, timeout=3600)
|
||||
time.sleep(4000)
|
||||
time.sleep(3000)
|
||||
|
||||
def setup(self):
|
||||
t = Thread(target=self._get_token_loop, args=(), daemon=True)
|
||||
|
|
Loading…
Reference in New Issue