diff --git a/JdShopListener/JdShopListener/DingApiHelper.cs b/JdShopListener/JdShopListener/DingApiHelper.cs
index 12ed5f2..3360a25 100644
--- a/JdShopListener/JdShopListener/DingApiHelper.cs
+++ b/JdShopListener/JdShopListener/DingApiHelper.cs
@@ -12,12 +12,12 @@ namespace JdShopListener
///
/// 钉钉Secret
///
- private string dDSecret = "SEC23f4c5aa97b598b5a81b29ecb4b4facc5863e15e6b3c38c02f406c6541fdbb8e";
+ private string dDSecret = string.Empty;
///
- /// 钉钉的webHookUrl
+ /// 钉钉的webHook地址
///
- private string webHookUrl = "https://oapi.dingtalk.com/robot/send?access_token=ce194adc85ffc4438b894c20c895ba3e3eb2bfeea1cde4d0e9b4bd1122f905dc";
+ private string webHookUrl = string.Empty;
///
/// 初始化
@@ -79,23 +79,21 @@ namespace JdShopListener
return true;
}
- catch
+ catch(Exception ex)
{
return false;
}
}
- public String GetHash(String text, String key)
+ public string GetHash(string text, string key)
{
- // change according to your needs, an UTF8Encoding
- // could be more suitable in certain situations
ASCIIEncoding encoding = new ASCIIEncoding();
- Byte[] textBytes = encoding.GetBytes(text);
- Byte[] keyBytes = encoding.GetBytes(key);
+ byte[] textBytes = encoding.GetBytes(text);
+ byte[] keyBytes = encoding.GetBytes(key);
- Byte[] hashBytes;
+ byte[] hashBytes;
using (HMACSHA256 hash = new HMACSHA256(keyBytes))
hashBytes = hash.ComputeHash(textBytes);
diff --git a/JdShopListener/JdShopListener/MainWindowViewModel.cs b/JdShopListener/JdShopListener/MainWindowViewModel.cs
index ed71663..3dd0867 100644
--- a/JdShopListener/JdShopListener/MainWindowViewModel.cs
+++ b/JdShopListener/JdShopListener/MainWindowViewModel.cs
@@ -899,8 +899,56 @@ namespace JdShopListener
item.NewSkus = Newtonsoft.Json.JsonConvert.SerializeObject(newSkus);
#endregion
+ bool isChange = false;
+
+ StringBuilder sbMsg = new StringBuilder();
+ sbMsg.AppendLine("监控竞品发生变化:");
+
+ if (lastSku.NewSkus != item.NewSkus)
+ {
+ sbMsg.AppendLine("Sku");
+ sbMsg.AppendLine($"原:{lastSku.NewSkus}");
+ sbMsg.AppendLine($"新:{item.NewSkus}");
+ isChange = true;
+ }
+
+ if (lastSku.NewActive != item.NewActive)
+ {
+ sbMsg.AppendLine("活动");
+ sbMsg.AppendLine($"原:{lastSku.NewActive}");
+ sbMsg.AppendLine($"新:{item.NewActive}");
+ isChange = true;
+ }
+
+
+ if (lastSku.NewCoupons != item.NewCoupons)
+ {
+ sbMsg.AppendLine("优惠券");
+ sbMsg.AppendLine($"原:{lastSku.NewCoupons}");
+ sbMsg.AppendLine($"新:{item.NewCoupons}");
+ isChange = true;
+ }
+
+ if (lastSku.NewPrice != item.NewPrice)
+ {
+ sbMsg.AppendLine("价格");
+ sbMsg.AppendLine($"原:{lastSku.NewPrice}");
+ sbMsg.AppendLine($"新:{item.NewPrice}");
+ isChange = true;
+ }
+
+ if (lastSku.NewPromotion != item.NewPromotion)
+ {
+ sbMsg.AppendLine("促销");
+ sbMsg.AppendLine($"原:{lastSku.NewPromotion}");
+ sbMsg.AppendLine($"新:{item.NewPromotion}");
+ isChange = true;
+ }
+
+ sbMsg.AppendLine($"商品链接:https://item.jd.com/{lastSku.SkuId}.html");
+
//判断是否有变化
- if (lastSku.NewSkus!=item.NewSkus|| lastSku.NewActive != item.NewActive || lastSku.NewCoupons != item.NewCoupons || lastSku.NewPrice != item.NewPrice || lastSku.NewPromotion != item.NewPromotion)
+ if (isChange)
{
item.OldActive = lastSku.NewActive;
item.OldCoupons = lastSku.NewCoupons;
@@ -912,7 +960,7 @@ namespace JdShopListener
if (IsUseDingDing)
{
- dingApi.SendNotify($"{sku.SkuId}监控完成!已产生变化记录");
+ dingApi.SendNotify(sbMsg.ToString());
}
AddLog($"{sku.SkuId}监控完成!已产生变化记录");
diff --git a/JdShopListener/JdShopListener/Properties/PublishProfiles/FolderProfile.pubxml b/JdShopListener/JdShopListener/Properties/PublishProfiles/FolderProfile.pubxml
index 48698e9..7f4e43d 100644
--- a/JdShopListener/JdShopListener/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/JdShopListener/JdShopListener/Properties/PublishProfiles/FolderProfile.pubxml
@@ -9,9 +9,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
bin\Release\netcoreapp3.1\publish\
FileSystem
netcoreapp3.1
- win-x86
+ win-x64
true
- False
+ True
False
False