48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
|
using Newtonsoft.Json;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class submitTemplate : MonoBehaviour
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
|
|||
|
public Dictionary<string, string> CreateHeaders()
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(Global.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 "+Global.global.loginResponse.data.access_token },
|
|||
|
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
|
|||
|
};
|
|||
|
}
|
|||
|
//<2F>ύԤ<E1BDBB><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
public async Task<SubmitTemplate> SubmitTemplate(submitTemplateBody _submitTemplateBody)
|
|||
|
{
|
|||
|
string response = await web.SendRequest(web.URL + "/game/gameRoom/reserve", "POST", JsonConvert.SerializeObject(_submitTemplateBody), CreateHeaders());
|
|||
|
Debug.Log("<22>ύԤ<E1BDBB><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>: " + response);
|
|||
|
SubmitTemplate serverData = JsonConvert.DeserializeObject<SubmitTemplate>(response);
|
|||
|
if (serverData.data == null)
|
|||
|
{
|
|||
|
Debug.Log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
|||
|
}
|
|||
|
Debug.Log(serverData.data);
|
|||
|
return serverData;
|
|||
|
}
|
|||
|
}
|
|||
|
//========<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>========================================
|
|||
|
public class submitTemplateBody
|
|||
|
{
|
|||
|
public string templateId;
|
|||
|
public string reserveDate;
|
|||
|
}
|
|||
|
//===========<3D><><EFBFBD><EFBFBD>ֵ============================================
|
|||
|
public class SubmitTemplate : Response
|
|||
|
{
|
|||
|
public string data;//++++++++++++++++++++++++++++++++++++
|
|||
|
}
|