修改问题
This commit is contained in:
parent
e823be45c6
commit
9e8c8cfea8
|
|
@ -69,9 +69,22 @@ public class PlayGameController : CloudGamingControllerBase
|
||||||
{
|
{
|
||||||
PlayGameBLL playGameBLL = new PlayGameBLL(ServiceProvider, JYApi);
|
PlayGameBLL playGameBLL = new PlayGameBLL(ServiceProvider, JYApi);
|
||||||
return await playGameBLL.PlayGameHeartbeat(gameRequest.GameId);
|
return await playGameBLL.PlayGameHeartbeat(gameRequest.GameId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出游戏
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameRequest"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<BaseResponse<bool>> ExitPlayGame([FromBody] GameRequest gameRequest)
|
||||||
|
{
|
||||||
|
PlayGameBLL playGameBLL = new PlayGameBLL(ServiceProvider, JYApi);
|
||||||
|
return await playGameBLL.ExitPlayGame(gameRequest.GameId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ public class PlayGameBLL : CloudGamingBase
|
||||||
var gameResponse1 = JsonConvert.DeserializeObject<Dictionary<string, object>>(jyResponseData.ResponseContent);
|
var gameResponse1 = JsonConvert.DeserializeObject<Dictionary<string, object>>(jyResponseData.ResponseContent);
|
||||||
if (gameResponse1 != null && gameResponse1.TryGetValue("data", out var xxx))
|
if (gameResponse1 != null && gameResponse1.TryGetValue("data", out var xxx))
|
||||||
{
|
{
|
||||||
response = new BaseResponse<object>(ResponseCode.Success, "", xxx);
|
response = new BaseResponse<object>(ResponseCode.Success, "", JsonConvert.SerializeObject(xxx));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -280,7 +280,7 @@ public class PlayGameBLL : CloudGamingBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameId"></param>
|
/// <param name="gameId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ExitPlayGame(string gameId)
|
public async Task<BaseResponse<bool>> ExitPlayGame(string gameId)
|
||||||
{
|
{
|
||||||
// 检查用户是否已登录
|
// 检查用户是否已登录
|
||||||
if (_UserId == 0)
|
if (_UserId == 0)
|
||||||
|
|
@ -303,8 +303,15 @@ public class PlayGameBLL : CloudGamingBase
|
||||||
}
|
}
|
||||||
if (gameInfoCache.GameStatus != PlayGameStatus.游戏结束)
|
if (gameInfoCache.GameStatus != PlayGameStatus.游戏结束)
|
||||||
{
|
{
|
||||||
gameInfoCache.ExitPlayGame();
|
PlayGameCommonSetting playGameQueue = new PlayGameCommonSetting()
|
||||||
|
{
|
||||||
|
ScId = gameInfoCache.ScId,
|
||||||
|
Sn = gameInfoCache.Sn
|
||||||
|
};
|
||||||
|
var obj = await JYApi.StopGame(playGameQueue);
|
||||||
|
gameInfoCache.ExitPlayGame(obj);
|
||||||
}
|
}
|
||||||
|
return new BaseResponse<bool>(ResponseCode.Success, "", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,12 +98,17 @@ namespace CloudGaming.Code.Game
|
||||||
/// <param name="modenName"></param>
|
/// <param name="modenName"></param>
|
||||||
/// <param name="cpu"></param>
|
/// <param name="cpu"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool ExitPlayGame(this PlayGameUserInfo playGameUserInfo)
|
public static bool ExitPlayGame(this PlayGameUserInfo playGameUserInfo, IJYApiRespnse jYApiRespnse)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (playGameUserInfo.GameStatus != PlayGameStatus.游戏结束)
|
if (playGameUserInfo.GameStatus != PlayGameStatus.游戏结束)
|
||||||
{
|
{
|
||||||
playGameUserInfo.GameStatus = PlayGameStatus.游戏结束;
|
playGameUserInfo.GameStatus = PlayGameStatus.游戏结束;
|
||||||
|
playGameUserInfo.GameUserOperation.Add(new PlayGameUserOperation()
|
||||||
|
{
|
||||||
|
OperationDateTime = DateTime.Now,
|
||||||
|
Content = "游戏结束"
|
||||||
|
});
|
||||||
playGameUserInfo.LastDateTime = DateTime.Now;
|
playGameUserInfo.LastDateTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user