| | |
| | | package cn.flightfeather.supervision |
| | | |
| | | import cn.flightfeather.supervision.timingtask.TaskController |
| | | import cn.flightfeather.supervision.common.wx.WxTokenManager |
| | | import cn.flightfeather.supervision.bgtask.TaskController |
| | | import cn.flightfeather.supervision.websocket.VMRoomWebSocketServer |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.boot.ApplicationRunner |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication |
| | | import org.springframework.boot.runApplication |
| | | import org.springframework.context.annotation.Bean |
| | | import org.springframework.scheduling.annotation.EnableScheduling |
| | | |
| | | |
| | | @SpringBootApplication |
| | | class SupervisionApplication { |
| | | @EnableScheduling |
| | | class SupervisionApplication( |
| | | @Value("\${mode}") var mode: String, |
| | | ) { |
| | | |
| | | @Autowired |
| | | lateinit var webSocketServer: VMRoomWebSocketServer |
| | |
| | | @Autowired |
| | | lateinit var taskController: TaskController |
| | | |
| | | @Autowired |
| | | lateinit var wxTokenManager: WxTokenManager |
| | | |
| | | @Bean |
| | | fun runner() = ApplicationRunner { |
| | | webSocketServer.start() |
| | | taskController.run() |
| | | // 2023.8.20 应用于安卓app后台,后续应该合并于小程序后台 |
| | | if (mode == "proapp") { |
| | | // webSocketServer.start() |
| | | } |
| | | // 应用于微信小程序后台 |
| | | else if (mode == "pro") { |
| | | wxTokenManager.run() |
| | | webSocketServer.start() |
| | | } |
| | | println("mode: $mode") |
| | | } |
| | | } |
| | | |