2024-12-06 16:18:17 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
2024-12-18 23:15:00 +08:00
|
|
|
|
//<2F><EFBFBD><F3B3A1BC><EFBFBD>
|
2024-12-06 16:18:17 +08:00
|
|
|
|
public class miningActivate : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<string, string> CreateHeaders()
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("<22><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷʱ<CDB7><CAB1>token δ<><CEB4><EFBFBD>á<EFBFBD>");
|
|
|
|
|
return new Dictionary<string, string>();
|
|
|
|
|
}
|
|
|
|
|
return new Dictionary<string, string>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
|
|
|
|
|
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-12-18 23:15:00 +08:00
|
|
|
|
public async Task<bool> MiningActivate(int id)//<2F><><EFBFBD><EFBFBD> 0:<3A><>ʯ<EFBFBD><CAAF> 1:<3A><>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD> 10:<3A><><EFBFBD>ҵ<EFBFBD> 11:<3A><><EFBFBD>ҿ<EFBFBD><D2BF><EFBFBD>
|
2024-12-06 16:18:17 +08:00
|
|
|
|
{
|
2024-12-18 23:15:00 +08:00
|
|
|
|
MiningConfigBody body = new MiningConfigBody();
|
|
|
|
|
body.id = id;
|
|
|
|
|
string response = await myWeb.SendRequest(myWeb.URL + "/api/mining/activate", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
|
|
|
|
Debug.Log("<22><EFBFBD><F3B3A1BC><EFBFBD>" + response);
|
2024-12-06 16:18:17 +08:00
|
|
|
|
//bbbb
|
2024-12-18 23:15:00 +08:00
|
|
|
|
myResponse miningActivateResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
2024-12-06 16:18:17 +08:00
|
|
|
|
//Debug.Log("======kc================" + miningConfigResponse.Data[0].Name);
|
2024-12-18 23:15:00 +08:00
|
|
|
|
bool isSucceed;
|
|
|
|
|
if (miningActivateResponse.code == 200)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>"+id+"<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
|
|
|
|
isSucceed = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>" + id + "<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>");
|
|
|
|
|
isSucceed = false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 11:33:06 +08:00
|
|
|
|
Promptmgr.Instance.PromptBubble(miningActivateResponse.message);
|
|
|
|
|
|
2024-12-18 23:15:00 +08:00
|
|
|
|
return isSucceed;
|
2024-12-06 16:18:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-18 23:15:00 +08:00
|
|
|
|
//=========================
|
|
|
|
|
public class MiningConfigBody
|
|
|
|
|
{
|
|
|
|
|
public int id;
|
|
|
|
|
}
|
|
|
|
|
|