Migration and daily login change
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -20,7 +21,20 @@ namespace TOOHUCardAPI.Data.Services
|
||||
public async Task<User> LoginUser(string steamId)
|
||||
{
|
||||
_logger.LogInformation($"User {steamId} just logged in");
|
||||
return await _userRepository.GetOrCreateUser(steamId);
|
||||
User user = await _userRepository.GetOrCreateUser(steamId);
|
||||
if (user.LastDailyLoginBonus.AddDays(1) <= DateTime.Now)
|
||||
{
|
||||
user = await HandleDailyLoginBonus(user);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
private async Task<User> HandleDailyLoginBonus(User user)
|
||||
{
|
||||
user.KeyTotal += AppSettings.DailyKeyBonus;
|
||||
await _userRepository.UpdateUser(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
public async Task SaveCardGroup(string steamId, string groupKey, string groupData)
|
||||
|
||||
Reference in New Issue
Block a user