Commit bcca8458 authored by Savorboard's avatar Savorboard

update add jsonproperty

parent 53e83667
...@@ -43,7 +43,7 @@ namespace DotNetCore.CAP.Infrastructure ...@@ -43,7 +43,7 @@ namespace DotNetCore.CAP.Infrastructure
public static long ToTimestamp(DateTime value) public static long ToTimestamp(DateTime value)
{ {
var elapsedTime = value - Epoch; var elapsedTime = value - Epoch;
return (long) elapsedTime.TotalSeconds; return (long)elapsedTime.TotalSeconds;
} }
public static DateTime FromTimestamp(long value) public static DateTime FromTimestamp(long value)
...@@ -76,7 +76,17 @@ namespace DotNetCore.CAP.Infrastructure ...@@ -76,7 +76,17 @@ namespace DotNetCore.CAP.Infrastructure
{ {
var jObj = JObject.Parse(json); var jObj = JObject.Parse(json);
foreach (var property in properties) foreach (var property in properties)
{
if (jObj.TryGetValue(property.Key, out var _))
{
jObj[property.Key] = property.Value;
}
else
{
jObj.Add(new JProperty(property.Key, property.Value)); jObj.Add(new JProperty(property.Key, property.Value));
}
}
return jObj.ToString(); return jObj.ToString();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment