邀请功能6162接口与新用户信息14接口

This commit is contained in:
HuangZiBo 2024-11-27 00:17:30 +08:00
parent e1037c770d
commit fa73e7ee2f
10 changed files with 384 additions and 3 deletions

View File

@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using static UnityEditor.Experimental.GraphView.GraphView;
//public class ShouXuFei : MonoBehaviour
//{
// queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
// RealPlayerInfo shouXuInfo = new RealPlayerInfo();
// async void Start()
// {
// shouXuInfo = await queryPlayerInfo.QueryPlayerInfoPro();
// Debug.Log("===============" + shouXuInfo.data.unionId);
// }
//}
//async void Start()
//{
// shouXuInfo = await queryPlayerInfo.QueryPlayerInfoPro();
// Debug.Log("===============" + shouXuInfo.data.unionId);
//}
//public async Task<float> ShouXu()
//{
// // 等待 shouXuInfo 赋值完成
// while (shouXuInfo.data == null || shouXuInfo.data.unionId == 0)
// {
// await Task.Yield(); // Yield 控制器,等待直到 shouXuInfo 完成赋值
// }
// if (shouXuInfo.data.unionId <= 0)
// {
// if (shouXuInfo.data.isMember)
// {
// return 0.08f;
// }
// }
// else
// {
// return 0;
// }
// return 0;
//}
public class ShouXuFei : MonoBehaviour
{
//queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
//RealPlayerInfo shouXuInfo = new RealPlayerInfo();
//async void Start()
//{
// shouXuInfo = await queryPlayerInfo.QueryPlayerInfoPro();
// Debug.Log("===============" + shouXuInfo.data.unionId);
// Debug.Log(ShouXu()+"=================");
//}
public float ShouXu(int unionId,bool Member)
{
if (unionId <= 0)
{
if (Member)
{
return 0.08f;
}
else {
return 0.13f;
}
}
else
{
return 0;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 74eb9621e49bc1e4b9f85a207b9a3c0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0352e3575725bab489db76df6e2076b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//6.2取我的邀请列表:
public class getInviteList62 : MonoBehaviour
{
public InviteInfoList inviteInfoList;
public async Task<InviteInfoList> queryInviteHigherInfo()
{
Dictionary<string, string> head62 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步发送请求
string response62 = await web.SendRequest(web.URL + "/snail/invite/queryMyInvitePage", "POST", "{}", head62);
Debug.Log("6.2获取我的邀请列表:=============== " + response62);
try
{
inviteInfoList = JsonConvert.DeserializeObject<InviteInfoList>(response62);
Debug.Log("+++++++++++++++"+ inviteInfoList.data.dataList[0].bindTime);
}
catch (Exception ex)
{
Debug.LogError("反序列化响应失败: " + ex.Message);
}
return inviteInfoList;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f5ce3bdfb7fdb44cb9ac2ab33b21317
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,84 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//查询邀请的上级详情
public class queryInviteHigherInfo61 : MonoBehaviour
{
public InviteHigherInfo inviteHigherInfo;
public async Task<InviteHigherInfo> queryInviteHigherInfo()
{
Dictionary<string, string> head61 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步发送请求
string response61 = await web.SendRequest(web.URL + "/snail/invite/queryInviteHigherInfo", "POST", "{}", head61);
Debug.Log("6.1获取邀请的上级详情:=============== " + response61);
try
{
inviteHigherInfo = JsonConvert.DeserializeObject<InviteHigherInfo>(response61);
//if (inviteHigherInfo != null && inviteHigherInfo.data != null)
//{
// // 获取各个字段
// int userId = inviteHigherInfo.data.userId;
// string userName = inviteHigherInfo.data.userName;
// string token = inviteHigherInfo.data.token;
// string nickName = inviteHigherInfo.data.nickName;
// string headImg = inviteHigherInfo.data.headImg;
// int gender = inviteHigherInfo.data.gender;
// string birthday = inviteHigherInfo.data.birthday;
// string voluteCoin = inviteHigherInfo.data.voluteCoin;
// string beansCoin = inviteHigherInfo.data.beansCoin;
// string ichorCoin = inviteHigherInfo.data.ichorCoin;
// string idCard = inviteHigherInfo.data.idCard;
// string bank = inviteHigherInfo.data.bank;
// string realName = inviteHigherInfo.data.realName;
// bool? isCert = inviteHigherInfo.data.isCert;
// string inviteCodeMy = inviteHigherInfo.data.inviteCodeMy;
// string inviteCodeBind = inviteHigherInfo.data.inviteCodeBind;
// string bindTime = inviteHigherInfo.data.bindTime;
// string station = inviteHigherInfo.data.station;
// string cuteNo = inviteHigherInfo.data.cuteNo;
// string memberTime = inviteHigherInfo.data.memberTime;
// bool? isMember = inviteHigherInfo.data.isMember;
// string unionId = inviteHigherInfo.data.unionId;
// // 调试输出字段的值
// Debug.Log($"UserId: {userId}");
// Debug.Log($"UserName: {userName}");
// Debug.Log($"Token: {token}");
// Debug.Log($"NickName: {nickName}");
// Debug.Log($"HeadImg: {headImg}");
// Debug.Log($"Gender: {gender}");
// Debug.Log($"Birthday: {birthday}");
// Debug.Log($"VoluteCoin: {voluteCoin}");
// Debug.Log($"BeansCoin: {beansCoin}");
// Debug.Log($"IchorCoin: {ichorCoin}");
// Debug.Log($"IdCard: {idCard}");
// Debug.Log($"Bank: {bank}");
// Debug.Log($"RealName: {realName}");
// Debug.Log($"IsCert: {isCert}");
// Debug.Log($"InviteCodeMy: {inviteCodeMy}");
// Debug.Log($"InviteCodeBind: {inviteCodeBind}");
// Debug.Log($"BindTime: {bindTime}");
// Debug.Log($"Station: {station}");
// Debug.Log($"CuteNo: {cuteNo}");
// Debug.Log($"MemberTime: {memberTime}");
// Debug.Log($"IsMember: {isMember}");
// Debug.Log($"UnionId: {unionId}");
//}
}
catch (Exception ex)
{
Debug.LogError("反序列化响应失败: " + ex.Message);
}
return inviteHigherInfo;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f315f73354908564c96e2d34837c2e87
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -660,10 +660,109 @@ public class BuyGoodIdData
public int TotalCount { get; set; }
public List<object> DataList { get; set; } // 你可以根据需要将List<object>替换为List<YourDataType>===========================================================
}
//1.4个人信息新============================================================
[System.Serializable] // 确保这个类可以被序列化/反序列化
public class RealPlayerInfo : Response
{
public RealPlayerInfoData data; // 玩家信息的实际数据
// 内部类对应JSON中的"data"字段
[System.Serializable]
public class RealPlayerInfoData
{
public int userId;
public long userName;
public string token; // 使用object类型以处理可能的null值或者根据实际需要使用具体类型
public string nickName;
public string headImg;
public int gender;
public string birthday; // 同上处理可能的null值
public double voluteCoin;
public double beansCoin;
public double ichorCoin;
public string idCard;
public string bank;
public string realName;
public int isCert;
public string inviteCodeMy;
public string inviteCodeBind;
public string bindTime;
public int station;
public string cuteNo;
public string memberTime;
public bool isMember;
public int unionId;
}
}
//======================================================
public class InviteHigherInfo : Response
{
public InviteHigherInfoData data { get; set; }
}
public class InviteHigherInfoData
{
public int userId { get; set; }
public string userName { get; set; }
public string token { get; set; }
public string nickName { get; set; }
public string headImg { get; set; }
public int gender { get; set; }
public string birthday { get; set; }
public string voluteCoin { get; set; }
public string beansCoin { get; set; }
public string ichorCoin { get; set; }
public string idCard { get; set; }
public string bank { get; set; }
public string realName { get; set; }
public bool? isCert { get; set; }
public string inviteCodeMy { get; set; }
public string inviteCodeBind { get; set; }
public string bindTime { get; set; }
public string station { get; set; }
public string cuteNo { get; set; }
public string memberTime { get; set; }
public bool? isMember { get; set; }
public string unionId { get; set; }
}
//===========6.2=====================================================
public class InviteInfoList
{
public int code { get; set; }
public string message { get; set; }
public InviteData data { get; set; }
}
public class InviteData
{
public int pageNo { get; set; }
public int pageSize { get; set; }
public int totalCount { get; set; }
public List<InviteUserInfo> dataList { get; set; }
}
public class InviteUserInfo
{
public int userId { get; set; }
public string userName { get; set; }
public string token { get; set; }
public string nickName { get; set; }
public string headImg { get; set; }
public int gender { get; set; }
public string birthday { get; set; }
public string voluteCoin { get; set; }
public string beansCoin { get; set; }
public string ichorCoin { get; set; }
public string idCard { get; set; }
public string bank { get; set; }
public string realName { get; set; }
public string isCert { get; set; }
public string inviteCodeMy { get; set; }
public string inviteCodeBind { get; set; }
public string bindTime { get; set; }
public string station { get; set; }
public string cuteNo { get; set; }
public string memberTime { get; set; }
public bool? isMember { get; set; }
public string unionId { get; set; }
}

View File

@ -0,0 +1,33 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;
public class queryPlayerInfo : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// 查询玩家信息
public async Task<RealPlayerInfo> QueryPlayerInfoPro() // 1.4
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head14 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 异步查询玩家信息
string response14 = await web.SendRequest(web.URL + "/snail/user/queryUserInfo", "POST", "{}", head14);
Debug.Log("1.4查询玩家信息==================" + response14);
//解析服务器传入的数据
RealPlayerInfo realPlayerInfo = new RealPlayerInfo();
realPlayerInfo = JsonConvert.DeserializeObject<RealPlayerInfo>(response14);
return realPlayerInfo;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75a8a937e34eefd4db409d066f0ae0ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: