Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart_hotel_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张宏
smart_hotel_app
Commits
b875193d
Commit
b875193d
authored
Jun 11, 2026
by
张宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6456714b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
16 deletions
+18
-16
device_control_repository.dart
lib/repositories/device_control_repository.dart
+4
-2
room_repository.dart
lib/repositories/room_repository.dart
+6
-6
room_service.dart
lib/services/room_service.dart
+4
-4
service_index_cubit.dart
lib/views/service/index/cubit/service_index_cubit.dart
+2
-2
service_room_cubit.dart
lib/views/service/room/cubit/service_room_cubit.dart
+2
-2
No files found.
lib/repositories/device_control_repository.dart
View file @
b875193d
...
@@ -16,7 +16,8 @@ class DeviceControlRepository {
...
@@ -16,7 +16,8 @@ class DeviceControlRepository {
/// 远程送电
/// 远程送电
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
powerOn
({
required
int
deviceId
})
{
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
powerOn
({
required
int
deviceId
})
{
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
'/app/device/control/powerOn'
,
// '/app/device/control/powerOn',
'/app/room/device/power/single/on'
,
data:
{
'deviceId'
:
deviceId
},
data:
{
'deviceId'
:
deviceId
},
);
);
}
}
...
@@ -24,7 +25,8 @@ class DeviceControlRepository {
...
@@ -24,7 +25,8 @@ class DeviceControlRepository {
/// 远程断电
/// 远程断电
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
powerOff
({
required
int
deviceId
})
{
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
powerOff
({
required
int
deviceId
})
{
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
'/app/device/control/powerOff'
,
// '/app/device/control/powerOff',
'/app/room/device/power/single/off'
,
data:
{
'deviceId'
:
deviceId
},
data:
{
'deviceId'
:
deviceId
},
);
);
}
}
...
...
lib/repositories/room_repository.dart
View file @
b875193d
...
@@ -40,18 +40,18 @@ class RoomRepository {
...
@@ -40,18 +40,18 @@ class RoomRepository {
}
}
/// 客房服务看板-送电
/// 客房服务看板-送电
Future
<
ResponseModel
>
powerOn
({
required
int
device
Id
})
{
Future
<
ResponseModel
>
powerOn
({
required
int
room
Id
})
{
return
DioRequest
.
instance
.
post
(
return
DioRequest
.
instance
.
post
(
'/app/room/
device/
power/on'
,
'/app/room/power/on'
,
data:
{
'
deviceId'
:
device
Id
},
data:
{
'
roomId'
:
room
Id
},
);
);
}
}
/// 客房服务看板-断电
/// 客房服务看板-断电
Future
<
ResponseModel
>
powerOff
({
required
int
device
Id
})
{
Future
<
ResponseModel
>
powerOff
({
required
int
room
Id
})
{
return
DioRequest
.
instance
.
post
(
return
DioRequest
.
instance
.
post
(
'/app/room/
device/
power/off'
,
'/app/room/power/off'
,
data:
{
'
deviceId'
:
device
Id
},
data:
{
'
roomId'
:
room
Id
},
);
);
}
}
...
...
lib/services/room_service.dart
View file @
b875193d
...
@@ -33,16 +33,16 @@ class RoomService {
...
@@ -33,16 +33,16 @@ class RoomService {
}
}
/// 送电
/// 送电
Future
<
void
>
powerOn
({
required
int
device
Id
})
async
{
Future
<
void
>
powerOn
({
required
int
room
Id
})
async
{
final
result
=
await
_repository
.
powerOn
(
deviceId:
device
Id
);
final
result
=
await
_repository
.
powerOn
(
roomId:
room
Id
);
if
(!
result
.
success
)
{
if
(!
result
.
success
)
{
throw
Exception
(
result
.
msg
);
throw
Exception
(
result
.
msg
);
}
}
}
}
/// 断电
/// 断电
Future
<
void
>
powerOff
({
required
int
device
Id
})
async
{
Future
<
void
>
powerOff
({
required
int
room
Id
})
async
{
final
result
=
await
_repository
.
powerOff
(
deviceId:
device
Id
);
final
result
=
await
_repository
.
powerOff
(
roomId:
room
Id
);
if
(!
result
.
success
)
{
if
(!
result
.
success
)
{
throw
Exception
(
result
.
msg
);
throw
Exception
(
result
.
msg
);
}
}
...
...
lib/views/service/index/cubit/service_index_cubit.dart
View file @
b875193d
...
@@ -171,7 +171,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
...
@@ -171,7 +171,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
if
(
room
==
null
)
{
if
(
room
==
null
)
{
throw
Exception
(
'未找到房间信息'
);
throw
Exception
(
'未找到房间信息'
);
}
}
await
_roomService
.
powerOn
(
device
Id:
room
[
'roomId'
]
as
int
);
await
_roomService
.
powerOn
(
room
Id:
room
[
'roomId'
]
as
int
);
emit
(
state
.
copyWith
(
isPoweringOn:
false
));
emit
(
state
.
copyWith
(
isPoweringOn:
false
));
}
catch
(
e
)
{
}
catch
(
e
)
{
emit
(
state
.
copyWith
(
isPoweringOn:
false
));
emit
(
state
.
copyWith
(
isPoweringOn:
false
));
...
@@ -187,7 +187,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
...
@@ -187,7 +187,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
if
(
room
==
null
)
{
if
(
room
==
null
)
{
throw
Exception
(
'未找到房间信息'
);
throw
Exception
(
'未找到房间信息'
);
}
}
await
_roomService
.
powerOff
(
device
Id:
room
[
'roomId'
]
as
int
);
await
_roomService
.
powerOff
(
room
Id:
room
[
'roomId'
]
as
int
);
emit
(
state
.
copyWith
(
isPoweringOff:
false
));
emit
(
state
.
copyWith
(
isPoweringOff:
false
));
}
catch
(
e
)
{
}
catch
(
e
)
{
emit
(
state
.
copyWith
(
isPoweringOff:
false
));
emit
(
state
.
copyWith
(
isPoweringOff:
false
));
...
...
lib/views/service/room/cubit/service_room_cubit.dart
View file @
b875193d
...
@@ -172,9 +172,9 @@ class ServiceRoomCubit extends Cubit<ServiceRoomState> {
...
@@ -172,9 +172,9 @@ class ServiceRoomCubit extends Cubit<ServiceRoomState> {
emit
(
state
.
copyWith
(
isTogglingPower:
true
));
emit
(
state
.
copyWith
(
isTogglingPower:
true
));
try
{
try
{
if
(
value
)
{
if
(
value
)
{
await
_service
.
powerOn
(
device
Id:
_roomId
);
await
_service
.
powerOn
(
room
Id:
_roomId
);
}
else
{
}
else
{
await
_service
.
powerOff
(
device
Id:
_roomId
);
await
_service
.
powerOff
(
room
Id:
_roomId
);
}
}
emit
(
state
.
copyWith
(
isTogglingPower:
false
,
mainPowerOn:
value
));
emit
(
state
.
copyWith
(
isTogglingPower:
false
,
mainPowerOn:
value
));
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment