From eedb3574eb0c5c7f35c479447a7b6eac4c390cb0 Mon Sep 17 00:00:00 2001 From: cokie Date: Fri, 1 Mar 2024 09:27:48 +0800 Subject: [PATCH] =?UTF-8?q?:fire:=20feat:=20=E8=81=94=E8=B0=83=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../robot/domain/service/impl/RobotManagerServiceImpl.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tokisaki-server/src/main/kotlin/io/micro/server/robot/domain/service/impl/RobotManagerServiceImpl.kt b/tokisaki-server/src/main/kotlin/io/micro/server/robot/domain/service/impl/RobotManagerServiceImpl.kt index dfb00a4..0770488 100644 --- a/tokisaki-server/src/main/kotlin/io/micro/server/robot/domain/service/impl/RobotManagerServiceImpl.kt +++ b/tokisaki-server/src/main/kotlin/io/micro/server/robot/domain/service/impl/RobotManagerServiceImpl.kt @@ -291,18 +291,17 @@ class RobotManagerServiceImpl( private fun bindRobotStateChangeEvent(robot: QQRobot, context: Context) { robot.addRobotStateChangeListener { state -> - val state = when (state) { + val s = when (state) { Robot.State.Create -> RobotDO.State.Create Robot.State.LoggingIn -> RobotDO.State.LoggingIn Robot.State.LoggingFail -> RobotDO.State.LoggingFail Robot.State.Online -> RobotDO.State.Online Robot.State.Closed -> RobotDO.State.Closed } - sessionFactory.withSession { modifyRobotState(robot.id(), state) } + sessionFactory.withSession { modifyRobotState(robot.id(), s) } .runSubscriptionOn { context.runOnContext(it) } .awaitSuspending() - modifyRobotState(robot.id(), state).awaitSuspending() - robotEvent.publishRobotStateChange(robot.id(), state).awaitSuspending() + robotEvent.publishRobotStateChange(robot.id(), s).awaitSuspending() } }