diff --git a/meng_yao/Assets/Scenes/loading.unity b/meng_yao/Assets/Scenes/loading.unity index c46900a22..66b544172 100644 --- a/meng_yao/Assets/Scenes/loading.unity +++ b/meng_yao/Assets/Scenes/loading.unity @@ -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 diff --git a/meng_yao/Assets/script/ConnactServer.meta b/meng_yao/Assets/script/scene_loading.meta similarity index 100% rename from meng_yao/Assets/script/ConnactServer.meta rename to meng_yao/Assets/script/scene_loading.meta diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs b/meng_yao/Assets/script/scene_loading/Get_a_voucher.cs similarity index 100% rename from meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs rename to meng_yao/Assets/script/scene_loading/Get_a_voucher.cs diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta b/meng_yao/Assets/script/scene_loading/Get_a_voucher.cs.meta similarity index 100% rename from meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta rename to meng_yao/Assets/script/scene_loading/Get_a_voucher.cs.meta diff --git a/meng_yao/Assets/script/ConnactServer/InitInfo.cs b/meng_yao/Assets/script/scene_loading/InitInfo.cs similarity index 100% rename from meng_yao/Assets/script/ConnactServer/InitInfo.cs rename to meng_yao/Assets/script/scene_loading/InitInfo.cs diff --git a/meng_yao/Assets/script/ConnactServer/InitInfo.cs.meta b/meng_yao/Assets/script/scene_loading/InitInfo.cs.meta similarity index 100% rename from meng_yao/Assets/script/ConnactServer/InitInfo.cs.meta rename to meng_yao/Assets/script/scene_loading/InitInfo.cs.meta diff --git a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs b/meng_yao/Assets/script/scene_loading/JinShaBuy.cs similarity index 100% rename from meng_yao/Assets/script/ConnactServer/JinShaBuy.cs rename to meng_yao/Assets/script/scene_loading/JinShaBuy.cs diff --git a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs.meta b/meng_yao/Assets/script/scene_loading/JinShaBuy.cs.meta similarity index 100% rename from meng_yao/Assets/script/ConnactServer/JinShaBuy.cs.meta rename to meng_yao/Assets/script/scene_loading/JinShaBuy.cs.meta diff --git a/meng_yao/Assets/script/ConnactServer/Logo_in.cs b/meng_yao/Assets/script/scene_loading/Logo_in.cs similarity index 100% rename from meng_yao/Assets/script/ConnactServer/Logo_in.cs rename to meng_yao/Assets/script/scene_loading/Logo_in.cs diff --git a/meng_yao/Assets/script/ConnactServer/Logo_in.cs.meta b/meng_yao/Assets/script/scene_loading/Logo_in.cs.meta similarity index 100% rename from meng_yao/Assets/script/ConnactServer/Logo_in.cs.meta rename to meng_yao/Assets/script/scene_loading/Logo_in.cs.meta diff --git a/meng_yao/Assets/script/scene_loading/loading_jiekou.cs b/meng_yao/Assets/script/scene_loading/loading_jiekou.cs new file mode 100644 index 000000000..4fd8bd07a --- /dev/null +++ b/meng_yao/Assets/script/scene_loading/loading_jiekou.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; + +public class loading_jiekou : MonoBehaviour +{ + + + /// + /// 实名认证会返回是否成功 + /// + /// + /// + /// + public async Task RealNameAuthentication(string name, string identity_card_no) + { + realNameAuthentication _realNameAuthentication = new realNameAuthentication(); + return await _realNameAuthentication.RealNameAuthentication(name, identity_card_no); + } + + +} diff --git a/meng_yao/Assets/script/scene_loading/loading_jiekou.cs.meta b/meng_yao/Assets/script/scene_loading/loading_jiekou.cs.meta new file mode 100644 index 000000000..f096c8ba2 --- /dev/null +++ b/meng_yao/Assets/script/scene_loading/loading_jiekou.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8a0d55335aa2244abba9eff5c8cbe29 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript.meta b/meng_yao/Assets/script/serveTestScript.meta new file mode 100644 index 000000000..756981800 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 35404d9fcb3b7a54bacef588c7070d53 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/CaptchaModule.meta b/meng_yao/Assets/script/serveTestScript/CaptchaModule.meta new file mode 100644 index 000000000..a6cebe59d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/CaptchaModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a220fdc46be916d4395e040d8f7af9bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs b/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs new file mode 100644 index 000000000..3750d0e93 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(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; +} diff --git a/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs.meta b/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs.meta new file mode 100644 index 000000000..41bf61167 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/CaptchaModule/checkCode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: adde8b208a0368649a804693c383a0ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs b/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs new file mode 100644 index 000000000..1803ffda6 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + myResponse CheckCodeResponse = JsonConvert.DeserializeObject(response); + bool isSucceed; + if (CheckCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} diff --git a/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs.meta b/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs.meta new file mode 100644 index 000000000..b50c48f4e --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/CaptchaModule/sendCode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a81650988fd3f7043881e44fcb834d83 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/MyGlobal.cs b/meng_yao/Assets/script/serveTestScript/MyGlobal.cs new file mode 100644 index 000000000..339f3c9f4 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/MyGlobal.cs @@ -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 CreateHeaders() + { + + return new Dictionary + { + {"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; +} +//============================================================ \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/MyGlobal.cs.meta b/meng_yao/Assets/script/serveTestScript/MyGlobal.cs.meta new file mode 100644 index 000000000..2748fd0b4 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/MyGlobal.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59ff8dcd92c3dd54e92e6e06ff63654d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule.meta b/meng_yao/Assets/script/serveTestScript/UserModule.meta new file mode 100644 index 000000000..d2a3af308 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f62b66baa609d974eb8b781dadd24d52 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs b/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs new file mode 100644 index 000000000..142acefd4 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 Cancellation() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/user/cancellation", "POST", "{}", CreateHeaders()); + Debug.Log("账户注销" + response); + //bbb + myResponse cancellationResponse = JsonConvert.DeserializeObject(response); + bool isSucceed; + if (cancellationResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs.meta new file mode 100644 index 000000000..7146bad0d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/cancellation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0508da1832c891f429331478af516ef3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs b/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs new file mode 100644 index 000000000..a3eab040d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + bool isSucceed; + if (CheckAccountResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} +//================================================================= +public class CheckAccountBody +{ + public string account; +} diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs.meta new file mode 100644 index 000000000..3769aaf52 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/checkAccount.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3124d58a617a844cad1207f4f7e2778 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs b/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs new file mode 100644 index 000000000..c5f1689ce --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 GoldDestroy() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/user/gold_destroy", "POST", "{}", CreateHeaders()); + Debug.Log("级别个人金币销毁" + response); + //bbbb + myResponse LogoutResponse = JsonConvert.DeserializeObject(response); + bool isSucceed; + if (LogoutResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs.meta new file mode 100644 index 000000000..0b7028e2d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/goldDestroy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d70d882949d8e2d46a9327aa4b399613 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs b/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs new file mode 100644 index 000000000..1e102fb79 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + bool isSucceed; + if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} +//============================================================================ +public class ModifyTradePasswordBody +{ + public string password; + public string code; +} diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs.meta new file mode 100644 index 000000000..f676f0faa --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/modifyTradePassword.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3a9fd1b61ce73046bd9c84a81e20019 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs b/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs new file mode 100644 index 000000000..ae4f60800 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 PalyerInfo() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/user/detail", "GET", "{}", CreateHeaders()); + Debug.Log("用户详情" + response); + PlayerIndfo playerIndfo = JsonConvert.DeserializeObject(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; +} diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs.meta new file mode 100644 index 000000000..d26a12689 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/playerInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cce4b49086e0ad142882a03fc1b340b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs b/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs new file mode 100644 index 000000000..dcea8883b --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(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; +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs.meta new file mode 100644 index 000000000..4e8c6e432 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/realNameAuthentication.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f6c1847b2bfb83043bff6cef757b0d4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/register.cs b/meng_yao/Assets/script/serveTestScript/UserModule/register.cs new file mode 100644 index 000000000..75bf7f77a --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/register.cs @@ -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 CreateHeadersTologin() + { + + return new Dictionary + { + + //{ "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 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(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; +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/register.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/register.cs.meta new file mode 100644 index 000000000..b1e685021 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/register.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f997c00bc633a5a4e8f6c03753da7b61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs b/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs new file mode 100644 index 000000000..a4fd446b9 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_fans_list", "GET", "{}", CreateHeaders()); + Debug.Log("团队粉丝列表" + response); + TeamFansList teamFansList = JsonConvert.DeserializeObject(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 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs.meta new file mode 100644 index 000000000..1fdfa4537 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/teamFansList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f15fc2feaa1e8144b8d2fabc5bcc851 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs b/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs new file mode 100644 index 000000000..312508ac1 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 TeamInfo() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders()); + Debug.Log("团队信息" + response); + TeamInfoResponse teamInfo = JsonConvert.DeserializeObject(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 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs.meta new file mode 100644 index 000000000..6475d3870 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/teamInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc3b6c4cdcf95ad458f948c1b3259a9f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs b/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs new file mode 100644 index 000000000..8928530c0 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +//用户信息更新 +public class updatePlayerInfo : MonoBehaviour +{ + public Dictionary CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + bool isSucceed = true; + //if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + return isSucceed; + } +} +//================================================================================= \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs.meta b/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs.meta new file mode 100644 index 000000000..262f5da25 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/UserModule/updatePlayerInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b9ade750da4a5b409fb99be6342dd56 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/billsModule.meta b/meng_yao/Assets/script/serveTestScript/billsModule.meta new file mode 100644 index 000000000..191f8accb --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/billsModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cc8375dabe66014eb0dced18ccdb991 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs b/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs new file mode 100644 index 000000000..6ca800187 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 billingStatistics(int type) + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/log/income/statistics/" + type, "GET", "{}", CreateHeaders()); + Debug.Log("账单统计" + response); + billingStatisticsResponse billingStatisticsResponse = JsonConvert.DeserializeObject(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; } +} diff --git a/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs.meta b/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs.meta new file mode 100644 index 000000000..95e4ea100 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/billsModule/BillingStatistics.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 878d23bff8b85a24c84309378c0e2bc9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs new file mode 100644 index 000000000..afeb2de9d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(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 List { get; set; } + public List 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs.meta b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs.meta new file mode 100644 index 000000000..2d9ea628c --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d933ebe91c1db545a3ed77156fdf6bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/loginModule.meta b/meng_yao/Assets/script/serveTestScript/loginModule.meta new file mode 100644 index 000000000..53faaeb65 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/loginModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 443b913bccaae6048824ec60327d1f0a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/loginModule/login.cs b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs new file mode 100644 index 000000000..2ea0854fa --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs @@ -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 CreateHeadersTologin() + { + return new Dictionary + { + + //{ "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 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(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; +} diff --git a/meng_yao/Assets/script/serveTestScript/loginModule/login.cs.meta b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs.meta new file mode 100644 index 000000000..2b625220a --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f26d1298071a794d920a442e507d495 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs b/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs new file mode 100644 index 000000000..c27f5df12 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 Logout() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/oauth/logout", "POST", "{}", CreateHeaders()); + Debug.Log("退出登录" + response); + myResponse LogoutResponse = JsonConvert.DeserializeObject(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; +} diff --git a/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs.meta b/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs.meta new file mode 100644 index 000000000..b8bf99bd0 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/loginModule/logout.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6ba73cf8b3e42144968b940befa80d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/miningModule.meta b/meng_yao/Assets/script/serveTestScript/miningModule.meta new file mode 100644 index 000000000..712e062e6 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/miningModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f69906ef3172ce84dbc3e9b0370d838e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs b/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs new file mode 100644 index 000000000..3bf74503b --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + //Debug.Log("======kc================" + miningConfigResponse.Data[0].Name); + return miningConfigResponse; + } +} diff --git a/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs.meta b/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs.meta new file mode 100644 index 000000000..06b2ec930 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/miningModule/miningActivate.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3c23cb91b6a6bf4295ccc33d6213e14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs b/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs new file mode 100644 index 000000000..c388e21d3 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + //Debug.Log("======kc================" + miningConfigResponse.Data[0].Name); + return miningConfigResponse; + } +} +//============================================================================== +public class MiningConfigResponse:myResponse +{ + public List 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs.meta b/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs.meta new file mode 100644 index 000000000..75811a5f3 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/miningModule/miningConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79cb4ecf6bf93a0478aeef0757dd05b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule.meta b/meng_yao/Assets/script/serveTestScript/moneyModule.meta new file mode 100644 index 000000000..302e3e4fc --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a308bf2df08f44940992995620c6f528 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs b/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs new file mode 100644 index 000000000..2233b71f9 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(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 +//支付渠道 + diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs.meta b/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs.meta new file mode 100644 index 000000000..94ff30cc9 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/createOrder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 73b32b8e0b7c1704c84b324e937a2092 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs b/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs new file mode 100644 index 000000000..aa1f57aac --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 OrderVerification(int tradeNo) + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/payment/order/verify/"+tradeNo, "POST", "{}", CreateHeaders()); + Debug.Log("支付订单验证" + response); + myResponse Response = JsonConvert.DeserializeObject(response); + bool isSucceed; + if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; } + Debug.Log(isSucceed + "=================="); + return isSucceed; + } +} diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs.meta b/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs.meta new file mode 100644 index 000000000..6a88b9aa0 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/orderVerification.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4abb6277b2d01646be048ad20c468ac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs b/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs new file mode 100644 index 000000000..1c36587e2 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(response); + bool isSucceed; + if (Response.code == 200) { isSucceed = true; } else { isSucceed = false; } + Debug.Log(isSucceed + "=================="); + return isSucceed; + } +} +//===================================================================================================================================== +public class BuyProductBody +{ + public int id; +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs.meta b/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs.meta new file mode 100644 index 000000000..f6eda45f2 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/productBuy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2d09378528bd9644a21b782f432a564 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs b/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs new file mode 100644 index 000000000..1fde9164a --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 ProductList() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/recharge/product_list", "GET", "{}", CreateHeaders()); + Debug.Log("产品列表" + response); + productListResponse productListResponse = JsonConvert.DeserializeObject(response); + //Debug.Log(productListResponse.Data[0].Name + "====================="); + return productListResponse; + } +} +//==================================================================================================================================== +public class productListResponse:myResponse +{ + public List 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:翻倍 +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs.meta b/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs.meta new file mode 100644 index 000000000..6ed5aaa04 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/moneyModule/product_list.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 212a643aece633c4c9bcfc30e0c4d3d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/myWeb.cs b/meng_yao/Assets/script/serveTestScript/myWeb.cs new file mode 100644 index 000000000..8a7dd8227 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/myWeb.cs @@ -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 cookieJar = new Dictionary(); + + // 发送HTTP请求的方法,支持GET和POST等不同的请求方式 + public static async Task SendRequest(string url, string method = "GET", string jsonData = "{}", Dictionary 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; + } + } + } +} diff --git a/meng_yao/Assets/script/serveTestScript/myWeb.cs.meta b/meng_yao/Assets/script/serveTestScript/myWeb.cs.meta new file mode 100644 index 000000000..83b83b0f5 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/myWeb.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9b0ab5df2b91e2b4883ac767129ce9d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/onlyTest.cs b/meng_yao/Assets/script/serveTestScript/onlyTest.cs new file mode 100644 index 000000000..234067f6d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/onlyTest.cs @@ -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() + { + + } +} diff --git a/meng_yao/Assets/script/serveTestScript/onlyTest.cs.meta b/meng_yao/Assets/script/serveTestScript/onlyTest.cs.meta new file mode 100644 index 000000000..1f5564092 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/onlyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 722d02c1e24962c48b24b0a9453449f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/test1.cs b/meng_yao/Assets/script/serveTestScript/test1.cs new file mode 100644 index 000000000..b2932a9b4 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/test1.cs @@ -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 CreateHeadersTologin() + { + + return new Dictionary + { + + //{ "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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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(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(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 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(response); + // myResponse CheckCodeResponse = JsonConvert.DeserializeObject(response); + // bool isSucceed; + // if (CheckCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + // return isSucceed; + //} + //=====================验证码校验=========================================================================== + //public async Task 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(response); + // bool isSucceed; + // if (sendCodeResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + // return isSucceed; + //} + //==================用户详情==================================================================================== + //public async Task PalyerInfo() + //{ + // string response = await myWeb.SendRequest(myWeb.URL + "/api/user/detail", "GET", "{}", CreateHeaders()); + // Debug.Log("用户详情" + response); + // PlayerIndfo playerIndfo = JsonConvert.DeserializeObject(response); + // Debug.Log("======"+playerIndfo.Data.account); + // return playerIndfo; + //} + //==================账号校检【注册前检查】===================================================================== + //public async Task 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(response); + // bool isSucceed; + // if (CheckAccountResponse.code == 200) { isSucceed = true; }else{ isSucceed = false; } + // return isSucceed; + //} + //======================转增密码设置==================================================================== + //public async Task 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(response); + // bool isSucceed; + // if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + // return isSucceed; + //} + //=========用户信息更新============================================================================= + //public async Task 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(response); + // bool isSucceed=true; + // //if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + // return isSucceed; + //} + //===========实名认证============================================================================================== + //public async Task 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(response); + // bool isSucceed = true; + // if (RealNameResponse.code == 200) { isSucceed = true; } else { isSucceed = false; } + // return isSucceed; + //} + //===================团队信息======================================================================================== + //public async Task TeamInfo() + //{ + // string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders()); + // Debug.Log("团队信息" + response); + // TeamInfo teamInfo = JsonConvert.DeserializeObject(response); + // Debug.Log(teamInfo.data); + // return teamInfo; + //} + //public async Task TeamInfo() + //{ + // string response = await myWeb.SendRequest(myWeb.URL + "/api/user/team_data", "GET", "{}", CreateHeaders()); + // Debug.Log("团队信息" + response); + // TeamInfoResponse teamInfo = JsonConvert.DeserializeObject(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 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; } +//} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/test1.cs.meta b/meng_yao/Assets/script/serveTestScript/test1.cs.meta new file mode 100644 index 000000000..6eb260a09 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/test1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4784d42127f94b846a4e75581ecbbc22 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule.meta b/meng_yao/Assets/script/serveTestScript/treeModule.meta new file mode 100644 index 000000000..d0c6d6c07 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 158cb6c8224d8a64b92366058e9af527 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs b/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs new file mode 100644 index 000000000..e00a8b279 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 TreeFansList() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/team_fans_list", "GET", "{}", CreateHeaders()); + Debug.Log("生态树团队粉丝列表" + response); + TreeFansListResponse treeFansListResponse = JsonConvert.DeserializeObject(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 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs.meta b/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs.meta new file mode 100644 index 000000000..59faa81ff --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeFansList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40b2b0b626a953143b59b486cf69b31c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs b/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs new file mode 100644 index 000000000..9b189be7c --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 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(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; +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs.meta b/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs.meta new file mode 100644 index 000000000..2969cf5d8 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeGetWater.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a063ae51a6f18d74898f7f7553ca6f8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs b/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs new file mode 100644 index 000000000..87042cd52 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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()//类型 0:宝石岛 1:宝石矿场 10:金币岛 11:金币矿场 + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/info", "GET", "{}", CreateHeaders()); + Debug.Log("生态树信息" + response); + //bbbb + TreeInfo treeInfo = JsonConvert.DeserializeObject(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 Rewards { get; set; } + public string ChartTitle { get; set; } + public List 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; } +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs.meta b/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs.meta new file mode 100644 index 000000000..89e2d0b3d --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c8c25b1f69c766468487ea632c5692a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs b/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs new file mode 100644 index 000000000..80f4a6a5b --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 TreeTeamData() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/team_data", "GET", "{}", CreateHeaders()); + Debug.Log("生态树团队信息" + response); + + // 反序列化 JSON + TreeTeam TreeTeamResponse = JsonConvert.DeserializeObject(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 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% +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs.meta b/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs.meta new file mode 100644 index 000000000..7333b60e0 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/treeTeamData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58988d7246b960145a0d0899e17a2319 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs b/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs new file mode 100644 index 000000000..f09b4af1a --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs @@ -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 CreateHeaders() + { + if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token)) + { + Debug.LogWarning("尝试创建请求头时,token 未设置。"); + return new Dictionary(); + } + return new Dictionary + { + + { "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 WateringTree() + { + string response = await myWeb.SendRequest(myWeb.URL + "/api/tree/watering", "POST", "{}", CreateHeaders()); + Debug.Log("生态树浇水" + response); + //bbbb + WateringTreeResponse wateringTreeResponse = JsonConvert.DeserializeObject(response); + Debug.Log("=========" + wateringTreeResponse.Data.upgraded); + return wateringTreeResponse; + } +} +//====================================================================================================== +public class WateringTreeResponse : myResponse +{ + public wateringTreeData Data; +} +public class wateringTreeData +{ + public int upgraded; //胶水后是否升级 +} \ No newline at end of file diff --git a/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs.meta b/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs.meta new file mode 100644 index 000000000..c6f107350 --- /dev/null +++ b/meng_yao/Assets/script/serveTestScript/treeModule/wateringTree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6f3ff7a11b5b2b47970621d8880f95a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: