Cute_demon_attacks/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs

72 lines
2.4 KiB
C#
Raw Normal View History

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><C5B6><EFBFBD>Ϣ
public class teamInfo : MonoBehaviour
{
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\"}" }
};
}
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;
}
}
//=========<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; }
}