_xiaofang/xiaofang/Assets/Script/login/login.cs

42 lines
1.2 KiB
C#
Raw Normal View History

2024-11-21 13:55:05 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Newtonsoft.Json;
public class auth_login
{
public string clientId = "e5cd7e4891bf95d1d19206ce24a7b32e";
public string grantType = "password";
2024-11-23 14:08:04 +08:00
public string userType = "company_user";
public string username = "13699802230";
public string password = "YYL2230!";
2024-11-21 13:55:05 +08:00
}
public class login : MonoBehaviour
{
public string token;//<2F><>¼<EFBFBD><C2BC><EFBFBD>ص<EFBFBD>token
public void Start()
{
loging();
//createTemplate();
}
public async void loging()
{
auth_login auth_Login = new auth_login();
2024-11-23 14:08:04 +08:00
Debug.Log(JsonUtility.ToJson(auth_Login));
2024-11-21 13:55:05 +08:00
string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(auth_Login));
Debug.Log(response);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
server serverData = JsonConvert.DeserializeObject<server>(response);
//token = serverData.token;
//Debug.Log(setverData.msg);
}
public async void createTemplate()
{
string response = await web.SendRequest(web.URL + "/game/gameTemplate/list", "GET");
Debug.Log(response);
}
}