| | |
| | | * @return 保存结果 |
| | | */ |
| | | @MutationMapping |
| | | public MediaSaveResponse savePlayerAvatar(@Argument Long playerId, @Argument String url, |
| | | public MediaSaveResponse savePlayerAvatar(@Argument Long playerId, @Argument String path, |
| | | @Argument String fileName, @Argument Long fileSize) { |
| | | log.info("收到保存选手头像请求,选手ID: {}", playerId); |
| | | |
| | | MediaSaveInput input = new MediaSaveInput(); |
| | | input.setTargetType("player"); |
| | | input.setTargetId(playerId); |
| | | input.setPath(url); |
| | | input.setName(fileName); |
| | | input.setPath(path); |
| | | input.setFileName(fileName); |
| | | input.setFileSize(fileSize); |
| | | input.setMediaType(1); // 头像类型 |
| | | input.setMediaType(1); // 头像默认为图片类型 |
| | | |
| | | // 从文件名中提取文件扩展名 |
| | | String fileExt = ""; |
| | | if (fileName != null && fileName.contains(".")) { |
| | | fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); |
| | | } |
| | | input.setFileExt(fileExt); |
| | | |
| | | return mediaService.saveMedia(input); |
| | | } |
| | |
| | | * @return 保存结果 |
| | | */ |
| | | @MutationMapping |
| | | public MediaSaveResponse saveActivityPlayerAttachment(@Argument Long activityPlayerId, @Argument String url, |
| | | @Argument String fileName, @Argument Long fileSize, |
| | | @Argument Integer mediaType) { |
| | | public MediaSaveResponse saveActivityPlayerAttachment(@Argument Long activityPlayerId, @Argument String path, |
| | | @Argument String fileName, @Argument Long fileSize, @Argument Integer mediaType) { |
| | | log.info("收到保存活动报名附件请求,活动报名ID: {}", activityPlayerId); |
| | | |
| | | MediaSaveInput input = new MediaSaveInput(); |
| | | input.setTargetType("activity_player"); |
| | | input.setTargetId(activityPlayerId); |
| | | input.setPath(url); |
| | | input.setName(fileName); |
| | | input.setPath(path); |
| | | input.setFileName(fileName); |
| | | input.setFileSize(fileSize); |
| | | input.setMediaType(mediaType); |
| | | |
| | | |
| | | return mediaService.saveMedia(input); |
| | | } |
| | | } |