接口测试
This commit is contained in:
parent
7a2805855d
commit
f6d8db5a5c
@ -1133,6 +1133,7 @@ GameObject:
|
||||
- component: {fileID: 1348751388}
|
||||
- component: {fileID: 1348751387}
|
||||
- component: {fileID: 1348751386}
|
||||
- component: {fileID: 1348751389}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
@ -1206,6 +1207,18 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1348751389
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1348751385}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f8a0d55335aa2244abba9eff5c8cbe29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1352207951
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1282,6 +1295,50 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1352207951}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1389355970
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1389355971}
|
||||
- component: {fileID: 1389355972}
|
||||
m_Layer: 0
|
||||
m_Name: MyGlobal
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1389355971
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1389355970}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 695.1606, y: 999.52893, z: -5.2143292}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1389355972
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1389355970}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59ff8dcd92c3dd54e92e6e06ff63654d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1798988486
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
23
meng_yao/Assets/script/scene_loading/loading_jiekou.cs
Normal file
23
meng_yao/Assets/script/scene_loading/loading_jiekou.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class loading_jiekou : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 实名认证会返回是否成功
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="identity_card_no"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RealNameAuthentication(string name, string identity_card_no)
|
||||
{
|
||||
realNameAuthentication _realNameAuthentication = new realNameAuthentication();
|
||||
return await _realNameAuthentication.RealNameAuthentication(name, identity_card_no);
|
||||
}
|
||||
|
||||
|
||||
}
|
11
meng_yao/Assets/script/scene_loading/loading_jiekou.cs.meta
Normal file
11
meng_yao/Assets/script/scene_loading/loading_jiekou.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8a0d55335aa2244abba9eff5c8cbe29
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript.meta
Normal file
8
meng_yao/Assets/script/serveTestScript.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35404d9fcb3b7a54bacef588c7070d53
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a220fdc46be916d4395e040d8f7af9bf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,46 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//验证码校验
|
||||
public class checkCode : 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> CheckCode()
|
||||
{
|
||||
CheckCodeBody body = new CheckCodeBody();
|
||||
body.account = "13502712157";
|
||||
body.scene = 0;
|
||||
body.code = "9527123";
|
||||
//Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
//Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========头=========");
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/verify", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("验证码校验" + response);
|
||||
SendCodeResponse sendCodeResponse = JsonConvert.DeserializeObject<SendCodeResponse>(response);
|
||||
bool isSucceed;
|
||||
if (sendCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//===========================================================================================================================
|
||||
public class CheckCodeBody
|
||||
{
|
||||
public string account;
|
||||
public int scene;
|
||||
public string code;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: adde8b208a0368649a804693c383a0ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,38 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//发送验证码
|
||||
public class sendCode : 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> SendCode()
|
||||
{
|
||||
SendCodeBody body = new SendCodeBody();
|
||||
body.account = "13502712157";
|
||||
body.scene = 0;
|
||||
//Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
//Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========头=========");
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/send_code", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("发送验证码" + response);
|
||||
SendCodeResponse sendCode = JsonConvert.DeserializeObject<SendCodeResponse>(response);
|
||||
myResponse CheckCodeResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (CheckCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a81650988fd3f7043881e44fcb834d83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
71
meng_yao/Assets/script/serveTestScript/MyGlobal.cs
Normal file
71
meng_yao/Assets/script/serveTestScript/MyGlobal.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MyGlobal : MonoBehaviour
|
||||
{
|
||||
public static MyGlobal global;
|
||||
public loginResponse loginResponse =new loginResponse();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
if (global != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
global = this;
|
||||
}
|
||||
|
||||
// 创建请求头,使用最新的 token
|
||||
public Dictionary<string, string> CreateHeaders()
|
||||
{
|
||||
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
{"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 class myResponse//=========总============
|
||||
{
|
||||
public int code;
|
||||
public string message;
|
||||
}
|
||||
//===========================================================
|
||||
public class loginResponse : myResponse//登录返回值
|
||||
{
|
||||
public data Data =new data();
|
||||
}
|
||||
public class data
|
||||
{
|
||||
public string access_token;
|
||||
public string token_type;
|
||||
public int expires_in;
|
||||
public string scope;
|
||||
}
|
||||
public class RegisterResponse: myResponse//注册返回值
|
||||
{
|
||||
|
||||
public registerData data;
|
||||
}
|
||||
public class registerData
|
||||
{
|
||||
public int auto_login;
|
||||
public registerToken token;
|
||||
}
|
||||
public class registerToken
|
||||
{
|
||||
public string access_token;
|
||||
public string token_type;
|
||||
public int expires_in;
|
||||
public string scope;
|
||||
}
|
||||
//============================================================
|
11
meng_yao/Assets/script/serveTestScript/MyGlobal.cs.meta
Normal file
11
meng_yao/Assets/script/serveTestScript/MyGlobal.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59ff8dcd92c3dd54e92e6e06ff63654d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/UserModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/UserModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f62b66baa609d974eb8b781dadd24d52
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//用户注销
|
||||
public class cancellation : 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> Cancellation()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/cancellation", "POST", "{}", CreateHeaders());
|
||||
Debug.Log("账户注销" + response);
|
||||
//bbb
|
||||
myResponse cancellationResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (cancellationResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0508da1832c891f429331478af516ef3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//账号校验
|
||||
public class checkAccount: MonoBehaviour
|
||||
{
|
||||
//playerInfo playerInfo = new playerInfo();
|
||||
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> CheckAccount()
|
||||
{
|
||||
playerInfo playerInfo = new playerInfo();
|
||||
PlayerIndfo playerIndfo = await playerInfo.PalyerInfo();//这里重新定义一个playerinfo变量,重新获取一次PlayerInfo
|
||||
CheckAccountBody body = new CheckAccountBody();
|
||||
//Debug.Log(playerIndfo.Data.account);
|
||||
body.account = playerIndfo.Data.account;
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/check_account", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("账号校验" + response);
|
||||
myResponse CheckAccountResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (CheckAccountResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//=================================================================
|
||||
public class CheckAccountBody
|
||||
{
|
||||
public string account;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3124d58a617a844cad1207f4f7e2778
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//级别个人金币销毁
|
||||
public class goldDestroy : 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> GoldDestroy()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/gold_destroy", "POST", "{}", CreateHeaders());
|
||||
Debug.Log("级别个人金币销毁" + response);
|
||||
//bbbb
|
||||
myResponse LogoutResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (LogoutResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d70d882949d8e2d46a9327aa4b399613
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,41 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//转赠密码
|
||||
public class modifyTradePassword : 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> ModifyTradePassword(string newPassword, string code)
|
||||
{
|
||||
ModifyTradePasswordBody body = new ModifyTradePasswordBody();
|
||||
body.code = code;
|
||||
body.password = newPassword;
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/modify_trade_password", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("转增密码设置" + response);
|
||||
myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//============================================================================
|
||||
public class ModifyTradePasswordBody
|
||||
{
|
||||
public string password;
|
||||
public string code;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3a9fd1b61ce73046bd9c84a81e20019
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,59 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//用户详情
|
||||
public class playerInfo : 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<PlayerIndfo> PalyerInfo()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/detail", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("用户详情" + response);
|
||||
PlayerIndfo playerIndfo = JsonConvert.DeserializeObject<PlayerIndfo>(response);
|
||||
//Debug.Log("======" + playerIndfo.Data.account);
|
||||
return playerIndfo;
|
||||
}
|
||||
}
|
||||
//==============================================================================================================
|
||||
public class PlayerIndfo : myResponse
|
||||
{
|
||||
public PlayerInfoData Data;
|
||||
}
|
||||
public class PlayerInfoData
|
||||
{
|
||||
public string uid;
|
||||
public string account;
|
||||
public string nickname;
|
||||
public string avatar_url;
|
||||
public string invite_code;
|
||||
public int trade_password_status;
|
||||
public int certify_status;
|
||||
public string certify_name;
|
||||
public string identity_card_no;
|
||||
public string location;
|
||||
public int location_status;
|
||||
public long gem;
|
||||
public long gold;
|
||||
public long forge;
|
||||
public long water;
|
||||
public int level;
|
||||
public string level_name;
|
||||
public string level_icon;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cce4b49086e0ad142882a03fc1b340b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,44 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//实名认证
|
||||
public class realNameAuthentication : 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> RealNameAuthentication(string name, string identity_card_no)//呢称需要包含中文可以跟字母组合,但必须大于两个//只能更新名字头像
|
||||
{
|
||||
RealNameBody body = new RealNameBody();
|
||||
body.name = name;
|
||||
body.identity_card_no = identity_card_no;
|
||||
//Debug.Log("=====" + body);
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/certify/commit", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("实名认证" + response);
|
||||
myResponse RealNameResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed = true;
|
||||
if (RealNameResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//===================================================================================================
|
||||
public class RealNameBody
|
||||
{
|
||||
public string name;
|
||||
public string identity_card_no;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6c1847b2bfb83043bff6cef757b0d4b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//×¢²á
|
||||
public class register : MonoBehaviour
|
||||
{
|
||||
public Dictionary<string, string> CreateHeadersTologin()
|
||||
{
|
||||
|
||||
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<RegisterResponse> Register(string account,string password,string inviteCode,string code)
|
||||
{
|
||||
registerBody body = new registerBody();
|
||||
body.account = account;
|
||||
body.password = password;
|
||||
body.invite_code = inviteCode;
|
||||
body.code = code;
|
||||
Debug.Log(JsonConvert.SerializeObject(body) + "Èë²Î=========");
|
||||
//Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========Í·=========");
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/register", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
|
||||
Debug.Log("×¢²á" + response);
|
||||
RegisterResponse register = JsonConvert.DeserializeObject<RegisterResponse>(response);
|
||||
Debug.Log("=====zhuce======" + register.data.token.expires_in);
|
||||
return register;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
public class registerBody//×¢²áÇëÇóÌå
|
||||
{
|
||||
public string account;
|
||||
public string password;
|
||||
public string invite_code;
|
||||
public string code;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f997c00bc633a5a4e8f6c03753da7b61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,70 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//团队粉丝列表
|
||||
public class teamFansList : 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<TeamFansList> TeamFansList()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_fans_list", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("团队粉丝列表" + response);
|
||||
TeamFansList teamFansList = JsonConvert.DeserializeObject<TeamFansList>(response);
|
||||
Debug.Log(teamFansList.Data.Pages.TotalCount+"=====================");
|
||||
return teamFansList;
|
||||
}
|
||||
}
|
||||
//========================================================================================================================
|
||||
public class TeamFansList:myResponse
|
||||
{
|
||||
public TeamFansListData Data { get; set; }
|
||||
}
|
||||
|
||||
public class TeamFansListData
|
||||
{
|
||||
public TeamFansListPages Pages { get; set; }
|
||||
public List<TeamFansListUser> List { get; set; }
|
||||
}
|
||||
|
||||
public class TeamFansListPages
|
||||
{
|
||||
public int PageNum { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public int CurrSize { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
|
||||
public class TeamFansListUser
|
||||
{
|
||||
public string Uid { get; set; }
|
||||
public string Account { get; set; }
|
||||
public string Nickname { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string InviteCode { get; set; }
|
||||
public int CertifyStatus { get; set; }
|
||||
public string CreateTime { get; set; }
|
||||
public string LastLoginTime { get; set; }
|
||||
public int TeamCount { get; set; }
|
||||
public int DirectlyCount { get; set; }
|
||||
public int KpiGold { get; set; }
|
||||
public int TeamKpiGold { get; set; }
|
||||
public int TeamMinKpiGold { get; set; }
|
||||
public int Level { get; set; }
|
||||
public string LevelName { get; set; }
|
||||
public string LevelIcon { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f15fc2feaa1e8144b8d2fabc5bcc851
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,72 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//团队信息
|
||||
public class teamInfo : 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<TeamInfoResponse> TeamInfo()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("团队信息" + response);
|
||||
TeamInfoResponse teamInfo = JsonConvert.DeserializeObject<TeamInfoResponse>(response);
|
||||
//Debug.Log(teamInfo.Data.Info.Nickname);
|
||||
return teamInfo;
|
||||
}
|
||||
}
|
||||
//=========团队信息====================================================
|
||||
public class TeamInfoResponse
|
||||
{
|
||||
public TeamInfoData Data { get; set; }
|
||||
}
|
||||
|
||||
public class TeamInfoData
|
||||
{
|
||||
public TeamInfoInfo Info { get; set; }
|
||||
public List<TeamInfoItem> Items { get; set; }
|
||||
}
|
||||
|
||||
public class TeamInfoInfo
|
||||
{
|
||||
public string Uid { get; set; }
|
||||
public string Account { get; set; }
|
||||
public string Nickname { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string InviteCode { get; set; }
|
||||
public int CertifyStatus { get; set; }
|
||||
public string CreateTime { get; set; }
|
||||
public string LastLoginTime { get; set; }
|
||||
public int TeamCount { get; set; }
|
||||
public int DirectlyCount { get; set; }
|
||||
public double KpiGold { get; set; }
|
||||
public double TeamKpiGold { get; set; }
|
||||
public double TeamMinKpiGold { get; set; }
|
||||
public int Level { get; set; }
|
||||
public string LevelName { get; set; }
|
||||
public string LevelIcon { get; set; }
|
||||
}
|
||||
|
||||
public class TeamInfoItem
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Desc { get; set; }
|
||||
public double NowVal { get; set; }
|
||||
public double ReqVal { get; set; }
|
||||
public double Percentage { get; set; }
|
||||
public int Style { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc3b6c4cdcf95ad458f948c1b3259a9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//用户信息更新
|
||||
public class updatePlayerInfo : 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> UpdatePlayerInfo(string field, string value)//呢称需要包含中文可以跟字母组合,但必须大于两个//只能更新名字头像
|
||||
{
|
||||
string body = $"{{\"{field}\":\"{value}\"}}";
|
||||
//Debug.Log("=====" + body);
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/update_info", "POST", body, CreateHeaders());
|
||||
Debug.Log("用户信息更新" + response);
|
||||
//myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed = true;
|
||||
//if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//=================================================================================
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b9ade750da4a5b409fb99be6342dd56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/billsModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/billsModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cc8375dabe66014eb0dced18ccdb991
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,44 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//账单统计
|
||||
public class BillingStatistics : 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<billingStatisticsResponse> billingStatistics(int type)
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/log/income/statistics/" + type, "GET", "{}", CreateHeaders());
|
||||
Debug.Log("账单统计" + response);
|
||||
billingStatisticsResponse billingStatisticsResponse = JsonConvert.DeserializeObject<billingStatisticsResponse>(response);
|
||||
Debug.Log("============"+billingStatisticsResponse.Data.Balance);
|
||||
return billingStatisticsResponse;
|
||||
}
|
||||
}
|
||||
//=============================================================================================
|
||||
public class billingStatisticsResponse:myResponse
|
||||
{
|
||||
public billingStatisticsData Data { get; set; }
|
||||
}
|
||||
|
||||
public class billingStatisticsData
|
||||
{
|
||||
public int Type { get; set; }
|
||||
public string Balance { get; set; }
|
||||
public string Income { get; set; }
|
||||
public string Expend { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 878d23bff8b85a24c84309378c0e2bc9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,73 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//历史账单列表
|
||||
public class incomeList : 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<IcomeList> IncomeList(int page_num,int page_size,int type)
|
||||
{
|
||||
|
||||
// 将参数构造为查询字符串
|
||||
string icomeListquery = $"/api/log/income/list?page_num={page_num}&page_size={page_size}&type={type}";
|
||||
string response = await myWeb.SendRequest(myWeb.URL + icomeListquery, "GET", "{}", CreateHeaders());
|
||||
Debug.Log("历史账单列表" + response);
|
||||
IcomeList IcomeList = JsonConvert.DeserializeObject<IcomeList>(response);
|
||||
Debug.Log("============" + IcomeList.Data.Pages.PageNum);
|
||||
return IcomeList;
|
||||
}
|
||||
}
|
||||
//========================================================================================================================================
|
||||
|
||||
public class IcomeList:myResponse
|
||||
{
|
||||
public IcomeListData Data { get; set; }
|
||||
}
|
||||
|
||||
public class IcomeListData
|
||||
{
|
||||
public IcomeListPageInfo Pages { get; set; }
|
||||
public List<Transaction> List { get; set; }
|
||||
public List<Statistics> Statistics { get; set; }
|
||||
}
|
||||
|
||||
public class IcomeListPageInfo
|
||||
{
|
||||
public int PageNum { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public int CurrSize { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
|
||||
public class Transaction
|
||||
{
|
||||
public string Uid { get; set; }
|
||||
public bool Income { get; set; }
|
||||
public int BillType { get; set; }
|
||||
public int AccountType { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class Statistics
|
||||
{
|
||||
public int DateTime { get; set; }
|
||||
public int TotalExpend { get; set; }
|
||||
public int TotalIncome { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d933ebe91c1db545a3ed77156fdf6bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/loginModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/loginModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 443b913bccaae6048824ec60327d1f0a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
49
meng_yao/Assets/script/serveTestScript/loginModule/login.cs
Normal file
49
meng_yao/Assets/script/serveTestScript/loginModule/login.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SocialPlatforms;
|
||||
//登录
|
||||
public class login : MonoBehaviour
|
||||
{
|
||||
public string token;
|
||||
checkAccount checkAccount = new checkAccount();
|
||||
// 创建请求头,使用最新的 token
|
||||
public Dictionary<string, string> CreateHeadersTologin()
|
||||
{
|
||||
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<string> Login()
|
||||
{
|
||||
loginBody body = new loginBody();
|
||||
body.client_id = "app";
|
||||
body.username = "15478549624";
|
||||
body.password = "9527123";
|
||||
body.type = "code";
|
||||
//Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/login", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
|
||||
Debug.Log("登录" + response);
|
||||
loginResponse apifox = JsonConvert.DeserializeObject<loginResponse>(response);
|
||||
//Debug.Log(MyGlobal.global.loginResponse.Data);
|
||||
MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
|
||||
//Debug.Log(MyGlobal.global.loginResponse.Data.access_token);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
//====================
|
||||
|
||||
public class loginBody//登录请求体
|
||||
{
|
||||
public string client_id;
|
||||
public string username;
|
||||
public string password;
|
||||
public string type;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f26d1298071a794d920a442e507d495
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
43
meng_yao/Assets/script/serveTestScript/loginModule/logout.cs
Normal file
43
meng_yao/Assets/script/serveTestScript/loginModule/logout.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//退出登录
|
||||
public class logout : 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> Logout()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/logout", "POST", "{}", CreateHeaders());
|
||||
Debug.Log("退出登录" + response);
|
||||
myResponse LogoutResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (LogoutResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
public class SendCodeBody
|
||||
{
|
||||
public string account;
|
||||
public int scene;
|
||||
}
|
||||
public class SendCodeResponse : myResponse
|
||||
{
|
||||
public string data;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6ba73cf8b3e42144968b940befa80d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/miningModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/miningModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f69906ef3172ce84dbc3e9b0370d838e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,32 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class miningActivate : 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<MiningConfigResponse> MiningConfig(int type)//类型 0:宝石岛 1:宝石矿场 10:金币岛 11:金币矿场
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/mining/config/" + type, "GET", "{}", CreateHeaders());
|
||||
Debug.Log("矿场配置" + response);
|
||||
//bbbb
|
||||
MiningConfigResponse miningConfigResponse = JsonConvert.DeserializeObject<MiningConfigResponse>(response);
|
||||
//Debug.Log("======kc================" + miningConfigResponse.Data[0].Name);
|
||||
return miningConfigResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3c23cb91b6a6bf4295ccc33d6213e14
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,50 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//激活矿场
|
||||
public class miningConfig : 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<MiningConfigResponse> MiningConfig(int type)//类型 0:宝石岛 1:宝石矿场 10:金币岛 11:金币矿场
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/mining/config/"+type, "GET", "{}", CreateHeaders());
|
||||
Debug.Log("矿场配置" + response);
|
||||
//bbbb
|
||||
MiningConfigResponse miningConfigResponse = JsonConvert.DeserializeObject<MiningConfigResponse>(response);
|
||||
//Debug.Log("======kc================" + miningConfigResponse.Data[0].Name);
|
||||
return miningConfigResponse;
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
public class MiningConfigResponse:myResponse
|
||||
{
|
||||
public List<MinngConfigData> Data { get; set; }
|
||||
}
|
||||
|
||||
public class MinngConfigData
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Level { get; set; }
|
||||
public float Price { get; set; }
|
||||
public float Yield { get; set; }
|
||||
public int YieldCycle { get; set; }
|
||||
public int ActivateLimit { get; set; }
|
||||
public int ActivateCount { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79cb4ecf6bf93a0478aeef0757dd05b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/moneyModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/moneyModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a308bf2df08f44940992995620c6f528
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,57 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//支付订单创建
|
||||
public class createOrder : 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> CreateOrder(int business_id,int business_type,string channel_Id)
|
||||
{
|
||||
CreateOrderBody body = new CreateOrderBody();
|
||||
body.business_type = business_type;
|
||||
body.channel_Id = channel_Id;
|
||||
body.business_id = business_id;
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/payment/order/create", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("支付订单创建" + response);
|
||||
myResponse Response = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
Debug.Log(isSucceed + "==================");
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//==========================================================================================================================
|
||||
public class CreateOrderBody
|
||||
{
|
||||
public int business_id;
|
||||
public int business_type;
|
||||
public string channel_Id;
|
||||
}
|
||||
//business_id
|
||||
//integer
|
||||
//业务编号
|
||||
//必需
|
||||
//business_type
|
||||
//integer
|
||||
//业务类型
|
||||
//必需
|
||||
//channel_Id
|
||||
//string
|
||||
//支付渠道
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73b32b8e0b7c1704c84b324e937a2092
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//連마땐데駱聯
|
||||
public class orderVerification : 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> OrderVerification(int tradeNo)
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/payment/order/verify/"+tradeNo, "POST", "{}", CreateHeaders());
|
||||
Debug.Log("連마땐데駱聯" + response);
|
||||
myResponse Response = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
Debug.Log(isSucceed + "==================");
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4abb6277b2d01646be048ad20c468ac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,40 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//购买产品
|
||||
public class productBuy : 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> BuyProduct(int id)
|
||||
{
|
||||
BuyProductBody body = new BuyProductBody();
|
||||
body.id = id;
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/recharge/product_buy", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("购买产品" + response);
|
||||
myResponse Response = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
Debug.Log(isSucceed + "==================");
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//=====================================================================================================================================
|
||||
public class BuyProductBody
|
||||
{
|
||||
public int id;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2d09378528bd9644a21b782f432a564
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,46 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//产品列表
|
||||
public class product_list : 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<productListResponse> ProductList()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/recharge/product_list", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("产品列表" + response);
|
||||
productListResponse productListResponse = JsonConvert.DeserializeObject<productListResponse>(response);
|
||||
//Debug.Log(productListResponse.Data[0].Name + "=====================");
|
||||
return productListResponse;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================================
|
||||
public class productListResponse:myResponse
|
||||
{
|
||||
public List<productListPackage> Data { get; set; }
|
||||
}
|
||||
|
||||
public class productListPackage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public float Price { get; set; }
|
||||
public float Amount { get; set; }
|
||||
public int FirstStatus { get; set; }
|
||||
//是否首冲翻倍 0:正常 1:翻倍
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212a643aece633c4c9bcfc30e0c4d3d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
109
meng_yao/Assets/script/serveTestScript/myWeb.cs
Normal file
109
meng_yao/Assets/script/serveTestScript/myWeb.cs
Normal file
@ -0,0 +1,109 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting.Antlr3.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
|
||||
|
||||
|
||||
public class myWeb : MonoBehaviour
|
||||
{
|
||||
public const string URL = "http://47.95.201.243:9527"; // 被注释掉的服务器地址(常量)
|
||||
//public const string URL = "ws://124.221.149.22:38445/safety/cloud"; // 被注释掉的服务器地址(常量)
|
||||
|
||||
// 存储服务器返回的Cookie
|
||||
private static Dictionary<string, string> cookieJar = new Dictionary<string, string>();
|
||||
|
||||
// 发送HTTP请求的方法,支持GET和POST等不同的请求方式
|
||||
public static async Task<string> SendRequest(string url, string method = "GET", string jsonData = "{}", Dictionary<string, string> head = null)
|
||||
{
|
||||
//Debug.Log(url + "启动web"); // 调试输出,启动网络请求
|
||||
// 使用UnityWebRequest类进行HTTP请求,支持自定义请求方法
|
||||
using (UnityWebRequest request = new UnityWebRequest(url, method))
|
||||
{
|
||||
// 设置下载处理器,用于处理服务器响应的数据
|
||||
request.downloadHandler = new DownloadHandlerBuffer();
|
||||
|
||||
// 如果是POST请求,设置请求体
|
||||
if (method == "POST" && jsonData != null)
|
||||
{
|
||||
// 将JSON字符串转换为字节数组
|
||||
byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData);
|
||||
// 设置上传处理器,用于发送请求体数据
|
||||
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
|
||||
// 设置请求头,指定请求体内容类型为JSON
|
||||
request.SetRequestHeader("Content-Type", "application/json");
|
||||
}
|
||||
|
||||
// 如果请求头部存在,添加请求头部信息
|
||||
if (head != null)
|
||||
foreach (string key in head.Keys)
|
||||
{
|
||||
// 遍历传入的头部字典,逐项设置请求头部
|
||||
request.SetRequestHeader(key, head[key]);
|
||||
}
|
||||
|
||||
// 设置已存储的 Cookie
|
||||
if (cookieJar.Count > 0)
|
||||
{
|
||||
// 用于存储多个cookie值的字符串
|
||||
string cookieHeader = "";
|
||||
foreach (var cookie in cookieJar)
|
||||
{
|
||||
// 格式化每个cookie为“键=值”的形式,并附加到字符串中,以分号分隔
|
||||
cookieHeader += $"{cookie.Key}={cookie.Value}; ";
|
||||
}
|
||||
// 设置请求头中的Cookie字段
|
||||
request.SetRequestHeader("Cookie", cookieHeader);
|
||||
}
|
||||
|
||||
// 发送请求并等待响应
|
||||
var operation = request.SendWebRequest();
|
||||
while (!operation.isDone)
|
||||
await Task.Yield(); // 等待请求完成,使用await以非阻塞的方式处理
|
||||
|
||||
// 检查是否存在网络错误或协议错误
|
||||
if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError)
|
||||
{
|
||||
// 如果有错误,输出错误信息并返回null
|
||||
Debug.LogError($"Error: {request.error}" + url);
|
||||
// 可以自定义弹窗提示用户错误信息,代码被注释掉了
|
||||
// Promptmgr.Instance.PromptBubble(request.error, Color.black,Color.red);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 处理返回的Cookie
|
||||
string setCookieHeader;
|
||||
string str = request.downloadHandler.text; // 获取服务器返回的文本内容
|
||||
//Debug.Log(str); // 输出返回内容到控制台
|
||||
|
||||
// 尝试获取响应头中的“Set-Cookie”字段
|
||||
if (request.GetResponseHeaders().TryGetValue("Set-Cookie", out setCookieHeader))
|
||||
{
|
||||
// 将“Set-Cookie”字段的内容按分号分隔为多个部分
|
||||
string[] cookies = setCookieHeader.Split(';');
|
||||
foreach (var cookie in cookies)
|
||||
{
|
||||
// 将每个cookie分为“键=值”的形式
|
||||
var cookieParts = cookie.Split('=');
|
||||
if (cookieParts.Length == 2)
|
||||
{
|
||||
string key = cookieParts[0].Trim(); // 去掉键的空格
|
||||
string value = cookieParts[1].Trim(); // 去掉值的空格
|
||||
// 存储到cookieJar中,以备后续请求使用
|
||||
cookieJar[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 返回响应内容(文本形式)
|
||||
return request.downloadHandler.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
meng_yao/Assets/script/serveTestScript/myWeb.cs.meta
Normal file
11
meng_yao/Assets/script/serveTestScript/myWeb.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b0ab5df2b91e2b4883ac767129ce9d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
72
meng_yao/Assets/script/serveTestScript/onlyTest.cs
Normal file
72
meng_yao/Assets/script/serveTestScript/onlyTest.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class onlyTest : MonoBehaviour
|
||||
{
|
||||
bool isSucceed;
|
||||
login login = new login();
|
||||
sendCode sendCode = new sendCode();
|
||||
checkCode checkCode = new checkCode();
|
||||
playerInfo playerInfo = new playerInfo();
|
||||
checkAccount checkAccount = new checkAccount();
|
||||
updatePlayerInfo updatePlayerInfo = new updatePlayerInfo();
|
||||
teamInfo teamInfo = new teamInfo();
|
||||
realNameAuthentication realNameAuthentication = new realNameAuthentication();
|
||||
modifyTradePassword modifyTradePassword = new modifyTradePassword();
|
||||
logout logout = new logout();
|
||||
teamFansList teamFansList = new teamFansList();
|
||||
goldDestroy goldDestroy = new goldDestroy();
|
||||
cancellation cancellation = new cancellation();
|
||||
register register = new register();
|
||||
miningConfig miningConfig = new miningConfig();
|
||||
treeInfo treeInfo = new treeInfo();
|
||||
treeGetWater treeGetWater = new treeGetWater();
|
||||
wateringTree wateringTree = new wateringTree();
|
||||
treeTeamData treeTeamData = new treeTeamData();
|
||||
treeFansList treeFansList = new treeFansList();
|
||||
product_list product_List = new product_list();
|
||||
productBuy productBuy = new productBuy();
|
||||
createOrder createOrder = new createOrder();
|
||||
orderVerification orderVerification = new orderVerification();
|
||||
BillingStatistics BillingStatistics = new BillingStatistics();
|
||||
incomeList incomeList = new incomeList();
|
||||
async void Start()
|
||||
{
|
||||
await login.Login();
|
||||
//await sendCode.SendCode();
|
||||
//await checkCode.CheckCode();
|
||||
//await checkAccount.CheckAccount();
|
||||
//await playerInfo.PalyerInfo();
|
||||
//await updatePlayerInfo.UpdatePlayerInfo("nickname", "°¢Á¼");
|
||||
//await teamInfo.TeamInfo();
|
||||
//await realNameAuthentication.RealNameAuthentication("°¢Á¼","451287369874521475");
|
||||
//await modifyTradePassword.ModifyTradePassword("666666","9527123");
|
||||
//logout.Logout();
|
||||
//teamFansList.TeamFansList();
|
||||
//isSucceed =await goldDestroy.GoldDestroy();
|
||||
//isSucceed = await cancellation.Cancellation();
|
||||
//iningConfigResponse response = await miningConfig.MiningConfig(0);
|
||||
//treeInfo.TreeInfo();
|
||||
//treeGetWater.TreeGetWater(0, "string");
|
||||
|
||||
//TreeTeam treeTeam = await treeTeamData.TreeTeamData();
|
||||
//Debug.Log("=========="+treeTeam.Data.Info.Nickname);
|
||||
//wateringTree.WateringTree();
|
||||
//Debug.Log("========="+isSucceed);
|
||||
//treeFansList.TreeFansList();
|
||||
//productListResponse productListResponse=await product_List.ProductList();
|
||||
//Debug.Log("===========" + productListResponse.Data[1].);
|
||||
//productBuy.BuyProduct(1);
|
||||
//createOrder.CreateOrder(1,1,"1");
|
||||
//orderVerification.OrderVerification(1);
|
||||
//BillingStatistics.billingStatistics(1);
|
||||
incomeList.IncomeList(1,10,1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
meng_yao/Assets/script/serveTestScript/onlyTest.cs.meta
Normal file
11
meng_yao/Assets/script/serveTestScript/onlyTest.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 722d02c1e24962c48b24b0a9453449f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
325
meng_yao/Assets/script/serveTestScript/test1.cs
Normal file
325
meng_yao/Assets/script/serveTestScript/test1.cs
Normal file
@ -0,0 +1,325 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SocialPlatforms;
|
||||
|
||||
public class test1 : MonoBehaviour
|
||||
{
|
||||
public string token;
|
||||
checkAccount checkAccount = new checkAccount();
|
||||
// Start is called before the first frame update
|
||||
async void Start()
|
||||
{
|
||||
//Register();
|
||||
//Login();
|
||||
//Debug.Log(MyGlobal.global.loginResponse.Data.access_token+"====================");
|
||||
|
||||
}
|
||||
// 创建请求头,使用最新的 token
|
||||
public Dictionary<string, string> CreateHeadersTologin()
|
||||
{
|
||||
|
||||
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 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\"}" }
|
||||
};
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======登录=========================================================================================================================
|
||||
//public async void Login()
|
||||
//{
|
||||
// loginBody body = new loginBody();
|
||||
// body.client_id = "app";
|
||||
// body.username = "13502712157";
|
||||
// body.password = "9527123";
|
||||
// body.type = "code";
|
||||
// //Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/login", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
|
||||
// Debug.Log("登录"+response);
|
||||
// loginResponse apifox = JsonConvert.DeserializeObject<loginResponse>(response);
|
||||
// Debug.Log(MyGlobal.global.loginResponse.Data);
|
||||
// MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
|
||||
// Debug.Log(MyGlobal.global.loginResponse.Data.access_token);
|
||||
// //checkAccount.CheckAccount();
|
||||
//}
|
||||
//===============注册=======================================================================================================================
|
||||
//public async void Register()
|
||||
//{
|
||||
// register body = new register();
|
||||
// body.account = "18821995938";
|
||||
// body.password = "A123456";
|
||||
// body.invite_code = "";
|
||||
// body.code = "9527123";
|
||||
// Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========头=========");
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/register", "POST", JsonConvert.SerializeObject(body), CreateHeadersTologin());
|
||||
// Debug.Log("注册"+response);
|
||||
// RegisterResponse register = JsonConvert.DeserializeObject<RegisterResponse>(response);
|
||||
// Debug.Log("=====zhuce======"+register.data.token.expires_in);
|
||||
//}
|
||||
|
||||
//============退出登录============================================================================================
|
||||
//public async void Logout()
|
||||
//{
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/logout", "POST", "{}", CreateHeaders());
|
||||
// Debug.Log("退出登录"+response);
|
||||
//}
|
||||
//==================发送验证码================================================================================
|
||||
//public async Task<bool> SendCode()
|
||||
//{
|
||||
// SendCodeBody body = new SendCodeBody();
|
||||
// body.account = "13502712157";
|
||||
// body.scene = 0;
|
||||
// //Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========头=========");
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/send_code", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
// Debug.Log("发送验证码"+response);
|
||||
// SendCodeResponse sendCode = JsonConvert.DeserializeObject<SendCodeResponse>(response);
|
||||
// myResponse CheckCodeResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
// bool isSucceed;
|
||||
// if (CheckCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//=====================验证码校验===========================================================================
|
||||
//public async Task<bool> CheckCode()
|
||||
//{
|
||||
// CheckCodeBody body = new CheckCodeBody();
|
||||
// body.account = "13502712157";
|
||||
// body.scene = 0;
|
||||
// body.code = "9527123";
|
||||
// //Debug.Log(JsonConvert.SerializeObject(body) + "入参=========");
|
||||
// //Debug.Log(JsonConvert.SerializeObject(CreateHeaders()) + "==========头=========");
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/captcha/verify", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
// Debug.Log("验证码校验"+response);
|
||||
// SendCodeResponse sendCodeResponse = JsonConvert.DeserializeObject<SendCodeResponse>(response);
|
||||
// bool isSucceed;
|
||||
// if (sendCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//==================用户详情====================================================================================
|
||||
//public async Task<PlayerIndfo> PalyerInfo()
|
||||
//{
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/detail", "GET", "{}", CreateHeaders());
|
||||
// Debug.Log("用户详情" + response);
|
||||
// PlayerIndfo playerIndfo = JsonConvert.DeserializeObject<PlayerIndfo>(response);
|
||||
// Debug.Log("======"+playerIndfo.Data.account);
|
||||
// return playerIndfo;
|
||||
//}
|
||||
//==================账号校检【注册前检查】=====================================================================
|
||||
//public async Task<bool> CheckAccount()
|
||||
//{
|
||||
|
||||
// PlayerIndfo playerIndfo =await PalyerInfo();//这里重新定义一个playerinfo变量,重新获取一次PlayerInfo
|
||||
// CheckAccountBody body = new CheckAccountBody();
|
||||
// Debug.Log(playerIndfo.Data.account);
|
||||
// body.account = playerIndfo.Data.account;
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/check_account", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
// Debug.Log("账号校验" + response);
|
||||
// myResponse CheckAccountResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
// bool isSucceed;
|
||||
// if (CheckAccountResponse.code == 200) { isSucceed = true; }else{ isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//======================转增密码设置====================================================================
|
||||
//public async Task<bool> ModifyTradePassword(string newPassword,string code)
|
||||
//{
|
||||
// ModifyTradePasswordBody body = new ModifyTradePasswordBody();
|
||||
// body.code = code;
|
||||
// body.password = newPassword;
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/modify_trade_password", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
// Debug.Log("转增密码设置" + response);
|
||||
// myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
// bool isSucceed;
|
||||
// if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//=========用户信息更新=============================================================================
|
||||
//public async Task<bool> UpdatePlayerInfo(string field, string value)//呢称需要包含中文可以跟字母组合,但必须大于两个//只能更新名字头像
|
||||
//{
|
||||
// string body = $"{{\"{field}\":\"{value}\"}}";
|
||||
// Debug.Log("====="+body);
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/update_info", "POST", body, CreateHeaders());
|
||||
// Debug.Log("用户信息更新" + response);
|
||||
// //myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
// bool isSucceed=true;
|
||||
// //if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//===========实名认证==============================================================================================
|
||||
//public async Task<bool> RealNameAuthentication(string name, string identity_card_no)//呢称需要包含中文可以跟字母组合,但必须大于两个//只能更新名字头像
|
||||
//{
|
||||
// RealNameBody body = new RealNameBody();
|
||||
// body.name = name;
|
||||
// body.identity_card_no = identity_card_no;
|
||||
// Debug.Log("=====" + body);
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/certify/commit", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
// Debug.Log("实名认证" + response);
|
||||
// myResponse RealNameResponse = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
// bool isSucceed = true;
|
||||
// if (RealNameResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
// return isSucceed;
|
||||
//}
|
||||
//===================团队信息========================================================================================
|
||||
//public async Task<TeamInfo> TeamInfo()
|
||||
//{
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders());
|
||||
// Debug.Log("团队信息" + response);
|
||||
// TeamInfo teamInfo = JsonConvert.DeserializeObject<TeamInfo>(response);
|
||||
// Debug.Log(teamInfo.data);
|
||||
// return teamInfo;
|
||||
//}
|
||||
//public async Task<TeamInfoResponse> TeamInfo()
|
||||
//{
|
||||
// string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders());
|
||||
// Debug.Log("团队信息" + response);
|
||||
// TeamInfoResponse teamInfo = JsonConvert.DeserializeObject<TeamInfoResponse>(response);
|
||||
// Debug.Log(teamInfo.Data.Info.Nickname);
|
||||
// return teamInfo;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//====================
|
||||
|
||||
//public class loginBody//登录请求体
|
||||
//{
|
||||
// public string client_id;
|
||||
// public string username;
|
||||
// public string password;
|
||||
// public string type;
|
||||
//}
|
||||
//public class register//注册请求体
|
||||
//{
|
||||
// public string account;
|
||||
// public string password;
|
||||
// public string invite_code;
|
||||
// public string code;
|
||||
//}
|
||||
|
||||
|
||||
//============================================
|
||||
//public class SendCodeBody
|
||||
//{
|
||||
// public string account;
|
||||
// public int scene;
|
||||
//}
|
||||
//public class SendCodeResponse:myResponse
|
||||
//{
|
||||
// public string data;
|
||||
//}
|
||||
//============================================
|
||||
//public class CheckCodeBody
|
||||
//{
|
||||
// public string account;
|
||||
// public int scene;
|
||||
// public string code;
|
||||
//}
|
||||
//=======用户详情返回值===================
|
||||
//public class PlayerIndfo:myResponse
|
||||
//{
|
||||
// public PlayerInfoData Data;
|
||||
//}
|
||||
//public class PlayerInfoData
|
||||
//{
|
||||
// public string uid;
|
||||
// public string account;
|
||||
// public string nickname;
|
||||
// public string avatar_url;
|
||||
// public string invite_code;
|
||||
// public int trade_password_status;
|
||||
// public int certify_status;
|
||||
// public string certify_name;
|
||||
// public string identity_card_no;
|
||||
// public string location;
|
||||
// public int location_status;
|
||||
// public long gem;
|
||||
// public long gold;
|
||||
// public long forge;
|
||||
// public long water;
|
||||
// public int level;
|
||||
// public string level_name;
|
||||
// public string level_icon;
|
||||
//}
|
||||
//============账号校验=======================================================
|
||||
//public class CheckAccountBody
|
||||
//{
|
||||
// public string account;
|
||||
//}
|
||||
//============转增密码设置===============================================
|
||||
//public class ModifyTradePasswordBody
|
||||
//{
|
||||
// public string password;
|
||||
// public string code;
|
||||
//}
|
||||
//================实名认证=============================================
|
||||
//public class RealNameBody
|
||||
//{
|
||||
// public string name;
|
||||
// public string identity_card_no;
|
||||
//}
|
||||
//=========团队信息====================================================
|
||||
|
||||
|
||||
//public class TeamInfoResponse
|
||||
//{
|
||||
// public TeamInfoData Data { get; set; }
|
||||
//}
|
||||
|
||||
//public class TeamInfoData
|
||||
//{
|
||||
// public TeamInfoInfo Info { get; set; }
|
||||
// public List<TeamInfoItem> Items { get; set; }
|
||||
//}
|
||||
|
||||
//public class TeamInfoInfo
|
||||
//{
|
||||
// public string Uid { get; set; }
|
||||
// public string Account { get; set; }
|
||||
// public string Nickname { get; set; }
|
||||
// public string AvatarUrl { get; set; }
|
||||
// public string InviteCode { get; set; }
|
||||
// public int CertifyStatus { get; set; }
|
||||
// public string CreateTime { get; set; }
|
||||
// public string LastLoginTime { get; set; }
|
||||
// public int TeamCount { get; set; }
|
||||
// public int DirectlyCount { get; set; }
|
||||
// public double KpiGold { get; set; }
|
||||
// public double TeamKpiGold { get; set; }
|
||||
// public double TeamMinKpiGold { get; set; }
|
||||
// public int Level { get; set; }
|
||||
// public string LevelName { get; set; }
|
||||
// public string LevelIcon { get; set; }
|
||||
//}
|
||||
|
||||
//public class TeamInfoItem
|
||||
//{
|
||||
// public string Title { get; set; }
|
||||
// public string Desc { get; set; }
|
||||
// public double NowVal { get; set; }
|
||||
// public double ReqVal { get; set; }
|
||||
// public double Percentage { get; set; }
|
||||
// public int Style { get; set; }
|
||||
//}
|
11
meng_yao/Assets/script/serveTestScript/test1.cs.meta
Normal file
11
meng_yao/Assets/script/serveTestScript/test1.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4784d42127f94b846a4e75581ecbbc22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
meng_yao/Assets/script/serveTestScript/treeModule.meta
Normal file
8
meng_yao/Assets/script/serveTestScript/treeModule.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 158cb6c8224d8a64b92366058e9af527
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,69 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//生态树团队粉丝列表
|
||||
public class treeFansList : 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<TreeFansListResponse> TreeFansList()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/team_fans_list", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("生态树团队粉丝列表" + response);
|
||||
TreeFansListResponse treeFansListResponse = JsonConvert.DeserializeObject<TreeFansListResponse>(response);
|
||||
Debug.Log(treeFansListResponse.Data.Pages.TotalCount + "=====================");
|
||||
return treeFansListResponse;
|
||||
}
|
||||
}
|
||||
//======================================================================================================
|
||||
public class TreeFansListResponse:myResponse
|
||||
{
|
||||
public TreeFansListData Data { get; set; }
|
||||
}
|
||||
|
||||
public class TreeFansListData
|
||||
{
|
||||
public TreeFansListPageInfo Pages { get; set; }
|
||||
public List<TreeFansListInfo> List { get; set; }
|
||||
}
|
||||
|
||||
public class TreeFansListPageInfo
|
||||
{
|
||||
public int PageNum { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public int CurrSize { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
|
||||
public class TreeFansListInfo
|
||||
{
|
||||
public string Uid { get; set; }
|
||||
public string Account { get; set; }
|
||||
public string Nickname { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string InviteCode { get; set; }
|
||||
public int CertifyStatus { get; set; }
|
||||
public string CreateTime { get; set; }
|
||||
public string LastLoginTime { get; set; }
|
||||
public int TeamCount { get; set; }
|
||||
public int DirectlyCount { get; set; }
|
||||
public int TeamActiveCount { get; set; }
|
||||
public int DirectlyActiveCount { get; set; }
|
||||
public int Level { get; set; }
|
||||
public string LevelName { get; set; }
|
||||
public string LevelIcon { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40b2b0b626a953143b59b486cf69b31c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,44 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class treeGetWater : 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> TreeGetWater(int index,string transId)
|
||||
{
|
||||
treeGetWaterBody body = new treeGetWaterBody();
|
||||
body.index = index;
|
||||
body.transId = transId;
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/gather", "POST", JsonConvert.SerializeObject(body), CreateHeaders());
|
||||
Debug.Log("生态树水滴采集" + response);
|
||||
//bbbb
|
||||
//bbbb
|
||||
myResponse Response = JsonConvert.DeserializeObject<myResponse>(response);
|
||||
bool isSucceed;
|
||||
if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; }
|
||||
Debug.Log(isSucceed+"==================");
|
||||
return isSucceed;
|
||||
}
|
||||
}
|
||||
//===================================================================================================
|
||||
public class treeGetWaterBody
|
||||
{
|
||||
public int index;
|
||||
public string transId;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a063ae51a6f18d74898f7f7553ca6f8f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,61 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//生态树信息
|
||||
public class treeInfo : 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<TreeInfo> TreeInfo()//类型 0:宝石岛 1:宝石矿场 10:金币岛 11:金币矿场
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/info", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("生态树信息" + response);
|
||||
//bbbb
|
||||
TreeInfo treeInfo = JsonConvert.DeserializeObject<TreeInfo>(response);
|
||||
Debug.Log("=========" + treeInfo.Data.Charts[0].Name);
|
||||
return treeInfo;
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
public class TreeInfo:myResponse
|
||||
{
|
||||
public TreeInfoData Data { get; set; }
|
||||
}
|
||||
|
||||
public class TreeInfoData
|
||||
{
|
||||
public float Water { get; set; }
|
||||
public int Level { get; set; }
|
||||
public int Exp { get; set; }
|
||||
public int UpgradeExp { get; set; }
|
||||
public List<TreeInfoReward> Rewards { get; set; }
|
||||
public string ChartTitle { get; set; }
|
||||
public List<TreeInfoChart> Charts { get; set; }
|
||||
}
|
||||
|
||||
public class TreeInfoReward
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public string RewardValue { get; set; }
|
||||
public int Show { get; set; }
|
||||
}
|
||||
|
||||
public class TreeInfoChart
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Reward { get; set; }
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c8c25b1f69c766468487ea632c5692a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,82 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
//生态树团队信息
|
||||
public class treeTeamData : 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<TreeTeam> TreeTeamData()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/team_data", "GET", "{}", CreateHeaders());
|
||||
Debug.Log("生态树团队信息" + response);
|
||||
|
||||
// 反序列化 JSON
|
||||
TreeTeam TreeTeamResponse = JsonConvert.DeserializeObject<TreeTeam>(response);
|
||||
|
||||
//// 检查反序列化后的数据
|
||||
//if (TreeTeamResponse != null && TreeTeamResponse.Data != null && TreeTeamResponse.Data.Info != null)
|
||||
//{
|
||||
// Debug.Log("用户昵称: " + TreeTeamResponse.Data.Info.Nickname);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Debug.LogError("解析的数据为空,请检查返回的 JSON 格式或内容。");
|
||||
//}
|
||||
|
||||
return TreeTeamResponse;
|
||||
}
|
||||
}
|
||||
//===================================================================
|
||||
public class TreeTeam:myResponse
|
||||
{
|
||||
public TreeTeamData Data { get; set; }
|
||||
}
|
||||
|
||||
public class TreeTeamData
|
||||
{
|
||||
public TreeTeamInfo Info { get; set; }
|
||||
public List<TreeTeamItem> Items { get; set; }
|
||||
}
|
||||
|
||||
public class TreeTeamInfo
|
||||
{
|
||||
public string Uid { get; set; }
|
||||
public string Account { get; set; }
|
||||
public string Nickname { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string InviteCode { get; set; }
|
||||
public int CertifyStatus { get; set; }//实名状态 0:未实名 1:已实名
|
||||
public string CreateTime { get; set; }
|
||||
public string LastLoginTime { get; set; }
|
||||
public int TeamCount { get; set; }
|
||||
public int DirectlyCount { get; set; }
|
||||
public int TeamActiveCount { get; set; }
|
||||
public int DirectlyActiveCount { get; set; }
|
||||
public int Level { get; set; }
|
||||
public string LevelName { get; set; }
|
||||
public string LevelIcon { get; set; }
|
||||
}
|
||||
|
||||
public class TreeTeamItem
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Desc { get; set; }
|
||||
public int NowVal { get; set; }
|
||||
public int ReqVal { get; set; }
|
||||
public string Percentage { get; set; }//百分比进度 1 = 100%
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58988d7246b960145a0d0899e17a2319
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,41 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class wateringTree : 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<WateringTreeResponse> WateringTree()
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/watering", "POST", "{}", CreateHeaders());
|
||||
Debug.Log("生态树浇水" + response);
|
||||
//bbbb
|
||||
WateringTreeResponse wateringTreeResponse = JsonConvert.DeserializeObject<WateringTreeResponse>(response);
|
||||
Debug.Log("=========" + wateringTreeResponse.Data.upgraded);
|
||||
return wateringTreeResponse;
|
||||
}
|
||||
}
|
||||
//======================================================================================================
|
||||
public class WateringTreeResponse : myResponse
|
||||
{
|
||||
public wateringTreeData Data;
|
||||
}
|
||||
public class wateringTreeData
|
||||
{
|
||||
public int upgraded; //胶水后是否升级
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6f3ff7a11b5b2b47970621d8880f95a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user