完成web和app权限交换-初步
This commit is contained in:
@@ -41,13 +41,22 @@ class RemoteHttpDatasource {
|
||||
},
|
||||
),
|
||||
data: {'deviceId': deviceId, 'platform': "app"});
|
||||
|
||||
print("请求权限的数据,$deviceId,");
|
||||
try {
|
||||
final data = response.data as Map<String, dynamic>;
|
||||
final success = data['success'] as bool? ?? false;
|
||||
if (success) {
|
||||
return true;
|
||||
final responseData = response.data as Map<String, dynamic>;
|
||||
debugPrint("📊 [HTTP 响应] 完整数据:$responseData");
|
||||
|
||||
// 🔥 关键:先获取响应的 data 字段,再获取 remoteControl
|
||||
final dataField = responseData['data'] as Map<String, dynamic>?;
|
||||
if (dataField != null) {
|
||||
final bool hasRemoteControl = dataField['remoteControl'] as bool? ?? false;
|
||||
|
||||
debugPrint("✅ [HTTP 响应] remoteControl=$hasRemoteControl");
|
||||
|
||||
// 🔥 直接返回 remoteControl 的布尔值
|
||||
return hasRemoteControl;
|
||||
} else {
|
||||
debugPrint("❌ [HTTP 响应] 缺少 data 字段");
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user