_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Yaojiangji/MotherFuck533.cs
2024-12-13 19:37:33 +08:00

67 lines
1.6 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class MotherFuck533 : Base
{
public async Task<bool> Result(int id) //
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head118 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 请求体
QueryLottery533Body Body = new QueryLottery533Body
{
lotteryUserId = id
};
// 异步发送请求
string response118 = await web.SendRequest(web.URL + "/snail/gameLottery/lotteryOpen", "POST", JsonConvert.SerializeObject(Body), head118);
// 调试输出接收到的响应
Debug.Log("5.3.3宝箱开启 =====================" + "请求体:" + JsonConvert.SerializeObject(Body) + "||返回数据" + response118);
// 将响应反序列化为 KnightRoomList 对象
Lottery533 directlist = JsonConvert.DeserializeObject<Lottery533>(response118);
addEventPopUp(directlist.message);
// 检查反序列化是否成功
if (directlist.code==200)
{
return true;
}
else
{
return false;
}
//Debug.Log(directlist.data.UserResponseVoList.Count);
}
}
public class Lottery533 : Response
{
public int code; // 响应状态码
public string message; // 提示语
//public bool? data { get; set; }
}
public class QueryLottery533Body
{
public int lotteryUserId { get; set; }
}