diff --git a/xiaofang/Assets/Script/DirllInterface/getPlayerList.cs b/xiaofang/Assets/Script/DirllInterface/getPlayerList.cs new file mode 100644 index 00000000..afc0e307 --- /dev/null +++ b/xiaofang/Assets/Script/DirllInterface/getPlayerList.cs @@ -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 CreateHeaders() + { + return new Dictionary + { + { "Authorization","Bearer "+GlobalData.ServerData.data.access_token }, + {"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" } + }; + } + // + public async Task GetPlayerList() + { + + + string response = await web.SendRequest(web.URL + "/admin/companyUser/player/list", "GET", "{}", CreateHeaders()); + + Debug.Log("获取演练账号列表" + response); + // 解析服务器返回的数据 + PlayerListResponse playerListResponse = JsonConvert.DeserializeObject(response); + Debug.Log(playerListResponse.data[0].UserName); + return playerListResponse; + } +} +//===================================================================================================================== +public class PlayerListResponse : Response +{ + public List 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; } +} diff --git a/xiaofang/Assets/Script/login/MyGlobal.cs b/xiaofang/Assets/Script/login/MyGlobal.cs index 90a06dc5..582de315 100644 --- a/xiaofang/Assets/Script/login/MyGlobal.cs +++ b/xiaofang/Assets/Script/login/MyGlobal.cs @@ -64,6 +64,11 @@ public class loginData public int expire_in;//toling剩余时间 public string isCreater;//是否是模板创建者,Y是则跳蓝湖预定演练01页面开始创建模板,N否则跳蓝狐回放1页面 } +public static class GlobalData +{ + // 静态变量用于存储登录响应数据 + public static loginResponse ServerData; +} //==================================================== //public class TemplateListData: Response //{