refector: 用户进入时默认一个工作类别

This commit is contained in:
caoqianming 2023-03-30 14:00:55 +08:00
parent be4a111113
commit e106fd863d
1 changed files with 5 additions and 5 deletions

View File

@ -612,10 +612,10 @@ class ConsumerRegister(APIView):
consumer.nickname = nickname
if consumer.role and consumer.role.name == '游客':
consumer.role = ConsumerRole.objects.get(name='注册用户')
# 默认工作类别是非医学Ⅲ类
# 默认一个工作类别
if not consumer.workscope:
try:
consumer.workscope = WorkScope.objects.get(name='非医学Ⅲ类')
consumer.workscope = WorkScope.objects.filter(sortnum=1).first()
except:
pass
consumer.save()
@ -628,10 +628,10 @@ class ConsumerRegister(APIView):
consumer.nickname = nickname
if consumer.role and consumer.role.name == '游客':
consumer.role = ConsumerRole.objects.get(name='注册用户')
# 默认工作类别是非医学Ⅲ类
# 默认一个工作类别
if not consumer.workscope:
try:
consumer.workscope = WorkScope.objects.get(name='非医学Ⅲ类')
consumer.workscope = WorkScope.objects.filter(sortnum=1).first()
except:
pass
consumer.save()
@ -664,7 +664,7 @@ class WxphoneRegister(APIView):
if request.user.role.name =='游客':
request.user.role = ConsumerRole.objects.get(name='注册用户')
if not request.user.workscope:
request.user.workscope = WorkScope.objects.get(name='非医学Ⅲ类')
request.user.workscope = WorkScope.objects.filter(sortnum=1).first()
request.user.save()
return Response(status=status.HTTP_200_OK)