修改问题

This commit is contained in:
zpc 2024-12-22 16:56:40 +08:00
parent 5d63401d93
commit 81794c24d2
8 changed files with 48 additions and 34 deletions

View File

@ -10,7 +10,7 @@
"secret": "95BB717C61D1ECB0E9FB82C932CC77FF",
"nodes": "http://124.220.55.158:94", //使
"url": "http://124.220.55.158:94",
"env": "TEST",
"env": "PROD",
"UserName": "admin",
"Password": "dbt@com@1234"
},

View File

@ -288,7 +288,7 @@
$jy.channelId ='@(Model.AppConfig?.GameConfig?.ChannelId ?? "")';
$jy.token = '';
$jy.ip = '@(Model.IP)';
$jy.sn ='@(Guid.NewGuid().ToString("N"))';
$jy.sn ='@(Model.Sn)';
$jy.gameId = gameId;
$jy.clientSid = userId;
@ -626,7 +626,7 @@
//window.close();
}
function start() {
async function start() {
try {
WeixinJSBridge.call('hideOptionMenu'); //隐藏右上角三个点按钮。
WeixinJSBridge.call('hideAllNonBaseMenuItem'); //隐藏所有非基础按钮接口。
@ -648,6 +648,13 @@
$("#joystick2").on("touchmove", joystickMove2);
$("#joystick2").on("touchend", joystickEnd2);
//配置(客户端)
var token= await $.get("@(Model.AppConfig?.Site?.Api ?? "")/api/PlayGame/GetToken?userId=@(Model.UserId)&sn=@(Model.Sn)");
console.log("tokentokentokentokentokentoken", token.data);
if(token==null||token.data==null||token.data.token==null){
alert("初始化失败!请刷新页面重试!!!");
return ;
}
$jy.token = token.data.token;
initGame();
setTimeout(function() {
try {

View File

@ -33,12 +33,18 @@ public class IndexModel : PageModel
///
/// </summary>
public string IP { get; set; }
/// <summary>
///
/// </summary>
public string Sn { get; set; }
/// <summary>
/// app配置
/// </summary>
public AppConfig AppConfig { get; set; }
public void OnGet(string identifier, int userId, string gameId)
{
Sn = Guid.NewGuid().ToString("N");
this.GameId = gameId;
this.UserId = userId;
if (string.IsNullOrEmpty(identifier))

View File

@ -67,30 +67,22 @@ app.UseAuthorization();
app.MapRazorPages();
app.MapGet("/qrcode/{identifier}/{userId}/{gameId}.png", async (string identifier, int userId, string gameId, IServiceProvider serviceProvider, IHttpContextAccessor httpContextAccessor) =>
{
string qrcodeContent = $"{httpContextAccessor.HttpContext.Request.Scheme}://{httpContextAccessor.HttpContext.Request.Host.ToString()}/handle/{identifier}/{userId}/{gameId}.html";
//if (!string.IsNullOrEmpty(identifier))
//{
// if (identifier.ToLower() == "cloudgaming")
// {
// identifier = "default";
// }
// var app = AppConfigurationExtend.GetAppConfigIdentifier(identifier);
// if (app != null)
// {
// var appConfig = serviceProvider.GetRequiredService<AppConfig>();
// app.ToAppConfig(appConfig);
// CloudGamingBase cloudGamingBase = new CloudGamingBase(serviceProvider);
// var gameInfo = await PlayGameExtend.GetPlayGameUserInfoOrNull(cloudGamingBase, userId, gameId);
// if (gameInfo != null)
// {
// qrcodeContent += $"/handle/{identifier}/{userId}/{gameId}";
// }
// }
//}
if (!string.IsNullOrEmpty(identifier))
{
if (identifier.ToLower() == "cloudgaming")
{
identifier = "default";
}
var app = AppConfigurationExtend.GetAppConfigIdentifier(identifier);
if (app != null)
{
qrcodeContent = $"{app.Site.Web}/handle/{identifier}/{userId}/{gameId}.html";
}
}
// 创建一个 QRCodeGenerator 实例
var qrGenerator = new QRCodeGenerator();

View File

@ -27,12 +27,13 @@ JYConnection.prototype.setTagID = function (tagID) {
*/
JYConnection.prototype.initSdk = function () {
//sdk初始化
console.log(this.channelId, this.bsUrl, this.token, this.sn, this.callback);
this.jy.sdkLoading(this.channelId, this.bsUrl, this.token, this.sn, this.callback);
};
/**
* 停止游戏
*/
/**
* 停止游戏
*/
JYConnection.prototype.stop = function () {
//停止游戏
this.jy.stop();

View File

@ -87,9 +87,9 @@ namespace CloudGaming.Code.Contract
/// <summary>
/// 查看自己的会话列表
///
/// </summary>
/// <param name="requestBase"></param>
/// <param name="parameter"></param>
/// <returns></returns>
[Post("/jyapi/myScList")]
Task<JYApiResponse<MyScListModel>> MyScList([Body(BodySerializationMethod.UrlEncoded)] JYRequestParameter parameter);

View File

@ -643,11 +643,9 @@ public class PlayGameBLL : CloudGamingBase
{
throw MessageBox.ErrorShow("未找到游戏信息");
}
JYRequestCommonParameter playGameCommonSetting = new JYRequestCommonParameter()
JYRequestCommonParameter playGameCommonSetting = new JYRequestCommonParameter(sn,userId)
{
ScId = gameInfoCache.ScId,
Sn = sn,
ClientSid = $"{userId}",
Ip = this.HttpContextAccessor.HttpContext.GetClientIpAddress()
};
var dic = await JYApi.CreateSimpleHandler(playGameCommonSetting);
@ -676,7 +674,9 @@ public class PlayGameBLL : CloudGamingBase
}
GameSettingDto gameSettingDto = new GameSettingDto()
{
HandleQrCode = $"{AppConfig.Site.Web}/qrcode/{AppConfig.Identifier}/{_UserId}/{gameId}.png"
//HandleQrCode = $"{AppConfig.Site.Web}/qrcode/{AppConfig.Identifier}/{_UserId}/{gameId}.png"
HandleQrCode = $"{AppConfig.Site.Web}/handle/{AppConfig.Identifier}/{_UserId}/{gameId}.html"
};
return gameSettingDto;
}

View File

@ -12,6 +12,14 @@ namespace CloudGaming.DtoModel.JY;
/// </summary>
public class JYRequestCommonParameter : JYRequestParameter
{
public JYRequestCommonParameter(string sn, string clientSid) : base(sn, clientSid)
{
}
public JYRequestCommonParameter(string sn, int userId) : base(sn, userId)
{
}
/// <summary>
/// 本次游戏连接会话 id
/// </summary>