_xiaofang/xiaofang/Assets/Script/DirllInterface/getPlayerList.cs

60 lines
1.8 KiB
C#
Raw Normal View History

2024-12-11 11:01:36 +08:00
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
public class getPlayerList : MonoBehaviour
{
2024-12-11 15:32:27 +08:00
//private void Start()
//{
// GetPlayerList();
//}
2024-12-11 11:01:36 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+GlobalData.ServerData.data.access_token },
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
};
}
2025-01-03 18:02:37 +08:00
//
2024-12-11 11:01:36 +08:00
public async Task<PlayerListResponse> GetPlayerList()
{
string response = await web.SendRequest(web.URL + "/admin/companyUser/player/list", "GET", "{}", CreateHeaders());
Debug.Log("<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA>б<EFBFBD>" + response);
2025-01-02 16:00:45 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
2024-12-11 11:01:36 +08:00
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
2024-12-29 14:47:48 +08:00
Debug.Log(playerListResponse.data[0].UserId);
2024-12-30 22:59:22 +08:00
Debug.Log(playerListResponse.data[0].UserName);
2024-12-11 11:01:36 +08:00
return playerListResponse;
}
}
//=====================================================================================================================
public class PlayerListResponse : Response
{
2024-12-11 15:32:27 +08:00
2024-12-11 11:01:36 +08:00
public List<PlayerListData> data { get; set; }
}
public class PlayerListData
{
public string UserName { get; set; }
public string Id { get; set; }
public string CompanyId { get; set; }
public string UserId { get; set; }
public string IsAdmin { get; set; }
public string Status { get; set; }
public string Remark { get; set; } // <20><><EFBFBD><EFBFBD>Ϊnull<6C><6C>ͨ<EFBFBD><CDA8>ʹ<EFBFBD><CAB9>string<6E><67><EFBFBD><EFBFBD>
public string DepartmentName { get; set; }
public string PostName { get; set; }
public string NickName { get; set; }
public string CreateTime { get; set; }
}