Sfoglia il codice sorgente

将小米FireTV相关的SMES接口提取到配置文件中,以便波兰可用。

Jeff Wang 3 anni fa
parent
commit
3392eb639e

+ 5 - 14
FactoryTool_CShare/Business/CommonMethod.cs

@@ -2709,7 +2709,7 @@ namespace MOKA_Factory_Tools
         #endregion
 
         #region 小米FireTV功能模块相关接口;
-        public static bool GetMIKey(string sn, out MIKey mikey, out string msg)
+        public static bool GetMIKey(string url, string sn, out MIKey mikey, out string msg)
         {
             msg = "";
             mikey = new MIKey();
@@ -2723,11 +2723,7 @@ namespace MOKA_Factory_Tools
                 KeepAlive = false
             };
 
-#if DEBUG
-            item.URL = "http://10.126.124.85:9306/api/SMESCustomer/GetXMCard";
-#else
-            item.URL = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/GetXMCard";
-#endif
+            item.URL = url;
             item.Postdata = strPost;
             HttpResult hResult = http.GetHtml(item);
             if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
@@ -2776,7 +2772,7 @@ namespace MOKA_Factory_Tools
             return false;
         }
 
-        public static bool ReportMIKey(ReportMIKey mikey, out string msg)
+        public static bool ReportMIKey(string url, ReportMIKey mikey, out string msg)
         {
             msg = "";
             HttpHelper http = new HttpHelper();
@@ -2788,11 +2784,7 @@ namespace MOKA_Factory_Tools
                 KeepAlive = false
             };
 
-#if DEBUG
-            item.URL = "http://10.126.124.85:9306/api/SMESCustomer/UploadXMDataControl";
-#else
-            item.URL = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/UploadXMDataControl";
-#endif
+            item.URL = url;
             item.Postdata = JsonConvert.SerializeObject(mikey); ;
             HttpResult hResult = http.GetHtml(item);
             if (hResult.StatusCode == System.Net.HttpStatusCode.OK)
@@ -2830,8 +2822,7 @@ namespace MOKA_Factory_Tools
 
             return false;
         }
-
-#endregion
+        #endregion
     }
 
     /// <summary>

+ 3 - 0
FactoryTool_CShare/Models/StructList.cs

@@ -228,6 +228,9 @@ namespace MOKA_Factory_Tools
         /// 是否启用小米FireTV功能模块 ;
         /// </summary>
         public bool MITVEnable { get; set; } = false;
+
+        public string MIKeyUrl { get; set; } = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/GetXMCard";
+        public string MIKeyReportUrl { get; set; } = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/UploadXMDataControl";
         #endregion
     }
 

+ 20 - 0
FactoryTool_CShare/Views/Main.cs

@@ -783,6 +783,26 @@ namespace MOKA_Factory_Tools
                 {
                     SaveJsonConfig("MITVEnable", false);
                 }
+
+                // 获取key的url;
+                if (jObject["MIKeyUrl"] != null)
+                {
+                    functionSetting1.MIKeyUrl = jObject["MIKeyUrl"].Value<string>();
+                }
+                else
+                {
+                    SaveJsonConfig("MIKeyUrl", functionSetting1.MIKeyUrl);
+                }
+
+                // 上报key的url;
+                if (jObject["MIKeyReportUrl"] != null)
+                {
+                    functionSetting1.MIKeyReportUrl = jObject["MIKeyReportUrl"].Value<string>();
+                }
+                else
+                {
+                    SaveJsonConfig("MIKeyReportUrl", functionSetting1.MIKeyReportUrl);
+                }
                 #endregion
 
                 foreach (var ss in jObject["Channel"])  //遍历Channel

+ 2 - 2
FactoryTool_CShare/Views/OperationPanel.cs

@@ -1660,7 +1660,7 @@ namespace MOKA_Factory_Tools
             reportMIKey.TVMN = _MiKey.TVMN;
             reportMIKey.TVSN = SN.Replace("/", "");  // 去掉斜杠;
 
-            if (!CommonMethod.ReportMIKey(reportMIKey, out msg))
+            if (!CommonMethod.ReportMIKey(FunctionSettingNow.MIKeyReportUrl, reportMIKey, out msg))
             {
                 msg = string.Format("ReportMIKey error!\r\n{0}", msg);
                 Log.WriteErrorLog(msg);
@@ -2465,7 +2465,7 @@ namespace MOKA_Factory_Tools
             if (FunctionSettingNow.MITVEnable)
             {
                 // 获取Key;
-                if (!CommonMethod.GetMIKey(SN, out _MiKey, out error))
+                if (!CommonMethod.GetMIKey(FunctionSettingNow.MIKeyUrl, SN, out _MiKey, out error))
                 {
                     ErrMsg = string.Format("GetMIKey error!\r\n{0}", error);
                     Log.WriteErrorLog(ErrMsg);