[mai2] add log and adjust divMaxLength default value in annotations.

pull/1/head
MikiraSora 2022-12-17 10:57:11 +08:00
parent 191687f814
commit f15812cb9d
2 changed files with 5 additions and 3 deletions

View File

@ -85,7 +85,7 @@ public class ApiMaimai2PlayerDataController {
}
@GetMapping("config/userPhoto/divMaxLength")
public long getConfigUserPhotoDivMaxLength(@Value("${game.maimai2.userPhoto.divMaxLength:16}") long divMaxLength) {
public long getConfigUserPhotoDivMaxLength(@Value("${game.maimai2.userPhoto.divMaxLength:32}") long divMaxLength) {
return divMaxLength;
}

View File

@ -32,7 +32,7 @@ public class UploadUserPortraitHandler implements BaseHandler {
public UploadUserPortraitHandler(BasicMapper mapper,
@Value("${game.maimai2.userPhoto.enable:true}") boolean enable,
@Value("${game.maimai2.userPhoto.picSavePath:data/userPhoto}") String picSavePath,
@Value("${game.maimai2.userPhoto.divMaxLength:16}") long divMaxLength) {
@Value("${game.maimai2.userPhoto.divMaxLength:32}") long divMaxLength) {
this.mapper = mapper;
this.picSavePath = picSavePath;
this.enable = enable;
@ -63,8 +63,10 @@ public class UploadUserPortraitHandler implements BaseHandler {
int divLength = userPhoto.getDivLength();
String divData = userPhoto.getDivData();
if (divLength > divMaxLength)
if (divLength > divMaxLength) {
logger.warn(String.format("stop user %d uploading photo data because divLength(%d) > divMaxLength(%d)", userId, divLength, divMaxLength));
return "{\"returnCode\":-1,\"apiName\":\"com.sega.maimai2servlet.api.UploadUserPortraitApi\"}";
}
try {
var tmp_filename = Paths.get(picSavePath, userId + "-up.tmp");