修改启动游戏问题
This commit is contained in:
parent
11b033ba04
commit
e823be45c6
|
|
@ -51,7 +51,7 @@ public class PlayGameController : CloudGamingControllerBase
|
|||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<object>> PlayGameAsync([FromBody] PlayGameRequest playGameRequest)
|
||||
public async Task<BaseResponse<dynamic>> PlayGameAsync([FromBody] PlayGameRequest playGameRequest)
|
||||
{
|
||||
PlayGameBLL playGameBLL = new PlayGameBLL(ServiceProvider, JYApi);
|
||||
return await playGameBLL.PlayGameAsync(playGameRequest);
|
||||
|
|
@ -94,7 +94,7 @@ public class PlayGameController : CloudGamingControllerBase
|
|||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<bool>> CancelQueueAsync([FromBody]GameRequest gameRequest)
|
||||
public async Task<BaseResponse<bool>> CancelQueueAsync([FromBody] GameRequest gameRequest)
|
||||
{
|
||||
PlayGameBLL playGameBLL = new PlayGameBLL(ServiceProvider, JYApi);
|
||||
return await playGameBLL.CancelQueueAsync(gameRequest);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ builder.Services.AddControllers(options =>
|
|||
//options.SerializerSettings.ContractResolver = new LanguageContractResolver(builder.Services);
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";// 时间格式化
|
||||
options.SerializerSettings.Converters.Add(new StringConverter());
|
||||
// 设置序列化深度为3(这里你可以根据实际需求修改这个值)
|
||||
options.SerializerSettings.MaxDepth = 10;
|
||||
|
||||
//options.SerializerSettings.ContractResolver =
|
||||
#if !DEBUG
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"secret": "95BB717C61D1ECB0E9FB82C932CC77FF",
|
||||
"nodes": "http://124.220.55.158:94", //多个节点使用逗号分隔
|
||||
"url": "http://124.220.55.158:94",
|
||||
"env": "DEV",
|
||||
"env": "TEST",
|
||||
"UserName": "admin",
|
||||
"Password": "dbt@com@1234"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class PlayGameBLL : CloudGamingBase
|
|||
/// </summary>
|
||||
/// <param name="playGameRequest">启动游戏的请求参数</param>
|
||||
/// <returns>包含操作结果的响应对象</returns>
|
||||
public async Task<BaseResponse<object>> PlayGameAsync(PlayGameRequest playGameRequest)
|
||||
public async Task<BaseResponse<dynamic>> PlayGameAsync(PlayGameRequest playGameRequest)
|
||||
{
|
||||
// 检查用户是否已登录
|
||||
if (_UserId == 0)
|
||||
|
|
@ -112,7 +112,7 @@ public class PlayGameBLL : CloudGamingBase
|
|||
// 调用鲸云游戏启动接口
|
||||
var jyResponseData = await JYApi.PlayGame(playGameSettings);
|
||||
|
||||
var response = new BaseResponse<object>();
|
||||
var response = new BaseResponse<dynamic>();
|
||||
// 用户进入排队
|
||||
if (jyResponseData.IsLineUp)
|
||||
{
|
||||
|
|
@ -123,6 +123,7 @@ public class PlayGameBLL : CloudGamingBase
|
|||
}
|
||||
else if (jyResponseData.IsSuccess)
|
||||
{
|
||||
|
||||
// 游戏启动成功
|
||||
var gameResponse = JsonConvert.DeserializeObject<JYResponseCode<JYPlayGameModel>>(jyResponseData.ResponseContent);
|
||||
// 创建游戏记录和日志
|
||||
|
|
@ -139,8 +140,17 @@ public class PlayGameBLL : CloudGamingBase
|
|||
await Dao.DaoPhone.Context.T_User_GameList.AddAsync(userGameList);
|
||||
await Dao.DaoPhone.Context.SaveChangesAsync();
|
||||
gameInfoCache?.PlayGameStart(gameResponse?.Data?.ScId ?? 0, userGameList.Id, playGameSettings.DisplayGrade, jyResponseData);
|
||||
var gameResponse1 = JsonConvert.DeserializeObject<Dictionary<string, object>>(jyResponseData.ResponseContent);
|
||||
if (gameResponse1 != null && gameResponse1.TryGetValue("data", out var xxx))
|
||||
{
|
||||
response = new BaseResponse<object>(ResponseCode.Success, "", xxx);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = new BaseResponse<object>(ResponseCode.Success, "", jyResponseData.Data);
|
||||
}
|
||||
|
||||
}
|
||||
else // 游戏启动失败
|
||||
{
|
||||
gameInfoCache?.PlayGameError(jyResponseData);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user