forked from Cookies_Github_mirror/AquaDX
[chuni] fix user item being overwritten
[api] fix set diva news
This commit is contained in:
@@ -13,7 +13,10 @@ import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -129,11 +132,11 @@ public class ApiAmazonController {
|
||||
return gameMusicService.getAll();
|
||||
}
|
||||
|
||||
@PostMapping("music/import")
|
||||
public List<Music> addMusic(@RequestBody List<Music> musicList) {
|
||||
musicList.forEach(music -> music.getLevels().forEach((integer, level) -> level.setMusic(music)));
|
||||
return gameMusicService.saveAll(musicList);
|
||||
}
|
||||
// @PostMapping("music/import")
|
||||
// public List<Music> addMusic(@RequestBody List<Music> musicList) {
|
||||
// musicList.forEach(music -> music.getLevels().forEach((integer, level) -> level.setMusic(music)));
|
||||
// return gameMusicService.saveAll(musicList);
|
||||
// }
|
||||
|
||||
private int calculateRating(int levelBase, int score) {
|
||||
if (score >= 1007500) return levelBase + 200;
|
||||
|
||||
@@ -113,7 +113,9 @@ public class ApiDivaManageController {
|
||||
|
||||
@PutMapping("news")
|
||||
public PropertyEntry updateNews(@RequestBody PropertyEntry property) {
|
||||
PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_news").orElseGet(() -> new PropertyEntry("diva_news", property.getPropertyValue()));
|
||||
PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_news")
|
||||
.orElseGet(() -> new PropertyEntry("diva_news"));
|
||||
entry.setPropertyValue(property.getPropertyValue());
|
||||
return propertyEntryRepository.save(entry);
|
||||
}
|
||||
|
||||
@@ -124,7 +126,9 @@ public class ApiDivaManageController {
|
||||
|
||||
@PutMapping("warning")
|
||||
public PropertyEntry updateWarning(@RequestBody PropertyEntry property) {
|
||||
PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_warning").orElseGet(() -> new PropertyEntry("diva_warning", property.getPropertyValue()));
|
||||
PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_warning")
|
||||
.orElseGet(() -> new PropertyEntry("diva_warning"));
|
||||
entry.setPropertyValue(property.getPropertyValue());
|
||||
return propertyEntryRepository.save(entry);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user