72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using Newtonsoft.Json;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using UnityEngine;
|
||
//团队信息
|
||
public class teamInfo : MonoBehaviour
|
||
{
|
||
public Dictionary<string, string> CreateHeaders()
|
||
{
|
||
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
|
||
{
|
||
Debug.LogWarning("尝试创建请求头时,token 未设置。");
|
||
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("团队信息" + response);
|
||
TeamInfoResponse teamInfo = JsonConvert.DeserializeObject<TeamInfoResponse>(response);
|
||
//Debug.Log(teamInfo.Data.Info.Nickname);
|
||
return teamInfo;
|
||
}
|
||
}
|
||
//=========团队信息====================================================
|
||
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 team_count { 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; }
|
||
} |