using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; //10.6查询寻未激活的条约 public class queryMyPureContract106 : MonoBehaviour { public async Task QueryMyPureContract() { // 准备请求的头部信息,包含授权令牌 Dictionary head = new Dictionary { { "Authorization", Global.global.serverResponse.data.token } }; // 异步发送请求以获取未激活的合约信息 string response0106 = await web.SendRequest(web.URL + "/snail/mining/queryMyPureContract", "POST", "{}", head); // 调试输出接收到的响应 Debug.Log("10.6 查询未激活的合约: " + response0106); // 将响应反序列化为对象 MyPureContractResponse contractResponse = JsonConvert.DeserializeObject(response0106); // 检查返回的数据 if (contractResponse != null && contractResponse.data != null) { //foreach (var contract in contractResponse.data) //{ // // 访问合约字段 // Debug.Log($"合约 ID: {contract.id}"); // Debug.Log($"合约名称: {contract.contractName}"); // Debug.Log($"每秒奖励: {contract.eachSecondsReward}"); // Debug.Log($"合约创建时间: {contract.createTime}"); // Debug.Log($"合约更新时间: {contract.updateTime}"); // // 这里可以根据需要进行其他处理 //} } else { Debug.LogError("未能获取到合约数据!"); } } } //==============返回值=================================== public class MyPureContractResponse:Response { public List data { get; set; } } public class MyPureContract { public long id { get; set; } public long userId { get; set; } public long contractId { get; set; } public string contractName { get; set; } public long slotId { get; set; } public string miningBegin { get; set; } public string miningEnd { get; set; } public string miningNow { get; set; } public double eachSecondsReward { get; set; } public int status { get; set; } public string createTime { get; set; } public string updateTime { get; set; } } //code:200,成功 //        message:成功,提示语 //        data:合约列表 //            id:Long, 用户合约id //            userId:Long, 用户id //            contractId:Long,合约id //            contractName:String,合约名称