59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
|
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;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//返回参数:code:200,成功
|
|||
|
// message:成功,提示语
|
|||
|
// data:合约详情
|
|||
|
// id:Long,合约id
|
|||
|
// name:String,合约名称
|
|||
|
// voluteCoinBuy:Decimal,购买合约的蜗壳
|
|||
|
// voluteCoinReward:Decimal,合约的回报蜗壳
|
|||
|
// miningDays:Integer,挖矿天数
|