提交代码
This commit is contained in:
parent
ff34574110
commit
1eb4186b58
|
|
@ -668,7 +668,7 @@ namespace CloudGaming.Code.Account
|
|||
else
|
||||
{
|
||||
userDiamondConsumeDto.ConsumeDetails = $"-{it.Consume.ToString("0.##")}{((UserCurrencyType)it.CurrencyType).ToString()}";
|
||||
userDiamondConsumeDto.DatePrompt = $"{it.CreateAt.ToString("yyyy-MM-dd HH:mm:00")} 至 {it.UpdateAt.ToString("yyyy-MM-dd HH:mm:00")}";
|
||||
userDiamondConsumeDto.DatePrompt = $"{it.CreateAt.ToString("yyyy-MM-dd HH:mm:ss")} 至 {it.UpdateAt.ToString("yyyy-MM-dd HH:mm:ss")}";
|
||||
}
|
||||
userDiamondConsumeDtos.Add(userDiamondConsumeDto);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -149,8 +149,13 @@ public class PlayGameBLL : CloudGamingBase
|
|||
var diamondNumHour = gameInfo.ConsumeDiamondNumHour / 60.0;
|
||||
if (diamondNumHour > 0)
|
||||
{
|
||||
await BalanceDeductionFee(userInfo, gameInfoCache, diamondNumHour, 0, (int)diamondNumHour * 1);
|
||||
await gameInfoCache.SaveChangesAsync(this);
|
||||
var startDiamond = (int)diamondNumHour < 1 ? 1 : (int)diamondNumHour;
|
||||
await BalanceDeductionFee(userInfo, gameInfoCache, diamondNumHour, 0, startDiamond);
|
||||
gameInfoCache.GameUserOperation.Add(new PlayGameUserOperation()
|
||||
{
|
||||
ActionId = (int)PlayGameStatus.开始游戏扣费,
|
||||
Content = $"启动游戏扣除钻石{startDiamond},游戏每分钟消耗{diamondNumHour}"
|
||||
});
|
||||
}
|
||||
var gameResponse1 = JsonConvert.DeserializeObject<Dictionary<string, object>>(jyResponseData.ResponseContent);
|
||||
if (gameResponse1 != null && gameResponse1.TryGetValue("data", out var xxx))
|
||||
|
|
@ -202,19 +207,7 @@ public class PlayGameBLL : CloudGamingBase
|
|||
{
|
||||
throw MessageBox.ErrorShow("未找到游戏信息");
|
||||
}
|
||||
// 检查用户钻石是否足够
|
||||
if (userInfo.Diamond == 0 && gameInfo.ConsumeDiamondNumHour > 0)
|
||||
{
|
||||
PlayGameCommonSetting playGameCommonSetting = new PlayGameCommonSetting()
|
||||
{
|
||||
ScId = gameInfoCache.ScId,
|
||||
Sn = gameInfoCache.Sn,
|
||||
};
|
||||
var jyResponse = await JYApi.StopGame(playGameCommonSetting);
|
||||
gameInfoCache.PlayGameUserNotDiamond(jyResponse);
|
||||
await gameInfoCache.SaveChangesAsync(this);
|
||||
throw MessageBox.Show(ResponseCode.NotMoney, "钻石不足");
|
||||
}
|
||||
|
||||
PlayGameHeartbeatResponse playGameHeartbeatResponse = new PlayGameHeartbeatResponse()
|
||||
{
|
||||
Diamond = userInfo.Diamond,
|
||||
|
|
@ -228,6 +221,22 @@ public class PlayGameBLL : CloudGamingBase
|
|||
playGameHeartbeatResponse.GameConsumeDiamond = diamondNumHour.ToString("0.##");
|
||||
var chargingAt = DateTime.Now;
|
||||
var minutes = (int)chargingAt.Subtract(gameInfoCache.LastChargingAt ?? DateTime.Now).TotalMinutes;
|
||||
if (minutes >= 1)
|
||||
{
|
||||
// 检查用户钻石是否足够
|
||||
if (userInfo.Diamond == 0 && gameInfo.ConsumeDiamondNumHour > 0)
|
||||
{
|
||||
PlayGameCommonSetting playGameCommonSetting = new PlayGameCommonSetting()
|
||||
{
|
||||
ScId = gameInfoCache.ScId,
|
||||
Sn = gameInfoCache.Sn,
|
||||
};
|
||||
var jyResponse = await JYApi.StopGame(playGameCommonSetting);
|
||||
gameInfoCache.PlayGameUserNotDiamond(jyResponse);
|
||||
await gameInfoCache.SaveChangesAsync(this);
|
||||
throw MessageBox.Show(ResponseCode.NotMoney, "钻石不足");
|
||||
}
|
||||
}
|
||||
//判断扣费时间
|
||||
if (minutes >= 1)
|
||||
{
|
||||
|
|
@ -273,7 +282,6 @@ public class PlayGameBLL : CloudGamingBase
|
|||
|
||||
//重置一下用户钻石
|
||||
playGameHeartbeatResponse.Diamond = userInfo.Diamond;
|
||||
|
||||
gameInfoCache.PlayGameHeartbeat($";累计扣除钻石*{gameInfoCache.SpendingDiamonds};用户剩余钻石*{userInfo.Diamond};当前游戏每分钟消耗钻石*{diamondNumHour.ToString("0.##")};上一次扣费时间:{gameInfoCache.LastChargingAt?.ToString("yyyy-MM-dd HH:mm:ss")}");
|
||||
await gameInfoCache.SaveChangesAsync(this);
|
||||
}
|
||||
|
|
@ -306,7 +314,7 @@ public class PlayGameBLL : CloudGamingBase
|
|||
await gameInfoCache.SaveChangesAsync(this);
|
||||
throw MessageBox.ErrorShow("扣款出现错误");
|
||||
}
|
||||
gameInfoCache.SpendingDiamonds +=gameDiamondNumHour;
|
||||
gameInfoCache.SpendingDiamonds += gameDiamondNumHour;
|
||||
userInfo.UserPlayGameTime += minutes;
|
||||
await this.SaveUserInfoCacheChangesAsync();
|
||||
gameInfoCache.CurrencyLogId = currlogId;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ public enum PlayGameStatus
|
|||
/// </summary>
|
||||
游戏掉线结束游戏 = 24,
|
||||
|
||||
/// <summary>
|
||||
/// 启动游戏扣费
|
||||
/// </summary>
|
||||
开始游戏扣费 = 25,
|
||||
// ----------------------------------------
|
||||
// 游戏结束状态 (预留空间: 40-49)
|
||||
// ----------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user