feat: update userapp views
All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 1h9m26s
All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 1h9m26s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
90c6feb5a5
commit
e57f681040
@ -116,7 +116,8 @@ class MacAddressLoginView(APIView):
|
|||||||
device = Device.objects.get(mac_address=mac_address)
|
device = Device.objects.get(mac_address=mac_address)
|
||||||
|
|
||||||
# 检查设备是否已绑定给用户
|
# 检查设备是否已绑定给用户
|
||||||
user_device = UserDevice.objects.filter(device=device).first()
|
# 按绑定时间倒序取最新绑定者作为设备归属人——"后绑的挤掉先绑的"
|
||||||
|
user_device = UserDevice.objects.filter(device=device).order_by('-bound_at').first()
|
||||||
if not user_device:
|
if not user_device:
|
||||||
logger.warning(f"Device not bound to any user: {mac_address}")
|
logger.warning(f"Device not bound to any user: {mac_address}")
|
||||||
# 返回特定 code=4010,让设备端可以识别"未绑定"状态
|
# 返回特定 code=4010,让设备端可以识别"未绑定"状态
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user