From 16bd0e17057df5616706ff9fa3ac706587364192 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 18 七月 2023 14:55:59 +0800 Subject: [PATCH] 告警推送,加密逻辑判断优化 --- Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs | 18 ++ Crabtree/ON/Aliyu/AliyuLogProducerClient.cs | 133 +++++++++++++++++++ Crabtree/SmartHome.sln | 14 ++ Crabtree/ON/Aliyu/LogBean.cs | 77 +++++++++++ Crabtree/ON/Properties/AndroidManifest.xml | 2 Crabtree/ON/Aliyu/AliyuLogUtil.cs | 107 +++++++++++++++ Crabtree/ON/ON.Droid.csproj | 11 + Crabtree/ON/Aliyu/Level.cs | 10 + Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs | 14 ++ Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs | 26 +- Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 2 11 files changed, 398 insertions(+), 16 deletions(-) diff --git a/Crabtree/ON/Aliyu/AliyuLogProducerClient.cs b/Crabtree/ON/Aliyu/AliyuLogProducerClient.cs new file mode 100644 index 0000000..2aa9a47 --- /dev/null +++ b/Crabtree/ON/Aliyu/AliyuLogProducerClient.cs @@ -0,0 +1,133 @@ +锘縰sing System; +using Android.Content; +using Com.Aliyun.Sls.Android.Producer; +using Java.IO; + +namespace HDL_ON_Android.Aliyu +{ + public class AliyuLogProducerClient : Java.Lang.Object, ILogProducerCallback + { + private static string TAG = "ProducerClient"; + LogProducerClient client = null; + private Context context; + protected string endpoint; + protected string logProject; + protected string logStore; + protected string accessKeyId; + protected string accessKeySecret; + protected string accessKeyToken; + protected string pluginAppId; + + public AliyuLogProducerClient(Context context, string endpoint, string logProject, string logStore, string accessKeyId, string accessKeySecret, string accessKeyToken, string pluginAppId) + { + this.context = context; + this.endpoint = endpoint; + this.logProject = logProject; + this.logStore = logStore; + this.accessKeyId = accessKeyId; + this.accessKeySecret = accessKeySecret; + this.accessKeyToken = accessKeyToken; + this.pluginAppId = pluginAppId; + } + + + public void initProducer() + { + try + { + // endpoint 蹇呴』鏄互 https:// 鎴� http:// 寮�澶寸殑閾炬帴 + string endpoint = this.endpoint; + string project = this.logProject; + string logstore = this.logStore; + string accessKeyId = this.accessKeyId; + string accessKeySecret = this.accessKeySecret; + string accessKeyToken = this.accessKeyToken; + + LogProducerConfig config = new LogProducerConfig(context, endpoint, project, logstore, accessKeyId, accessKeySecret, accessKeyToken); + // 璁剧疆涓婚 + config.SetTopic("test_topic"); + // 璁剧疆tag淇℃伅锛屾tag浼氶檮鍔犲湪姣忔潯鏃ュ織涓� + config.AddTag("test", "test_tag"); + // 姣忎釜缂撳瓨鐨勬棩蹇楀寘鐨勫ぇ灏忎笂闄愶紝鍙栧�间负1~5242880锛屽崟浣嶄负瀛楄妭銆傞粯璁や负1024 * 1024 + config.SetPacketLogBytes(1024 * 1024); + // 姣忎釜缂撳瓨鐨勬棩蹇楀寘涓寘鍚棩蹇楁暟閲忕殑鏈�澶у�硷紝鍙栧�间负1~4096锛岄粯璁や负1024 + config.SetPacketLogCount(1024); + // 琚紦瀛樻棩蹇楃殑鍙戦�佽秴鏃舵椂闂达紝濡傛灉缂撳瓨瓒呮椂锛屽垯浼氳绔嬪嵆鍙戦�侊紝鍗曚綅涓烘绉掞紝榛樿涓�3000 + config.SetPacketTimeout(3000); + // 鍗曚釜Producer Client瀹炰緥鍙互浣跨敤鐨勫唴瀛樼殑涓婇檺锛岃秴鍑虹紦瀛樻椂add_log鎺ュ彛浼氱珛鍗宠繑鍥炲け璐� + // 榛樿涓�64 * 1024 * 1024 + config.SetMaxBufferLimit(64 * 1024 * 1024); + // 鍙戦�佺嚎绋嬫暟锛岄粯璁や负1 + config.SetSendThreadCount(1); + + //缃戠粶杩炴帴瓒呮椂鏃堕棿锛屾暣鏁帮紝鍗曚綅绉掞紝榛樿涓�10 + config.SetConnectTimeoutSec(10); + //鏃ュ織鍙戦�佽秴鏃舵椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负15 + config.SetSendTimeoutSec(10); + //flusher绾跨▼閿�姣佹渶澶х瓑寰呮椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负1 + config.SetDestroyFlusherWaitSec(2); + //sender绾跨▼姹犻攢姣佹渶澶х瓑寰呮椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负1 + config.SetDestroySenderWaitSec(2); + //鏁版嵁涓婁紶鏃剁殑鍘嬬缉绫诲瀷锛岄粯璁や负LZ4鍘嬬缉锛�0 涓嶅帇缂╋紝1 LZ4鍘嬬缉锛岄粯璁や负1 + config.SetCompressType(1); + //璁惧鏃堕棿涓庢爣鍑嗘椂闂翠箣宸紝鍊间负鏍囧噯鏃堕棿-璁惧鏃堕棿锛屼竴鑸绉嶆儏鍐电敤鎴峰鎴风璁惧鏃堕棿涓嶅悓姝ョ殑鍦烘櫙 + //鏁存暟锛屽崟浣嶇锛岄粯璁や负0锛涙瘮濡傚綋鍓嶈澶囨椂闂翠负1607064208, 鏍囧噯鏃堕棿涓�1607064308锛屽垯鍊艰缃负 1607064308 - 1607064208 = 10 + config.SetNtpTimeOffset(3); + //鏃ュ織鏃堕棿涓庢湰鏈烘椂闂翠箣宸紝瓒呰繃璇ュぇ灏忓悗浼氭牴鎹� `drop_delay_log` 閫夐」杩涜澶勭悊銆� + //涓�鑸绉嶆儏鍐靛彧浼氬湪璁剧疆persistent鐨勬儏鍐典笅鍑虹幇锛屽嵆璁惧涓嬬嚎鍚庯紝瓒呰繃鍑犲ぉ/鏁版湀鍚姩锛屽彂閫侀��鍑哄墠鏈彂鍑虹殑鏃ュ織 + //鏁存暟锛屽崟浣嶇锛岄粯璁や负7*24*3600锛屽嵆7澶� + config.SetMaxLogDelayTime(7 * 24 * 3600); + //瀵逛簬瓒呰繃 `max_log_delay_time` 鏃ュ織鐨勫鐞嗙瓥鐣� + //0 涓嶄涪寮冿紝鎶婃棩蹇楁椂闂翠慨鏀逛负褰撳墠鏃堕棿; 1 涓㈠純锛岄粯璁や负 1 锛堜涪寮冿級 + config.SetDropDelayLog(0); + //鏄惁涓㈠純閴存潈澶辫触鐨勬棩蹇楋紝0 涓嶄涪寮冿紝1涓㈠純 + //榛樿涓� 0锛屽嵆涓嶄涪寮� + config.SetDropUnauthorizedLog(0); + // 鏄惁浣跨敤涓荤嚎绋嬪洖璋� + // false: 浣跨敤涓荤嚎绋嬪洖璋冦�傚洖璋冧細鍦ㄤ富绾跨▼涓婃墽琛岋紝涓旀瘡涓� client 閮芥湁鑷繁鍗曠嫭鐨勫洖璋冦�� + // true: 浣跨敤 sender 绾跨▼鍥炶皟銆傚洖璋冧細鍦� sender 鐜板憟涓婃墽琛岋紝姣忔鎵ц鍥炶皟鏃堕兘浼� attach 涓�涓柊鐨� java 绾跨▼锛屾墍鏈� client 鍏辩敤涓�涓洖璋冦�� + // 娉ㄦ剰锛氶粯璁や娇鐢� sender 绾跨▼鍥炶皟銆� + config.SetCallbackFromSenderThread(false); + + /** + * 浠ヤ笅涓哄紑鍚柇鐐圭画浼犵殑閰嶇疆, 鎸夌収濡備笅閰嶇疆寮�鍚柇鐐圭画浼犲姛鑳藉悗, 鏃ュ織浼氬厛缂撳瓨鍒版湰鍦� + */ + // 1 寮�鍚柇鐐圭画浼犲姛鑳斤紝 0 鍏抽棴 + // 姣忔鍙戦�佸墠浼氭妸鏃ュ織淇濆瓨鍒版湰鍦扮殑binlog鏂囦欢锛屽彧鏈夊彂閫佹垚鍔熸墠浼氬垹闄わ紝淇濊瘉鏃ュ織涓婁紶At Least Once + config.SetPersistent(1); + // 鎸佷箙鍖栫殑鏂囦欢鍚嶏紝闇�瑕佷繚璇佹枃浠舵墍鍦ㄧ殑鏂囦欢澶瑰凡鍒涘缓銆� + // !!!!!!!!!!!!!!!!!!!娉ㄦ剰!!!!!!!!!!!!!!!!!!! + // 閰嶇疆澶氫釜瀹㈡埛绔椂锛屼笉搴旇缃浉鍚屾枃浠� + config.SetPersistentFilePath(context.FilesDir + string.Format("%slog_data.dat", File.Separator)); + // 鏄惁姣忔AddLog寮哄埗鍒锋柊锛岄珮鍙潬鎬у満鏅缓璁墦寮� + config.SetPersistentForceFlush(0); + // 鎸佷箙鍖栨枃浠舵粴鍔ㄤ釜鏁帮紝寤鸿璁剧疆鎴�10銆� + config.SetPersistentMaxFileCount(10); + // 姣忎釜鎸佷箙鍖栨枃浠剁殑澶у皬锛屽缓璁缃垚1-10M + config.SetPersistentMaxFileSize(1024 * 1024); + // 鏈湴鏈�澶氱紦瀛樼殑鏃ュ織鏁帮紝涓嶅缓璁秴杩�1M锛岄�氬父璁剧疆涓�65536鍗冲彲 + config.SetPersistentMaxLogCount(65536); + + client = new LogProducerClient(config, this); + } + catch (LogProducerException e) + { + + } + + } + public void sendLog(Log log) + { + LogProducerResult result = client.AddLog(log); + } + //callback涓哄彲閫夐厤缃�, 濡傛灉涓嶉渶瑕佸叧娉ㄦ棩蹇楃殑鍙戦�佹垚鍔熸垨澶辫触鐘舵��, 鍙互涓嶆敞鍐� callback + public void OnCall(int resultCode, string reqId, string errorMessage, int logBytes, int compressedBytes) + { + // // resultCode: 鐘舵�佺爜, 璇﹁ LogProducerResult + // // reqId: 璇锋眰Id, 宸茬粡搴熷純 + // // errorMessage: 澶辫触淇℃伅 + // // logBytes: 鏃ュ織鍘熷瀛楄妭鏁� + // // compressedBytes: 鏃ュ織鍘嬬缉瀛楄妭鏁� + } + } +} \ No newline at end of file diff --git a/Crabtree/ON/Aliyu/AliyuLogUtil.cs b/Crabtree/ON/Aliyu/AliyuLogUtil.cs new file mode 100644 index 0000000..1dd0f67 --- /dev/null +++ b/Crabtree/ON/Aliyu/AliyuLogUtil.cs @@ -0,0 +1,107 @@ +锘縰sing System; +using Android.Content; +using Com.Aliyun.Sls.Android.Producer; + +namespace HDL_ON_Android.Aliyu +{ + public class AliyuLogUtil + { + private static AliyuLogProducerClient exceptionProducerClient; + private static LogBean logBean; + + private static Object lockObj = new object (); + + private static AliyuLogProducerClient getExceptionProducerClient() + { + lock (lockObj) + { + if (exceptionProducerClient == null) + { + if (Shared.Application.Activity == null) { + return null; + } + exceptionProducerClient = new AliyuLogProducerClient(Shared.Application.Activity, "https://cn-hangzhou.log.aliyuncs.com", "hdl-crabtree-log", "log","LTAI5tLzDxrtsFyi3xtK3YWt", "eX31JZrRAvC2wZWPiZU0SYhlfAUMoT", null, null); + exceptionProducerClient.initProducer(); + } + return exceptionProducerClient; + } + } + + + /** + * 寮傚父鏃ュ織 + * + * @param title 鏍囬 + * @param content 闄勫姞鏁版嵁鍐呭 + * @param level 鎶ヨ绛夌骇 + */ + public static void log(string title, string content, Level level) + { + log(title, content, level, null); + } + /** + * 寮傚父鏃ュ織 + * + * @param title 鏍囬 + * @param content 闄勫姞鏁版嵁鍐呭 + * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ + * @param level 鎶ヨ绛夌骇 + * @param type 寮傚父绫诲瀷 + */ + public static void log(string title, string content, Level level, string type) + { + log(title, content, level, null, null); + } + /** + * 寮傚父鏃ュ織 + * + * @param title 鏍囬 + * @param content 闄勫姞鏁版嵁鍐呭 + * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ + * @param level 鎶ヨ绛夌骇 + * @param type 寮傚父绫诲瀷 + * @param exceptionBlock 寮傚父浠g爜鍧� + */ + public static void log(string title, string content, Level level, string type, string exceptionBlock) + { + /** + * 娌℃湁homeId鍜寀serId 涓嶅厑璁镐笂浼� 鍙笂浼犱綇瀹呴噷闈㈢殑寮傚父 鍑忓皯浜戠鍘嬪姏 + * 1.鐐瑰嚮椤圭洰鐨勬椂鍊欒缃� + * 2.鍏抽棴浣忓畢椤甸潰鐨勬椂鍊欏幓鎺� + */ + if (string.IsNullOrEmpty(getLogBean.getUserId()) || string.IsNullOrEmpty(getLogBean.getHomeId())) + { + return; + } + Log log = new Log(); + log.PutContent("title", title); + log.PutContent("content", content); + log.PutContent("level", level.ToString()); + log.PutContent("userId", getLogBean.getUserId()); + log.PutContent("homeId", getLogBean.getHomeId()); + log.PutContent("time", System.DateTime.UtcNow + ""); + log.PutContent("userAgent", getLogBean.getUserAgent()); + log.PutContent("appVersion", getLogBean.getAppVersion()); + log.PutContent("type", type); + log.PutContent("exceptionBlock", exceptionBlock); + + var producerClient = getExceptionProducerClient(); + if (producerClient == null) + { + return; + } + producerClient.sendLog(log); + + } + + public static LogBean getLogBean + { + get { + if (logBean == null) { + logBean = new LogBean(); + } + return logBean; + } + } + } +} \ No newline at end of file diff --git a/Crabtree/ON/Aliyu/Level.cs b/Crabtree/ON/Aliyu/Level.cs new file mode 100644 index 0000000..729a6e6 --- /dev/null +++ b/Crabtree/ON/Aliyu/Level.cs @@ -0,0 +1,10 @@ +锘縰sing System; +namespace HDL_ON_Android.Aliyu +{ + public enum Level + { + high,//楂� + middle,//涓� + low//浣� + } +} diff --git a/Crabtree/ON/Aliyu/LogBean.cs b/Crabtree/ON/Aliyu/LogBean.cs new file mode 100644 index 0000000..e1fd76c --- /dev/null +++ b/Crabtree/ON/Aliyu/LogBean.cs @@ -0,0 +1,77 @@ +锘縰sing System; +namespace HDL_ON_Android.Aliyu +{ + public class LogBean + { + /** + * 鐢ㄦ埛id锛岄潪蹇呭~ + */ + private string userId; + /** + * 浣忓畢id锛岄潪蹇呭~ + */ + private string homeId; + /** + * 缃戝叧mac锛岄潪蹇呭~ + */ + private string mac; + /** + * 绯荤粺锛欼OS銆丄ndroid銆乄indows銆佺綉鍏� + */ + private string userAgent; + /** + * 杞欢鐗堟湰 + */ + private string appVersion; + + public string getUserId() + { + return userId == null ? "" : userId; + } + + + public string getHomeId() + { + return homeId == null ? "" : homeId; + } + + public void setUserId(string userId) + { + this.userId = userId; + } + + public void setHomeId(string homeId) + { + this.homeId = homeId; + } + public string getMac() + { + return mac; + } + + public void setMac(string mac) + { + this.mac = mac; + } + + public string getUserAgent() + { + return userAgent; + } + + public void setUserAgent(string userAgent) + { + this.userAgent = userAgent; + } + + public string getAppVersion() + { + return appVersion; + } + + public void setAppVersion(string appVersion) + { + this.appVersion = appVersion; + } + } +} diff --git a/Crabtree/ON/ON.Droid.csproj b/Crabtree/ON/ON.Droid.csproj index 84d6771..5b05cec 100644 --- a/Crabtree/ON/ON.Droid.csproj +++ b/Crabtree/ON/ON.Droid.csproj @@ -52,7 +52,7 @@ <NoWarn></NoWarn> <AndroidDexTool>d8</AndroidDexTool> <AndroidSupportedAbis>armeabi-v7a;arm64-v8a</AndroidSupportedAbis> -<AndroidPackageFormat>aab</AndroidPackageFormat> +<AndroidPackageFormat>apk</AndroidPackageFormat> </PropertyGroup> <ItemGroup> <Reference Include="System" /> @@ -176,6 +176,10 @@ <Compile Include="Scan.cs" /> <Compile Include="NetworkUtils.cs" /> <Compile Include="SplashActivity.cs" /> + <Compile Include="Aliyu\AliyuLogUtil.cs" /> + <Compile Include="Aliyu\AliyuLogProducerClient.cs" /> + <Compile Include="Aliyu\LogBean.cs" /> + <Compile Include="Aliyu\Level.cs" /> </ItemGroup> <ItemGroup> <None Include="Resources\AboutResources.txt" /> @@ -939,6 +943,11 @@ <AndroidAsset Include="Assets\Phone2\CrabtreeAdd\CloudOffline.png" /> <AndroidAsset Include="Assets\Phone2\CrabtreeAdd\Speaker.png" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\Downloads\AliyuLog\AliyuLog.csproj"> + <Name>AliyuLog</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\build\monoandroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\build\monoandroid80\Xamarin.Android.Support.Annotations.targets')" /> <Import Project="..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\build\monoandroid80\Xamarin.Android.Arch.Core.Common.targets" Condition="Exists('..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\build\monoandroid80\Xamarin.Android.Arch.Core.Common.targets')" /> diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index 70bda1c..b45e318 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.806101" android:versionCode="202306101"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.807181" android:versionCode="202307181"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> diff --git a/Crabtree/SmartHome.sln b/Crabtree/SmartHome.sln index afd9b0b..74001d7 100644 --- a/Crabtree/SmartHome.sln +++ b/Crabtree/SmartHome.sln @@ -7,6 +7,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ON.Ios", "ON.Ios\ON.Ios.csproj", "{1D83BF28-BA88-4152-BA41-D7EFE90A5437}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliyuLog", "..\..\..\..\Downloads\AliyuLog\AliyuLog.csproj", "{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|iPhoneSimulator = Debug|iPhoneSimulator @@ -41,6 +43,18 @@ {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Release|Any CPU.ActiveCfg = Release|iPhone {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Release|Any CPU.Build.0 = Release|iPhone + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhone.ActiveCfg = Release|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhone.Build.0 = Release|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhone.Build.0 = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs index 3b3f764..2012de2 100644 --- a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs +++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs @@ -251,12 +251,26 @@ } //*****涓�浜涘垽绌哄鐞�***************** + if (revertObj.Code != StateCode.SUCCESS) { + if (revertObj.Code != "10001") { + string upString = requestFullUrl + " Code : " + revertObj.Code; + if (bodyParameterJson != null) { + upString += " ;" + bodyParameterJson; + } + //璁板綍鏃ュ織 + HDL_ON_Android.Aliyu.AliyuLogUtil.log ("鎺ュ彛鍛婅", + upString, HDL_ON_Android.Aliyu.Level.middle); + } + } return revertObj; } catch (Exception ex) { + //璁板綍鏃ュ織 + HDL_ON_Android.Aliyu.AliyuLogUtil.log ("鎺ュ彛寮傚父", "Url : " + requestFullUrl + " Msg : " + ex.Message, HDL_ON_Android.Aliyu.Level.high); Utlis.WriteLine (ex.Message); return new ResponsePackNew () { Code = StateCode.DATA_EXCEPTION }; } } else { + Utlis.WriteLine (response.Content); return new ResponsePackNew () { Code = StateCode.NETWORK_ERROR }; } diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs index b872171..181a4cd 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs @@ -117,6 +117,18 @@ }, SendCount.Three, true, true); var result = control.UsefulBytes; + //浼樺寲涓�涓嬶紝闃叉閫昏緫寮傚父 + if(result == null) { + UserConfig.Instance.IsLocalEncrypt = true; + control.Send (new Target () { + IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), + Command = Command.ReadGateway, + SubnetID = SmartHome.MqttCommon.GatewayCommon.SubnetID, + DeviceID = SmartHome.MqttCommon.GatewayCommon.DeviceID, + AddData = new byte [] { (byte)new Random ().Next (255), (byte)new Random ().Next (255) }, + }, SendCount.Three, true, true); + result = control.UsefulBytes; + } #endregion if (result != null) { @@ -249,6 +261,12 @@ // }); //} + //鍦ㄧ‘瀹氱敤鎴峰強浣忓畢淇℃伅鍚庯紝鍒濆鍖栧熀鏈俊鎭紝濡傦細 + var logBean = HDL_ON_Android.Aliyu.AliyuLogUtil.getLogBean; + + logBean.setHomeId (UserConfig.Instance.CurrentRegion.Id); + logBean.setUserId (MainPage.LoginUser.ID); + logBean.setAppVersion (MainPage.RequestVersion); #if DEBUG Shared.Utlis.WriteLine ($"CheckLinkRemote: 缁撴潫"); #endif diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index 3f01c6c..48bf7a7 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -38,7 +38,7 @@ //public static Button LogoButton = new Button (); - public static string RequestVersion = "2.805291"; + public static string RequestVersion = "2.807181"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs index 3b6a13a..f3cb6c3 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs @@ -166,19 +166,19 @@ etPasswrod.SecureTextEntry = !btnShowPassword.IsSelected; }; -//#if DEBUG -// int NigelLoginPass = 0; -// btnLogo.MouseUpEventHandler += (sender, e) => { -// if (NigelLoginPass == 3) { -// etAccount.Text = @"464027401@qq.com"; -// etPasswrod.Text = "qqqqqq"; -// } else if (NigelLoginPass == 5) { -// etAccount.Text = @"Jai.singh@havells.com"; -// etPasswrod.Text = "123456"; -// } -// NigelLoginPass++; -// }; -//#endif +#if DEBUG + int NigelLoginPass = 0; + btnLogo.MouseUpEventHandler += (sender, e) => { + if (NigelLoginPass == 3) { + etAccount.Text = @"support6@hdlchina.com.cn"; + etPasswrod.Text = "123456"; + } else if (NigelLoginPass == 5) { + etAccount.Text = @"Jai.singh@havells.com"; + etPasswrod.Text = "123456"; + } + NigelLoginPass++; + }; +#endif //if (accountList.Count > 0) { // etAccount.Text = accountList [accountList.Count-1]; //} -- Gitblit v1.8.0