| | |
| | | return R.error("截图失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重启设备上的应用 |
| | | */ |
| | | @RequestMapping(value = "/tvDevice/restartApp/{id}/auth", method = RequestMethod.POST) |
| | | @ManagerAuth |
| | | public R restartApp(@PathVariable("id") Long id, @RequestBody(required = false) JSONObject param) { |
| | | try { |
| | | String packageName = param != null ? param.getString("packageName") : null; |
| | | String result = tvDeviceService.restartApp(id, packageName); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("result", result); |
| | | data.put("device", tvDeviceService.selectById(id)); |
| | | return R.ok(data); |
| | | } catch (Exception e) { |
| | | return R.error("重启失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 批量重启设备上的应用 |
| | | */ |
| | | @RequestMapping(value = "/tvDevice/batchRestartApp/auth", method = RequestMethod.POST) |
| | | @ManagerAuth |
| | | public R batchRestartApp(@RequestBody JSONObject param) { |
| | | try { |
| | | List<Long> deviceIds = param.getJSONArray("deviceIds").toJavaList(Long.class); |
| | | String packageName = param.getString("packageName"); |
| | | |
| | | if (deviceIds == null || deviceIds.isEmpty()) { |
| | | return R.error("请选择设备"); |
| | | } |
| | | |
| | | List<String> results = tvDeviceService.batchRestartApp(deviceIds, packageName); |
| | | return R.ok(results); |
| | | } catch (Exception e) { |
| | | return R.error("重启失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | } |