_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/kuangChang10/queryMiningContracDetail102.cs

59 lines
1.9 KiB
C#
Raw Normal View History

2024-12-02 17:51:28 +08:00
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//10.2查询合约详情
public class queryMiningContracDetail102 : MonoBehaviour
{
public async Task<MiningContracDetail> QueryMiningContracDetail(long contractId)
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步发送请求以获取最新的蜗牛骑士信息
string response0102 = await web.SendRequest(web.URL + "/snail/mining/queryMiningContractInfo?contractId=" + contractId, "GET","{}", head);
// 调试输出接收到的响应
Debug.Log("10.2,查询合约详情" + response0102);
// 将响应反序列化为对象
MiningContracDetail miningContracDetail = JsonConvert.DeserializeObject<MiningContracDetail>(response0102);
// 返回解析后的对象
return miningContracDetail;
}
}
//================返回==============================
public class MiningContracDetail : Response
{
public MiningDetailData data;
}
public class MiningDetailData
{
public long id;
public string name;
public int status;
public double voluteCoinBuy;
public int miningDays;
public double voluteCoinReward;
public double eachSecondsReward;
public string createTime;
public string updateTime;
}
//返回参数code200成功
//        message成功提示语
//        data合约详情
//             idLong合约id
//             nameString合约名称
//             voluteCoinBuyDecimal购买合约的蜗壳
//             voluteCoinRewardDecimal合约的回报蜗壳
//             miningDaysInteger挖矿天数