|
@@ -19,6 +19,8 @@ namespace MOKA_Factory_Tools
|
|
|
{
|
|
|
internal class V2Method
|
|
|
{
|
|
|
+ public static MidList midList { get; set; }
|
|
|
+
|
|
|
private static string url_getMessage = "https://cn.uc.qhmoka.com/scbc-server/clientType/getMessage.do";
|
|
|
|
|
|
public static void SetMexicanConfig(bool bMexican = false)
|
|
@@ -148,6 +150,7 @@ namespace MOKA_Factory_Tools
|
|
|
mid.clienttype = jObject["clientType"].Value<string>();
|
|
|
mid.host = jObject["host"].Value<string>();
|
|
|
mid.whiteType = jObject["whiteType"].Value<string>();
|
|
|
+ mid.aesEncrypt = jObject["aesEncrypt"].Value<string>();
|
|
|
object a = jObject["rokuCustomer"];
|
|
|
if (jObject["rokuCustomer"].ToString().Length > 0)
|
|
|
{
|
|
@@ -161,7 +164,11 @@ namespace MOKA_Factory_Tools
|
|
|
}
|
|
|
|
|
|
if (mid.code == "1000")
|
|
|
+ {
|
|
|
+ midList = mid;
|
|
|
return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -193,7 +200,8 @@ namespace MOKA_Factory_Tools
|
|
|
watch.Start();
|
|
|
|
|
|
item.URL = url + "/bind/order";
|
|
|
- item.Postdata = string.Format("{{\"orderNum\":\"{0}\",\"sn\":\"{1}\",\"psn\":\"{2}\",\"orderCode\":\"{3}\",\"skipKey\":{4}}}", order, sn, psn, firetv_device_code, key2Write == null ? "[]" : JsonConvert.SerializeObject(key2Write).ToString());
|
|
|
+
|
|
|
+ item.Postdata = string.Format("{{\"orderNum\":\"{0}\",\"sn\":\"{1}\",\"psn\":\"{2}\",\"orderCode\":\"{3}\",\"client_type\":\"{4}\",\"skipKey\":{5}}}", order, sn, psn, firetv_device_code, midList.clienttype, key2Write == null ? "[]" : JsonConvert.SerializeObject(key2Write).ToString());
|
|
|
HttpResult httpResult = http.GetHtml(item);
|
|
|
if (httpResult.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
{
|
|
@@ -204,6 +212,17 @@ namespace MOKA_Factory_Tools
|
|
|
code = CommonMethod.JSON_SeleteNode(jObject, "code");
|
|
|
if (code == "0")
|
|
|
{
|
|
|
+ //需要解密
|
|
|
+ if (midList != null && midList.aesEncrypt.Equals("yes", StringComparison.InvariantCultureIgnoreCase))
|
|
|
+ {
|
|
|
+ AES_DES Aes = new AES_DES();
|
|
|
+ //data解密
|
|
|
+ string plainText = CommonMethod.JSON_SeleteNode(jObject, "data");
|
|
|
+ string key = AES_DES.AESKey;
|
|
|
+ byte[] IV = AES_DES.AESIV;
|
|
|
+ string str = AES_DES.DecryptStringFromBytes_Aes(plainText, key, IV);
|
|
|
+ jObject["data"] = str;
|
|
|
+ }
|
|
|
Dictionary<string, string> data = JsonConvert.DeserializeObject<Dictionary<string, string>>(jObject["data"].ToString());
|
|
|
if (data != null)
|
|
|
{
|
|
@@ -614,6 +633,18 @@ namespace MOKA_Factory_Tools
|
|
|
if (timeout < 5000)
|
|
|
timeout = 5000;
|
|
|
HttpHelper http = new HttpHelper();
|
|
|
+ //需要加密上报的话
|
|
|
+ if (midList != null && midList.aesEncrypt.Equals("yes", StringComparison.InvariantCultureIgnoreCase))
|
|
|
+ {
|
|
|
+ AES_DES AES_DES = new AES_DES();
|
|
|
+ string key = AES_DES.AESKey;
|
|
|
+ byte[] IV = AES_DES.AESIV;
|
|
|
+ postData = AES_DES.EncryptStringToBytes_Aes(postData, key, IV);
|
|
|
+ //json
|
|
|
+ string Data = string.Format("{{\"reportData\":\"{0}\"}}", postData);
|
|
|
+ JObject jo = JObject.Parse(Data);
|
|
|
+ postData = jo.ToString();
|
|
|
+ }
|
|
|
HttpItem item = new HttpItem()
|
|
|
{
|
|
|
Encoding = Encoding.UTF8,//编码格式(utf-8,gb2312,gbk)可选项 默认类会自动识别//Encoding = Encoding.Default,
|