|
@@ -39,6 +39,10 @@ using System.Reactive;
|
|
|
using System.Security.Cryptography.Xml;
|
|
|
using ZhonTai.Common.Helpers;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
+using ZhonTai.Admin.Domain.Observe;
|
|
|
+using ZhonTai.Admin.Repositories.Observe;
|
|
|
+using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
|
|
+using System.Runtime.InteropServices;
|
|
|
|
|
|
namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
{
|
|
@@ -55,6 +59,7 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
private ProjectStatRepository _projectStatRepository;
|
|
|
private ProjectConfigRepository _projectConfigRepository;
|
|
|
private KuaKeRepository _kuaKeRepository;
|
|
|
+ private ObserveRepository _observeRepository;
|
|
|
|
|
|
public ProjectsService(
|
|
|
ProjectLinkRepository projectLinkRepository,
|
|
@@ -62,7 +67,8 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
ProjectPriceRepository projectPriceRepository,
|
|
|
ProjectStatRepository projectStatRepository,
|
|
|
ProjectConfigRepository projectConfigRepository,
|
|
|
- KuaKeRepository kuaKeRepository
|
|
|
+ KuaKeRepository kuaKeRepository,
|
|
|
+ ObserveRepository observeRepository
|
|
|
)
|
|
|
{
|
|
|
_ProjectLinkRepository = projectLinkRepository;
|
|
@@ -71,6 +77,7 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
_projectStatRepository = projectStatRepository;
|
|
|
_projectConfigRepository = projectConfigRepository;
|
|
|
_kuaKeRepository = kuaKeRepository;
|
|
|
+ _observeRepository = observeRepository;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -159,6 +166,7 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
if(priceConfig is null)
|
|
|
{
|
|
|
|
|
|
+
|
|
|
projectItem.Price = (Convert.ToDecimal(maxPrice.ProjectPrice) - ProjectPriceService.GetDrawAmount(Convert.ToDecimal(maxPrice.ProjectPrice),Convert.ToDecimal(5.00))).ToString();
|
|
|
}
|
|
|
else
|
|
@@ -727,32 +735,39 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
|
|
long timestamp = Convert.ToInt64(ts.TotalMilliseconds);
|
|
|
string salt = "e0u6fnlag06lc3pl";
|
|
|
+ string Base64Key = "XGAXicVG5GMBsx5bueOe4w==";
|
|
|
+ string DecodeBase64Key = Base64Decode(Base64Key);
|
|
|
ObservePostData postData = new ObservePostData();
|
|
|
|
|
|
- postData.imei = input.Imei;
|
|
|
- postData.requestId = input.ReqId;
|
|
|
- postData.mac = "";
|
|
|
- postData.clientIp = "";
|
|
|
- postData.timestamp = timestamp;
|
|
|
+
|
|
|
+ postData.imei = AesEncrypt(input.Imei, Base64Key);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ postData.timestamp = timestamp.ToString();
|
|
|
postData.pkg = input.Pkg;
|
|
|
- postData.dataType = 15;
|
|
|
- postData.payId = "";
|
|
|
+ postData.dataType = "15";
|
|
|
+
|
|
|
|
|
|
- postData.channel = 1;
|
|
|
- postData.type = 1;
|
|
|
- postData.appType = 1;
|
|
|
+ postData.channel = "1";
|
|
|
+ postData.type = "1";
|
|
|
+ postData.appType = "1";
|
|
|
|
|
|
- postData.ascribeType = 1;
|
|
|
+ postData.ascribeType = "1";
|
|
|
postData.adId = input.AdId;
|
|
|
|
|
|
|
|
|
|
|
|
string contents = postData.ToJson() + timestamp + salt;
|
|
|
- string signature = this.GenerateMD5(contents);
|
|
|
+ string signature = this.GenerateMD5($"");
|
|
|
+ string sign2 = this.GenerateMD5("123456");
|
|
|
|
|
|
var resultJson = this.JsonPostUrl(postUrl, signature, timestamp, postData.ToJson());
|
|
|
|
|
|
-
|
|
|
+ ObserveEntity entity = new ObserveEntity();
|
|
|
+ entity.InputString = input.ToJson();
|
|
|
+ entity.OutputString = resultJson.ToString();
|
|
|
+ var res = _observeRepository.Insert(entity);
|
|
|
|
|
|
|
|
|
|
|
@@ -760,6 +775,67 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
return resultJson;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static string Base64Decode(string result)
|
|
|
+ {
|
|
|
+ return Base64Decode(Encoding.UTF8, result);
|
|
|
+ }
|
|
|
+ public static string Base64Decode(Encoding encodeType, string result)
|
|
|
+ {
|
|
|
+ string decode = string.Empty;
|
|
|
+ byte[] bytes = Convert.FromBase64String(result);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ decode = encodeType.GetString(bytes);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ decode = result;
|
|
|
+ }
|
|
|
+ return decode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static string AesEncrypt(string str, string key)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(str)) return null;
|
|
|
+ Byte[] toEncryptArray = Encoding.UTF8.GetBytes(str);
|
|
|
+
|
|
|
+ System.Security.Cryptography.RijndaelManaged rm = new System.Security.Cryptography.RijndaelManaged
|
|
|
+ {
|
|
|
+ Key = Encoding.UTF8.GetBytes(key),
|
|
|
+ Mode = System.Security.Cryptography.CipherMode.ECB,
|
|
|
+ Padding = System.Security.Cryptography.PaddingMode.PKCS7
|
|
|
+ };
|
|
|
+
|
|
|
+ System.Security.Cryptography.ICryptoTransform cTransform = rm.CreateEncryptor();
|
|
|
+ Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
|
|
+
|
|
|
+ return Convert.ToBase64String(resultArray, 0, resultArray.Length);
|
|
|
+ }
|
|
|
+
|
|
|
private string JsonPostUrl(string url, string signature, long timestamp, string postData)
|
|
|
{
|
|
|
string result = "";
|