支持已绑定设备追加 NFC 卡
This commit is contained in:
@@ -475,7 +475,7 @@ class TalkingQMQTTService:
|
||||
await self._publish(topic, payload)
|
||||
return
|
||||
|
||||
is_owner = await card_service.check_card_ownership(nfc_uuid, device_id)
|
||||
is_owner = await card_service.is_active_for_device(nfc_uuid, device_id)
|
||||
if is_owner:
|
||||
playback_items = await pending_voice_message_service.get_playback_items(
|
||||
target_device_id=device_id,
|
||||
@@ -534,10 +534,17 @@ class TalkingQMQTTService:
|
||||
return
|
||||
|
||||
existing_card = await card_service.get_card_by_uuid(nfc_uuid)
|
||||
if existing_card:
|
||||
if existing_card and existing_card.device_id and int(existing_card.status) == 1:
|
||||
target_device_id = existing_card.device_id
|
||||
else:
|
||||
await card_service.activate_card(nfc_uuid, device_id)
|
||||
payload = {
|
||||
"msg_id": "005",
|
||||
"type": 0,
|
||||
"params": {
|
||||
"url_1": f"http://{settings.server_host}:{settings.server_port}/assets/audio/error_card.mp3"
|
||||
},
|
||||
}
|
||||
await self._publish(topic, payload)
|
||||
return
|
||||
|
||||
await device_target_cache.set_target(device_id, target_device_id)
|
||||
|
||||
Reference in New Issue
Block a user