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 }
|
|
|
|
|
};
|
|
|
|
|
|
2024-12-06 16:14:45 +08:00
|
|
|
|
Debug.Log(contractId);
|
2024-12-02 17:51:28 +08:00
|
|
|
|
|
|
|
|
|
// 异步发送请求以获取最新的蜗牛骑士信息
|
|
|
|
|
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);
|
2024-12-05 17:02:12 +08:00
|
|
|
|
Debug.Log(miningContracDetail.data.id);
|
2024-12-02 17:51:28 +08:00
|
|
|
|
// 返回解析后的对象
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//返回参数:code:200,成功
|
|
|
|
|
// message:成功,提示语
|
|
|
|
|
// data:合约详情
|
|
|
|
|
// id:Long,合约id
|
|
|
|
|
// name:String,合约名称
|
|
|
|
|
// voluteCoinBuy:Decimal,购买合约的蜗壳
|
|
|
|
|
// voluteCoinReward:Decimal,合约的回报蜗壳
|
|
|
|
|
// miningDays:Integer,挖矿天数
|