玩家列表接口
This commit is contained in:
parent
158082ec63
commit
5cece435ae
57
xiaofang/Assets/Script/DirllInterface/getPlayerList.cs
Normal file
57
xiaofang/Assets/Script/DirllInterface/getPlayerList.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
//获取房间玩家列表
|
||||||
|
public class getPlayerList : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
GetPlayerList();
|
||||||
|
}
|
||||||
|
// 创建请求头,使用最新的 token
|
||||||
|
public Dictionary<string, string> CreateHeaders()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{ "Authorization","Bearer "+GlobalData.ServerData.data.access_token },
|
||||||
|
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
public async Task<PlayerListResponse> GetPlayerList()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
string response = await web.SendRequest(web.URL + "/admin/companyUser/player/list", "GET", "{}", CreateHeaders());
|
||||||
|
|
||||||
|
Debug.Log("获取演练账号列表" + response);
|
||||||
|
// 解析服务器返回的数据
|
||||||
|
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
|
||||||
|
Debug.Log(playerListResponse.data[0].UserName);
|
||||||
|
return playerListResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=====================================================================================================================
|
||||||
|
public class PlayerListResponse : Response
|
||||||
|
{
|
||||||
|
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; } // 可以为null,通常使用string类型
|
||||||
|
public string DepartmentName { get; set; }
|
||||||
|
public string PostName { get; set; }
|
||||||
|
public string NickName { get; set; }
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
}
|
@ -64,6 +64,11 @@ public class loginData
|
|||||||
public int expire_in;//toling剩余时间
|
public int expire_in;//toling剩余时间
|
||||||
public string isCreater;//是否是模板创建者,Y是则跳蓝湖预定演练01页面开始创建模板,N否则跳蓝狐回放1页面
|
public string isCreater;//是否是模板创建者,Y是则跳蓝湖预定演练01页面开始创建模板,N否则跳蓝狐回放1页面
|
||||||
}
|
}
|
||||||
|
public static class GlobalData
|
||||||
|
{
|
||||||
|
// 静态变量用于存储登录响应数据
|
||||||
|
public static loginResponse ServerData;
|
||||||
|
}
|
||||||
//====================================================
|
//====================================================
|
||||||
//public class TemplateListData: Response
|
//public class TemplateListData: Response
|
||||||
//{
|
//{
|
||||||
|
Loading…
Reference in New Issue
Block a user