增加截图上传,图片地址优化
This commit is contained in:
@@ -46,6 +46,8 @@ public class UserController {
|
||||
private DeviceApkInfoService deviceApkInfoService;
|
||||
@Autowired
|
||||
private ApkIconService apkIconService;
|
||||
@Autowired
|
||||
private ScreenshotService screenshotService;
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(LoginController.class);
|
||||
|
||||
@@ -262,7 +264,7 @@ public class UserController {
|
||||
) throws ExecutionException, InterruptedException {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("package_name", packageName);
|
||||
switch (action){
|
||||
switch (action) {
|
||||
case "open":
|
||||
DevicePushUtils.aliyunAsyncPush(PushIdConfig.OPEN_APP, sn, GsonUtils.toJSONString(params));
|
||||
break;
|
||||
@@ -280,4 +282,44 @@ public class UserController {
|
||||
}
|
||||
return Result.ok().message("success");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/screen_snapshot")
|
||||
public Result screenSnapshot(@RequestParam String sn) throws ExecutionException, InterruptedException {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("sn", sn);
|
||||
params.put("timestamp", System.currentTimeMillis());
|
||||
DevicePushUtils.aliyunAsyncPush(PushIdConfig.SCREEN_SNAPSHOT, sn, GsonUtils.toJSONString(params));
|
||||
return Result.ok().message("success");
|
||||
}
|
||||
|
||||
@GetMapping("/get_snapshot")
|
||||
public Result getScreenSnapshot(@RequestParam String sn) {
|
||||
List<ScreenshotInfo> screenSnapshot = screenshotService.findBySn(sn);
|
||||
if (screenSnapshot == null) {
|
||||
return Result.notFound().message("Screen snapshot not found");
|
||||
}
|
||||
return Result.ok().data(screenSnapshot);
|
||||
}
|
||||
|
||||
@PostMapping("/delete_all_snapshot")
|
||||
public Result deleteAllScreenSnapshot(@RequestParam String sn) {
|
||||
screenshotService.deleteAllBySn(sn);
|
||||
return Result.ok().message("success");
|
||||
}
|
||||
|
||||
@PostMapping("/delete_snapshot")
|
||||
public Result deleteScreenSnapshot(@RequestParam String sn, @RequestParam Long id) {
|
||||
if (screenshotService.existsBySnAndId(sn, id)) {
|
||||
boolean deleteSuccess = screenshotService.deleteBySnAndId(sn, id);
|
||||
if (deleteSuccess) {
|
||||
logger.info("deleteScreenSnapshot success, sn: {}, id: {}", sn, id);
|
||||
} else {
|
||||
logger.info("deleteScreenSnapshot fail, sn: {}, id: {}", sn, id);
|
||||
}
|
||||
} else {
|
||||
logger.info("deleteScreenSnapshot not found, sn: {}, id: {}", sn, id);
|
||||
}
|
||||
return Result.ok().message("success");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user