Cute_demon_attacks/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs

110 lines
3.6 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><CCAC><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ
public class treeTeamData : 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<TreeTeam> TreeTeamData()
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/team_data", "GET", "{}", CreateHeaders());
Debug.Log("<22><>̬<EFBFBD><CCAC><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>Ϣ" + response);
// <20><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD> JSON
TreeTeam TreeTeamResponse = JsonConvert.DeserializeObject<TreeTeam>(response);
//// <20><><EFBFBD><EFBFBD><E9B7B4><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//if (TreeTeamResponse != null && TreeTeamResponse.Data != null && TreeTeamResponse.Data.Info != null)
//{
// Debug.Log("<22>û<EFBFBD><C3BB>dz<EFBFBD>: " + TreeTeamResponse.Data.Info.Nickname);
//}
//else
//{
// Debug.LogError("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> JSON <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>");
//}
return TreeTeamResponse;
}
}
//===================================================================
public class TreeTeam:myResponse
{
public TreeTeamData Data { get; set; }
}
public class TreeTeamData
{
public TreeTeamInfo Info { get; set; }
public List<TreeTeamItem> Items { get; set; }
2024-12-29 21:17:16 +08:00
public int inviter_show { get; set; }
public inviterInfo inviter { get; set; }
2024-12-06 16:18:17 +08:00
}
public class TreeTeamInfo
{
public string Uid { get; set; }
public string Account { get; set; }
public string Nickname { get; set; }
public string avatar_url { get; set; }
public string invite_code { get; set; }
public int certify_status { get; set; }//ʵ<><CAB5>״̬ 0:δʵ<CEB4><CAB5> 1:<3A><>ʵ<EFBFBD><CAB5>
public string create_time { get; set; }
public string last_login_time { get; set; }
public float water { get; set; }
public int team_count { get; set; }
public int directly_count { get; set; }
public int team_active_count { get; set; }
public int directly_active_count { get; set; }
2024-12-06 16:18:17 +08:00
public int Level { get; set; }
public string level_name { get; set; }
public string level_icon { get; set; }
2024-12-06 16:18:17 +08:00
}
public class TreeTeamItem
{
public string Title { get; set; }
public string Desc { get; set; }
public int now_val { get; set; }
public int req_val { get; set; }
public float Percentage { get; set; }//<2F>ٷֱȽ<D6B1><C8BD><EFBFBD> 1 = 100%
2024-12-29 21:17:16 +08:00
}
public class inviterInfo
{
public string Uid { get; set; }
public string Account { get; set; }
public string Nickname { get; set; }
public string avatar_url { get; set; }
public string invite_code { get; set; }
public int certify_status { get; set; }//ʵ<><CAB5>״̬ 0:δʵ<CEB4><CAB5> 1:<3A><>ʵ<EFBFBD><CAB5>
public string create_time { get; set; }
public string last_login_time { get; set; }
public float water { get; set; }
2024-12-29 21:17:16 +08:00
public int team_count { get; set; }
public int directly_count { get; set; }
public int team_active_count { get; set; }
public int directly_active_count { get; set; }
public int Level { get; set; }
public string level_name { get; set; }
public string level_icon { get; set; }
2024-12-06 16:18:17 +08:00
}