commit
ff298081a7
@ -45,6 +45,17 @@ public class PlayResultController : BaseController<PlayResultController>
|
|||||||
Result = 1
|
Result = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fix issue caused by guest play, god knows why they send guest play data
|
||||||
|
if (request.BaidConf == 0)
|
||||||
|
{
|
||||||
|
return Ok(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await userDatumService.GetFirstUserDatumOrNull(request.BaidConf) is null)
|
||||||
|
{
|
||||||
|
Logger.LogWarning("Game uploading a non exisiting user with baid {Baid}", request.BaidConf);
|
||||||
|
}
|
||||||
|
|
||||||
var lastPlayDatetime = DateTime.ParseExact(playResultData.PlayDatetime, Constants.DATE_TIME_FORMAT,
|
var lastPlayDatetime = DateTime.ParseExact(playResultData.PlayDatetime, Constants.DATE_TIME_FORMAT,
|
||||||
CultureInfo.InvariantCulture);
|
CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
@ -168,7 +179,7 @@ public class PlayResultController : BaseController<PlayResultController>
|
|||||||
{
|
{
|
||||||
var userdata = await userDatumService.GetFirstUserDatumOrNull(request.BaidConf);
|
var userdata = await userDatumService.GetFirstUserDatumOrNull(request.BaidConf);
|
||||||
|
|
||||||
userdata.ThrowIfNull();
|
userdata.ThrowIfNull($"User data is null! Baid: {request.BaidConf}");
|
||||||
|
|
||||||
userdata.Title = playResultData.Title;
|
userdata.Title = playResultData.Title;
|
||||||
userdata.TitlePlateId = playResultData.TitleplateId;
|
userdata.TitlePlateId = playResultData.TitleplateId;
|
||||||
|
@ -59,7 +59,7 @@ public class UserDatumService : IUserDatumService
|
|||||||
public async Task<List<uint>> GetFavoriteSongIds(uint baid)
|
public async Task<List<uint>> GetFavoriteSongIds(uint baid)
|
||||||
{
|
{
|
||||||
var userDatum = await context.UserData.FindAsync(baid);
|
var userDatum = await context.UserData.FindAsync(baid);
|
||||||
userDatum.ThrowIfNull();
|
userDatum.ThrowIfNull($"User with baid: {baid} not found!");
|
||||||
|
|
||||||
using var stringStream = GZipBytesUtil.GenerateStreamFromString(userDatum.FavoriteSongsArray);
|
using var stringStream = GZipBytesUtil.GenerateStreamFromString(userDatum.FavoriteSongsArray);
|
||||||
List<uint>? result;
|
List<uint>? result;
|
||||||
@ -79,7 +79,7 @@ public class UserDatumService : IUserDatumService
|
|||||||
public async Task UpdateFavoriteSong(uint baid, uint songId, bool isFavorite)
|
public async Task UpdateFavoriteSong(uint baid, uint songId, bool isFavorite)
|
||||||
{
|
{
|
||||||
var userDatum = await context.UserData.FindAsync(baid);
|
var userDatum = await context.UserData.FindAsync(baid);
|
||||||
userDatum.ThrowIfNull();
|
userDatum.ThrowIfNull($"User with baid: {baid} not found!");
|
||||||
|
|
||||||
using var stringStream = GZipBytesUtil.GenerateStreamFromString(userDatum.FavoriteSongsArray);
|
using var stringStream = GZipBytesUtil.GenerateStreamFromString(userDatum.FavoriteSongsArray);
|
||||||
List<uint>? favoriteSongIds;
|
List<uint>? favoriteSongIds;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user