将“管理员”销毁仿真的接口从之前的清理仿真接口里独立出来,清理仿真接口仅用于仿真创建者退出时销毁仿真用

This commit is contained in:
joylink_zhangsai 2022-11-30 14:01:21 +08:00
parent 3974e96c99
commit 59cb703042
2 changed files with 10 additions and 2 deletions

View File

@ -261,6 +261,15 @@ public class SimulationV1Controller {
this.groupSimulationService.clearSimulation(group, user);
}
/**
* 销毁仿真
* 由系统管理员或老师在仿真监管功能中使用
*/
@DeleteMapping("/{simulationId}/destroy")
public void destroySimulation(@PathVariable String simulationId) {
this.groupSimulationService.clearSimulation(simulationId);
}
/**
* 加载剧本并扮演成员已发布的剧本
*/

View File

@ -510,8 +510,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
log.warn("清除的仿真[{}]不存在", group);
return;
}
if (Objects.equals(simulation.getBuildParams().getUser().getId(), user.getId()) ||
user.isAdmin()) { // 是仿真创建者或管理员可以清理
if (Objects.equals(simulation.getBuildParams().getUser().getId(), user.getId())) { // 是仿真创建者可以清理
// this.simulationLifeCycleService.destroy(simulation);
// simulationManager.destroy(simulation.getId());
clearSimulation(group);