44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using Newtonsoft.Json;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using UnityEngine;
|
||
//10.7,绑定卡槽
|
||
public class bindSlot107 : MonoBehaviour
|
||
{
|
||
public async Task<bool> BindSlot(long miningUserId,long slotId)
|
||
{
|
||
// 准备请求的头部信息,包含授权令牌
|
||
Dictionary<string, string> head = new Dictionary<string, string>
|
||
{
|
||
{ "Authorization", Global.global.serverResponse.data.token }
|
||
};
|
||
BindSlotBody107 body = new BindSlotBody107();
|
||
body.slotId = slotId;
|
||
body.miningUserId = miningUserId;
|
||
// 异步发送请求以获取最新的蜗牛骑士信息
|
||
string response0107 = await web.SendRequest(web.URL + "/snail/mining/bindSlot", "POST", JsonConvert.SerializeObject(body), head);
|
||
|
||
// 调试输出接收到的响应
|
||
Debug.Log("10.7绑定卡槽" + response0107);
|
||
BindSlotResponse bindSlotResponse = JsonConvert.DeserializeObject<BindSlotResponse>(response0107);
|
||
bool isSucceed;
|
||
if (bindSlotResponse.code == 200) { isSucceed = true; }else{ isSucceed = false; }
|
||
return isSucceed;
|
||
|
||
}
|
||
}
|
||
//======请求体==========================
|
||
public class BindSlotBody107
|
||
{
|
||
public long miningUserId;
|
||
public long slotId;
|
||
}
|
||
//请求参数:header:Authorization:1.2接口返回的token
|
||
// body:miningUserId:Long,用户合约id
|
||
// slotId:Long, 卡槽id
|
||
//===========返回===============================
|
||
public class BindSlotResponse : Response
|
||
{
|
||
public string data;
|
||
} |