接口的接入

This commit is contained in:
liuliang 2024-12-27 18:14:54 +08:00
parent 62f0f7de79
commit 657c1df64f
19 changed files with 583 additions and 16 deletions

View File

@ -22,6 +22,14 @@ public class Scene_main_jiekou :MonoBehaviour
petBettles petBettles = new petBettles(); petBettles petBettles = new petBettles();
promotionRank promotionRank = new promotionRank(); promotionRank promotionRank = new promotionRank();
treeGetWater treeGetWater = new treeGetWater(); treeGetWater treeGetWater = new treeGetWater();
transfersearch transfersearch = new transfersearch();
transferapply transferapply = new transferapply();
transferlist transferlist = new transferlist();
signdata signdata = new signdata();
signsumbit signsumbit = new signsumbit();
conventionInfo conventionInfo = new conventionInfo();
capitalbalance capitalbalance = new capitalbalance();
noticeInfo noticeInfo = new noticeInfo();
public static Scene_main_jiekou instance; public static Scene_main_jiekou instance;
@ -43,14 +51,56 @@ public class Scene_main_jiekou :MonoBehaviour
} }
public async Task<PlayerInfoData> PlayerInfos() public async Task<transfersearchIndefo> TransfersearchInfos(string key)//转赠搜索
{ {
/*if (!IsTaskLoging) return await transfersearch.TransfersearchInfo(key);
{ }
IsTaskLoging=true;
}*/
public async Task<bool> TransferapplyInfos(string uid,int amount, string trade_password)//转增申请
{
transferapplyBody body =new transferapplyBody();
body.uid = uid;
body.amount = amount;
body.trade_password = trade_password;
return await transferapply.TransferapplyInfo(body);
}
public async Task<transferlistInfo> transferlistInfos(int page_num, int page_size)//转增记录
{
return await transferlist.transferlistInfo(page_num, page_size);
}
public async Task<SigndataIndfo> SigndataInfos()//签到数据
{
return await signdata.SigndataInfo();
}
public async Task<SignsumbitResponse> Signsumbits(string date)//签到提交
{
signsumbitBody body =new signsumbitBody();
body.date = date;
return await signsumbit.Signsumbit(body);
}
public async Task<ConventionIndfo> ConventionInfos()//公会公约信息
{
return await conventionInfo.ConventionInfo();
}
public async Task<CapitalbalanceIndefo> CapitalbalanceInfos()//资金余额信息
{
return await capitalbalance.CapitalbalanceInfo();
}
public async Task<NoticeIndfo> NoticeInfos(int type)//公告信息
{
return await noticeInfo.NoticeInfo(type);
}
public async Task<PlayerInfoData> PlayerInfos()
{
await _Login.TastLogin(); await _Login.TastLogin();
playerInfo playerInfo=new playerInfo(); playerInfo playerInfo=new playerInfo();
@ -99,6 +149,8 @@ public class Scene_main_jiekou :MonoBehaviour
/// <summary> /// <summary>
/// 삿혤瑯데固셕 /// 삿혤瑯데固셕
/// </summary> /// </summary>
@ -158,4 +210,6 @@ public class Scene_main_jiekou :MonoBehaviour
} }

View File

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

View File

@ -0,0 +1,51 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class transferapply : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<bool> TransferapplyInfo(transferapplyBody body)
{
Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
string response = await myWeb.SendRequest(myWeb.URL + "/api/capital/transfer/apply", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
Debug.Log(response);
transferResponse info = JsonConvert.DeserializeObject<transferResponse>(response);
if (info.code == 200)
{
Promptmgr.Instance.PromptBubble(info.message);
return true;
}
Promptmgr.Instance.PromptBubble(info.message);
return false;
}
}
public class transferapplyBody
{
public string uid;
public int amount;
public string trade_password;
}
public class transferResponse: myResponse
{
}

View File

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

View File

@ -0,0 +1,70 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class transferlist : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<transferlistInfo> transferlistInfo(int page_num,int page_size)
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/capital/transfer/list?page_num="+ page_num+"&page_size="+ page_size,"GET", "{}", CreateHeaders());
Debug.Log("转增记录" + response);
transferlistInfo transferlistInfo = JsonConvert.DeserializeObject<transferlistInfo>(response);
Debug.Log(transferlistInfo.data.pages);
return transferlistInfo;
}
}
public class transferlistInfo:myResponse
{
public transferlistData data;
}
[Serializable]
public class transferlistPages
{
public int page_num;
public int page_size;
public int curr_size;
public int total_count;
}
[Serializable]
public class transferlistList
{
public string trans_no;
public int status;
public int type;
public int amount;
public int actual_amount;
public int poundage_fee;
public string remark;
public bool apply;
public string create_time;
public string completed_time;
}
[Serializable]
public class transferlistData
{
public transferlistPages pages;
public Transaction[] list;
}

View File

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

View File

@ -0,0 +1,49 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class transfersearch : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<transfersearchIndefo> TransfersearchInfo(string key)//需要传入用户的账号或者Uid
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/capital/transfer/search?key="+key, "GET", "{}", CreateHeaders());
Debug.Log("转增搜索信息" + response);
transfersearchIndefo transfersearchIndfo = JsonConvert.DeserializeObject<transfersearchIndefo>(response);
return transfersearchIndfo;
}
}
public class transfersearchIndefo: myResponse
{
public transfersearchInfodata data;
}
public class transfersearchInfodata
{
public string uid;
public string account;
public string name;
public string invite_code;
public string avatar_url;
}

View File

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

View File

@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class capitalbalance : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<CapitalbalanceIndefo> CapitalbalanceInfo()
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/capital/balance", "GET", "{}", CreateHeaders());
Debug.Log("签到数据" + response);
CapitalbalanceIndefo capitalbalanceInfo = JsonConvert.DeserializeObject<CapitalbalanceIndefo>(response);
Debug.Log("======" + capitalbalanceInfo.data.water);
return capitalbalanceInfo;
}
}
public class CapitalbalanceIndefo: myResponse
{
public capitalbalanceIndefoData data;
}
public class capitalbalanceIndefoData
{
public float gem;
public float gold;
public float forge;
public float water;
}

View File

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

View File

@ -0,0 +1,62 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.VisualScripting;
using UnityEngine;
public class conventionInfo : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<ConventionIndfo> ConventionInfo()
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/convention/info", "GET", "{}", CreateHeaders());
Debug.Log("工会公约信息" + response);
ConventionIndfo conventionIndfo = JsonConvert.DeserializeObject<ConventionIndfo>(response);
Debug.Log("======" +conventionIndfo.Data.intro_text );
return conventionIndfo;
}
}
public class ConventionIndfo : myResponse
{
public ConventionInfoData Data;
}
[Serializable]
public class ConventionInfoData
{
public string intro_text;
public Member[] members;
}
[Serializable]
public class Member
{
public string uid;
public string account;
public string name;
public string invite_code;
public string avatar_url;
public string qq;
public string wechat;
}

View File

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

View File

@ -22,10 +22,10 @@ public class noticeInfo : MonoBehaviour
}; };
} }
// Start is called before the first frame update // Start is called before the first frame update
public async Task<NoticeIndfo> NoticeInfo() public async Task<NoticeIndfo> NoticeInfo(int type)
{ {
string response = await myWeb.SendRequest(myWeb.URL + "/api/notice/info", "GET", "{}", CreateHeaders()); string response = await myWeb.SendRequest(myWeb.URL + "/api/notice/info?type="+type, "GET", "{}", CreateHeaders());
Debug.Log("用户详情" + response); Debug.Log("公告信息" + response);
NoticeIndfo noticeIndfo = JsonConvert.DeserializeObject<NoticeIndfo>(response); NoticeIndfo noticeIndfo = JsonConvert.DeserializeObject<NoticeIndfo>(response);
Debug.Log("======"+noticeIndfo.Data.exist); Debug.Log("======"+noticeIndfo.Data.exist);
return noticeIndfo; return noticeIndfo;

View File

@ -0,0 +1,60 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class signdata : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<SigndataIndfo> SigndataInfo()
{
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/sign/data", "GET", "{}", CreateHeaders());
Debug.Log("签到数据" + response);
SigndataIndfo signdataIndfo = JsonConvert.DeserializeObject<SigndataIndfo>(response);
Debug.Log("======" + signdataIndfo.Data.days);
return signdataIndfo;
}
}
public class SigndataIndfo : myResponse
{
public SignInfodata Data;
}
[Serializable]
public class SignInfodata
{
public bool today_sign;
public int days;
public SignData[] sign_data;
}
[Serializable]
public class SignData
{
public string date;
public int today;
public int status;
public int type;
public int reward;
}

View File

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

View File

@ -0,0 +1,53 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class signsumbit : MonoBehaviour
{
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
};
}
public async Task<SignsumbitResponse> Signsumbit(signsumbitBody body)//签到可以为空,为当天签到,补签必须传入指定日期
{
Debug.Log(JsonConvert.SerializeObject(body));
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/sign/submit", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
Debug.Log("登录" + response);
SignsumbitResponse signsumbitResponse = JsonConvert.DeserializeObject<SignsumbitResponse>(response);
Debug.Log("=========" + signsumbitResponse.data.type);
return signsumbitResponse;
}
}
public class signsumbitBody
{
public string date;
}
public class SignsumbitResponse : myResponse
{
public signsumbitData data;
}
[Serializable]
public class signsumbitData
{
public int type;
public int reward;
}

View File

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

View File

@ -31,9 +31,45 @@ public class onlyTest : MonoBehaviour
orderVerification orderVerification = new orderVerification(); orderVerification orderVerification = new orderVerification();
BillingStatistics BillingStatistics = new BillingStatistics(); BillingStatistics BillingStatistics = new BillingStatistics();
incomeList incomeList = new incomeList(); incomeList incomeList = new incomeList();
noticeInfo noticeInfo = new noticeInfo();
signdata signdata = new signdata();
signsumbit signsumbit = new signsumbit();
conventionInfo conventionInfo = new conventionInfo();
capitalbalance capitalbalance = new capitalbalance();
transfersearch transfersearch = new transfersearch();
transferapply transferapply = new transferapply();
transferlist transferlist = new transferlist();
async void Start() async void Start()
{ {
// await login.Login();
loginBody body = new loginBody();
body.client_id = "app";
body.username = "17015306950";
body.password = "9527123";
body.type = "code";
await login.Login(body);
//await capitalbalance.CapitalbalanceInfo();
// await transfersearch.TransfersearchInfo("18821995938");
//transferapplyBody transferapplyBody = new transferapplyBody();
//transferapplyBody.uid = "8QSIO1GB7";
//transferapplyBody.trade_password = "666666";
//transferapplyBody.amount = 10;
// await transferlist.transferlistInfo(1,10);
//await transferapply.TransferapplyInfo(transferapplyBody);
//await noticeInfo.NoticeInfo(0);
// await signdata.SigndataInfo();
// signsumbitBody signsumbitBody = new signsumbitBody();
// //signsumbitBody.date = "2024-12-23";
//await signsumbit.Signsumbit(signsumbitBody);
// await conventionInfo.ConventionInfo();
//await sendCode.SendCode(); //await sendCode.SendCode();
//await checkCode.CheckCode(); //await checkCode.CheckCode();
//await checkAccount.CheckAccount(); //await checkAccount.CheckAccount();
@ -61,7 +97,7 @@ public class onlyTest : MonoBehaviour
//createOrder.CreateOrder(1,1,"1"); //createOrder.CreateOrder(1,1,"1");
//orderVerification.OrderVerification(1); //orderVerification.OrderVerification(1);
//BillingStatistics.billingStatistics(1); //BillingStatistics.billingStatistics(1);
incomeList.IncomeList(1,10,1); // incomeList.IncomeList(1,10,1);
} }
// Update is called once per frame // Update is called once per frame

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SocialPlatforms; using UnityEngine.SocialPlatforms;
@ -44,10 +45,10 @@ public class test1 : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
} }
//=======되쩌========================================================================================================================= // =======되쩌=========================================================================================================================
//public async void Login() //public async void Login()
//{ //{
// loginBody body = new loginBody(); // loginBody body = new loginBody();
@ -57,7 +58,7 @@ public class test1 : MonoBehaviour
// body.type = "code"; // body.type = "code";
// //Debug.Log(JsonConvert.SerializeObject(body) + "Èë²Î========="); // //Debug.Log(JsonConvert.SerializeObject(body) + "Èë²Î=========");
// string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/login", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin()); // string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/login", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
// Debug.Log("되쩌"+response); // Debug.Log("되쩌" + response);
// loginResponse apifox = JsonConvert.DeserializeObject<loginResponse>(response); // loginResponse apifox = JsonConvert.DeserializeObject<loginResponse>(response);
// Debug.Log(MyGlobal.global.loginResponse.Data); // Debug.Log(MyGlobal.global.loginResponse.Data);
// MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token; // MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
@ -79,7 +80,7 @@ public class test1 : MonoBehaviour
// RegisterResponse register = JsonConvert.DeserializeObject<RegisterResponse>(response); // RegisterResponse register = JsonConvert.DeserializeObject<RegisterResponse>(response);
// Debug.Log("=====zhuce======"+register.data.token.expires_in); // Debug.Log("=====zhuce======"+register.data.token.expires_in);
//} //}
//============Í˳öµÇ¼============================================================================================ //============Í˳öµÇ¼============================================================================================
//public async void Logout() //public async void Logout()
//{ //{