Cute_demon_attacks/meng_yao/Assets/script/serveTestScript/test1.cs

325 lines
14 KiB
C#
Raw Normal View History

2024-12-06 16:18:17 +08:00
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms;
public class test1 : MonoBehaviour
{
public string token;
checkAccount checkAccount = new checkAccount();
// Start is called before the first frame update
async void Start()
{
//Register();
//Login();
//Debug.Log(MyGlobal.global.loginResponse.Data.access_token+"====================");
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeadersTologin()
{
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\"}" }
};
}
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\"}" }
};
}
// Update is called once per frame
void Update()
{
}
//=======<3D><>¼=========================================================================================================================
//public async void Login()
//{
// loginBody body = new loginBody();
// body.client_id = "app";
// body.username = "13502712157";
// body.password = "9527123";
// body.type = "code";
// //Debug.Log(JsonConvert.SerializeObject(body) + "<22><><EFBFBD><EFBFBD>=========");
// string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/login", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
// Debug.Log("<22><>¼"+response);
// loginResponse apifox = JsonConvert.DeserializeObject<loginResponse>(response);
// Debug.Log(MyGlobal.global.loginResponse.Data);
// MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
// Debug.Log(MyGlobal.global.loginResponse.Data.access_token);
// //checkAccount.CheckAccount();
//}
//===============ע<><D7A2>=======================================================================================================================
//public async void Register()
//{
// register body = new register();
// body.account = "18821995938";
// body.password = "A123456";
// body.invite_code = "";
// body.code = "9527123";
// Debug.Log(JsonConvert.SerializeObject(body) + "<22><><EFBFBD><EFBFBD>=========");
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========ͷ=========");
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/register", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
// Debug.Log("ע<><D7A2>"+response);
// RegisterResponse register = JsonConvert.DeserializeObject<RegisterResponse>(response);
// Debug.Log("=====zhuce======"+register.data.token.expires_in);
//}
//============<3D>˳<EFBFBD><CBB3><EFBFBD>¼============================================================================================
//public async void Logout()
//{
// string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/logout", "POST", "{}", CreateHeaders());
// Debug.Log("<22>˳<EFBFBD><CBB3><EFBFBD>¼"+response);
//}
//==================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>================================================================================
//public async Task<bool> SendCode()
//{
// SendCodeBody body = new SendCodeBody();
// body.account = "13502712157";
// body.scene = 0;
// //Debug.Log(JsonConvert.SerializeObject(body) + "<22><><EFBFBD><EFBFBD>=========");
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========ͷ=========");
// string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/send_code", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
// 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;
//}
//=====================<3D><>֤<EFBFBD><D6A4>У<EFBFBD><D0A3>===========================================================================
//public async Task<bool> CheckCode()
//{
// CheckCodeBody body = new CheckCodeBody();
// body.account = "13502712157";
// body.scene = 0;
// body.code = "9527123";
// //Debug.Log(JsonConvert.SerializeObject(body) + "<22><><EFBFBD><EFBFBD>=========");
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========ͷ=========");
// string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/verify", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
// Debug.Log("<22><>֤<EFBFBD><D6A4>У<EFBFBD><D0A3>"+response);
// SendCodeResponse sendCodeResponse = JsonConvert.DeserializeObject<SendCodeResponse>(response);
// bool isSucceed;
// if (sendCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
// return isSucceed;
//}
//==================<3D>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>====================================================================================
//public async Task<PlayerIndfo> PalyerInfo()
//{
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/detail", "GET", "{}", CreateHeaders());
// Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>" + response);
// PlayerIndfo playerIndfo = JsonConvert.DeserializeObject<PlayerIndfo>(response);
// Debug.Log("======"+playerIndfo.Data.account);
// return playerIndfo;
//}
//==================<3D>˺<EFBFBD>У<EFBFBD>졾ע<ECA1BE><D7A2>ǰ<EFBFBD><C7B0><EFBFBD>顿=====================================================================
//public async Task<bool> CheckAccount()
//{
// PlayerIndfo playerIndfo =await PalyerInfo();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C2B6><EFBFBD>һ<EFBFBD><D2BB>playerinfo<66><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD>ȡһ<C8A1><D2BB>PlayerInfo
// CheckAccountBody body = new CheckAccountBody();
// Debug.Log(playerIndfo.Data.account);
// body.account = playerIndfo.Data.account;
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/check_account", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
// Debug.Log("<22>˺<EFBFBD>У<EFBFBD><D0A3>" + response);
// myResponse CheckAccountResponse = JsonConvert.DeserializeObject<myResponse>(response);
// bool isSucceed;
// if (CheckAccountResponse.code == 200) { isSucceed = true; }else{ isSucceed = false; }
// return isSucceed;
//}
//======================ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>====================================================================
//public async Task<bool> ModifyTradePassword(string newPassword,string code)
//{
// ModifyTradePasswordBody body = new ModifyTradePasswordBody();
// body.code = code;
// body.password = newPassword;
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/modify_trade_password", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
// Debug.Log("ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response);
// myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
// bool isSucceed;
// if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
// return isSucceed;
//}
//=========<3D>û<EFBFBD><C3BB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>=============================================================================
//public async Task<bool> UpdatePlayerInfo(string field, string value)//<2F>س<EFBFBD><D8B3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ը<EFBFBD><D4B8><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//ֻ<>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>
//{
// string body = $"{{\"{field}\":\"{value}\"}}";
// Debug.Log("====="+body);
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/update_info", "POST", body, CreateHeaders());
// Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>" + response);
// //myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
// bool isSucceed=true;
// //if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
// return isSucceed;
//}
//===========ʵ<><CAB5><EFBFBD><EFBFBD>֤==============================================================================================
//public async Task<bool> RealNameAuthentication(string name, string identity_card_no)//<2F>س<EFBFBD><D8B3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ը<EFBFBD><D4B8><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//ֻ<>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>
//{
// RealNameBody body = new RealNameBody();
// body.name = name;
// body.identity_card_no = identity_card_no;
// Debug.Log("=====" + body);
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/certify/commit", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
// Debug.Log("ʵ<><CAB5><EFBFBD><EFBFBD>֤" + response);
// myResponse RealNameResponse = JsonConvert.DeserializeObject<myResponse>(response);
// bool isSucceed = true;
// if (RealNameResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
// return isSucceed;
//}
//===================<3D>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ========================================================================================
//public async Task<TeamInfo> TeamInfo()
//{
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders());
// Debug.Log("<22>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ" + response);
// TeamInfo teamInfo = JsonConvert.DeserializeObject<TeamInfo>(response);
// Debug.Log(teamInfo.data);
// return teamInfo;
//}
//public async Task<TeamInfoResponse> TeamInfo()
//{
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders());
// Debug.Log("<22>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ" + response);
// TeamInfoResponse teamInfo = JsonConvert.DeserializeObject<TeamInfoResponse>(response);
// Debug.Log(teamInfo.Data.Info.Nickname);
// return teamInfo;
//}
}
//====================
//public class loginBody//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//{
// public string client_id;
// public string username;
// public string password;
// public string type;
//}
//public class register//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//{
// public string account;
// public string password;
// public string invite_code;
// public string code;
//}
//============================================
//public class SendCodeBody
//{
// public string account;
// public int scene;
//}
//public class SendCodeResponse:myResponse
//{
// public string data;
//}
//============================================
//public class CheckCodeBody
//{
// public string account;
// public int scene;
// public string code;
//}
//=======<3D>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><E9B7B5>ֵ===================
//public class PlayerIndfo:myResponse
//{
// public PlayerInfoData Data;
//}
//public class PlayerInfoData
//{
// public string uid;
// public string account;
// public string nickname;
// public string avatar_url;
// public string invite_code;
// public int trade_password_status;
// public int certify_status;
// public string certify_name;
// public string identity_card_no;
// public string location;
// public int location_status;
// public long gem;
// public long gold;
// public long forge;
// public long water;
// public int level;
// public string level_name;
// public string level_icon;
//}
//============<3D>˺<EFBFBD>У<EFBFBD><D0A3>=======================================================
//public class CheckAccountBody
//{
// public string account;
//}
//============ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>===============================================
//public class ModifyTradePasswordBody
//{
// public string password;
// public string code;
//}
//================ʵ<><CAB5><EFBFBD><EFBFBD>֤=============================================
//public class RealNameBody
//{
// public string name;
// public string identity_card_no;
//}
//=========<3D>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ====================================================
//public class TeamInfoResponse
//{
// public TeamInfoData Data { get; set; }
//}
//public class TeamInfoData
//{
// public TeamInfoInfo Info { get; set; }
// public List<TeamInfoItem> Items { get; set; }
//}
//public class TeamInfoInfo
//{
// public string Uid { get; set; }
// public string Account { get; set; }
// public string Nickname { get; set; }
// public string AvatarUrl { get; set; }
// public string InviteCode { get; set; }
// public int CertifyStatus { get; set; }
// public string CreateTime { get; set; }
// public string LastLoginTime { get; set; }
// public int TeamCount { get; set; }
// public int DirectlyCount { get; set; }
// public double KpiGold { get; set; }
// public double TeamKpiGold { get; set; }
// public double TeamMinKpiGold { get; set; }
// public int Level { get; set; }
// public string LevelName { get; set; }
// public string LevelIcon { get; set; }
//}
//public class TeamInfoItem
//{
// public string Title { get; set; }
// public string Desc { get; set; }
// public double NowVal { get; set; }
// public double ReqVal { get; set; }
// public double Percentage { get; set; }
// public int Style { get; set; }
//}