Files
5.24BuYu/Assets/MyGame/Scripts/Net/APIRequestList_Login.cs
T
2026-02-03 11:35:19 +08:00

87 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Assets.MyGame.Scripts.Net.API;
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
using Assets.MyGame.Scripts.Net.APIRequest.Params;
using System;
using System.Security.Cryptography;
using UnityEngine;
namespace Assets.MyGame.Scripts.Net
{
public static partial class APIRequestList
{
static void lizi()
{
APIRequestList.Login(
new LoginParam { mobile = "13800138000", code = "1234" },
res =>
{
}
);
APIRequestList.Register(
new RegisterObj { mobile = "13800138000", code = "1234", password = "abc123" },
res =>
{
}
);
APIRequestList.LoginWx(
new LoginWxParam
{
openId = "wx_openid_123456"
},
res =>
{
}
);
}
#region Login
/// <summary>
/// 微信用户登录(GET)
/// Swagger Summary: 微信用户登陆
/// 参数:
/// openId: 微信 openId
/// 返回:
/// UserToken(包含 token、用户信息等)
/// </summary>
public static void LoginWx(LoginWxParam req, Action<UserToken> callback)
{
APIManager.Response<UserToken>(APIType.Login_LoginWx, req, obj =>
{
GameManager.Instance.user = obj;
callback?.Invoke(obj);
});
}
/// <summary>
/// 登录(GET)
/// </summary>
public static void Login(LoginParam req, Action<UserToken> callback)
{
APIManager.Response<UserToken>(APIType.Login_Login, req, obj =>
{
GameManager.Instance.user=obj;
callback?.Invoke(obj);
});
}
/// <summary>
/// 注册(POST)
/// </summary>
public static void Register(RegisterObj req, Action<UserToken> callback)
{
APIManager.Response<UserToken>(APIType.Login_Register, req, obj =>
{
callback?.Invoke(obj);
});
}
#endregion
}
}