2024-12-06 16:18:17 +08:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>
|
|
|
|
|
public class sendCode : MonoBehaviour
|
|
|
|
|
{
|
2024-12-13 22:28:16 +08:00
|
|
|
|
public Dictionary<string, string> CreateHeadersTologin()
|
2024-12-06 16:18:17 +08:00
|
|
|
|
{
|
|
|
|
|
return new Dictionary<string, string>
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-13 22:28:16 +08:00
|
|
|
|
//{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
|
2024-12-06 16:18:17 +08:00
|
|
|
|
{ "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-06 17:09:43 +08:00
|
|
|
|
public async Task<bool> SendCode(SendCodeBody body)
|
2024-12-06 16:18:17 +08:00
|
|
|
|
{
|
2024-12-06 17:09:43 +08:00
|
|
|
|
//SendCodeBody body = new SendCodeBody();
|
|
|
|
|
//body.account = "13502712157";
|
|
|
|
|
//body.scene = 0;
|
2024-12-06 16:18:17 +08:00
|
|
|
|
//Debug.Log(JsonConvert.SerializeObject(body) + "<22><><EFBFBD><EFBFBD>=========");
|
|
|
|
|
//Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========ͷ=========");
|
2024-12-13 22:28:16 +08:00
|
|
|
|
string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/send_code", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
|
2024-12-06 16:18:17 +08:00
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>" + response);
|
|
|
|
|
SendCodeResponse sendCode = JsonConvert.DeserializeObject<SendCodeResponse>(response);
|
|
|
|
|
myResponse CheckCodeResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
|
|
|
|
bool isSucceed;
|
|
|
|
|
if (CheckCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
|
|
|
|
return isSucceed;
|
|
|
|
|
}
|
|
|
|
|
}
|