_xiaofang/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs

47 lines
1.7 KiB
C#
Raw Normal View History

2024-12-12 19:14:48 +08:00
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class gameRoomReserve : MonoBehaviour
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
Debug.Log("====5555=====" + GlobalData.ServerData.data.access_token);
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+GlobalData.ServerData.data.access_token },
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
};
}
//Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task<ScheduledDrillResponse> scheduledDrill(string reserveDate,string templateId)
{
ScheduledDrillBody body = new ScheduledDrillBody();
body.reserveDate= reserveDate;
//body.templateId = GlobalData.newTemplateData.data;
body.templateId=templateId;
//=====================================================================================================================================================
Debug.Log(JsonConvert.SerializeObject(body) + <><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
string response = await web.SendRequest(web.URL + "/game/gameRoom/reserve", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
Debug.Log(<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
ScheduledDrillResponse scheduledDrillResponse = JsonConvert.DeserializeObject<ScheduledDrillResponse>(response);
Debug.Log(scheduledDrillResponse.data);
return scheduledDrillResponse;
}
}
//====================================
public class ScheduledDrillBody
{
public string templateId;
public string reserveDate;
}
public class ScheduledDrillResponse : Response
{
public string data;//<2F><>
}