51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
|
using Newtonsoft.Json;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using UnityEngine;
|
|||
|
//10.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ
|
|||
|
public class buyMiningContract103 : MonoBehaviour
|
|||
|
{
|
|||
|
public async Task<bool> BuyMiningContract(long contractId) // 9.1
|
|||
|
{
|
|||
|
// <><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
|||
|
Dictionary<string, string> head = new Dictionary<string, string>
|
|||
|
{
|
|||
|
{ "Authorization", Global.global.serverResponse.data.token }
|
|||
|
};
|
|||
|
|
|||
|
queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
|
|||
|
RealPlayerInfo realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();
|
|||
|
BuyMiningContractBody body = new BuyMiningContractBody();
|
|||
|
body.userId = realPlayerInfo.data.userId;
|
|||
|
body.contractId = contractId;
|
|||
|
|
|||
|
//Debug.Log(JsonConvert.SerializeObject(body)+"=====================================");
|
|||
|
// <20>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>ţ<EFBFBD><C5A3>ʿ<EFBFBD><CABF>Ϣ
|
|||
|
string response0103 = await web.SendRequest(web.URL + "/snail/mining/buyMiningContract" , "POST", JsonConvert.SerializeObject(body), head);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
Debug.Log("10.3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ" + response0103);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|||
|
BuyMiningResponse buyMiningResponse = JsonConvert.DeserializeObject<BuyMiningResponse>(response0103);
|
|||
|
bool isSucceed;
|
|||
|
if (buyMiningResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
|||
|
|
|||
|
// <20><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|||
|
return isSucceed;
|
|||
|
}
|
|||
|
}
|
|||
|
//==========<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>===========================
|
|||
|
|
|||
|
public class BuyMiningContractBody
|
|||
|
{
|
|||
|
public long contractId;
|
|||
|
public long userId;
|
|||
|
}
|
|||
|
|
|||
|
//==========<3D><><EFBFBD><EFBFBD>ֵ===========================
|
|||
|
public class BuyMiningResponse : Response
|
|||
|
{
|
|||
|
public string data;
|
|||
|
}
|