From 270431a95cfd5b9dacf05c9544d1b909438645c9 Mon Sep 17 00:00:00 2001
From: "402335107@qq.com" <402335107@qq.com>
Date: Thu, 28 Mar 2019 17:37:12 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=AF=86=E8=BF=90=E5=8A=A8?=
=?UTF-8?q?=E6=AD=A5=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entities/DecodedRunData.cs | 12 +++++++++++
.../Helpers/EncryptHelper.cs | 20 ++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
diff --git a/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
new file mode 100644
index 0000000000..b5608f533e
--- /dev/null
+++ b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Senparc.Weixin.WxOpen.Entities
+{
+ class DecodedRunData
+ {
+ }
+}
diff --git a/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Helpers/EncryptHelper.cs b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Helpers/EncryptHelper.cs
index d5d3d1b8e3..24e75ebc71 100644
--- a/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Helpers/EncryptHelper.cs
+++ b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Helpers/EncryptHelper.cs
@@ -40,6 +40,7 @@ and limitations under the License.
#endif
using Senparc.Weixin.Exceptions;
using Senparc.Weixin.Helpers;
+using Senparc.Weixin.MP.Sample.Models;
using Senparc.Weixin.WxOpen.Containers;
using Senparc.Weixin.WxOpen.Entities;
@@ -243,7 +244,24 @@ public static DecodedPhoneNumber DecryptPhoneNumber(string sessionId, string enc
return phoneNumber;
}
-
+ ///
+ /// 解密微信运动步数
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static DecodedRunData DecodedRunDataBySessionid(string sessionId, string encryptedData, string iv)
+ {
+ var jsonStr = EncryptHelper.DecodeEncryptedDataBySessionId(sessionId, encryptedData, iv);
+#if NET45
+ JavaScriptSerializer js = new JavaScriptSerializer();
+ var rundateInfo = js.Deserialize(jsonStr);
+#else
+ var rundateInfo = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonStr);
+#endif
+ return rundateInfo;
+ }
///
/// 检查解密消息水印
///
From 805da897b0cb3faee464ee2e8d82fcae3ea8e16d Mon Sep 17 00:00:00 2001
From: "402335107@qq.com" <402335107@qq.com>
Date: Thu, 28 Mar 2019 17:39:20 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=90=E5=8A=A8?=
=?UTF-8?q?=E6=AD=A5=E6=95=B0=E8=A7=A3=E5=AF=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entities/DecodedRunData.cs | 39 ++++++++++++++++---
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
index b5608f533e..9b418e551d 100644
--- a/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
+++ b/src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/Entities/DecodedRunData.cs
@@ -1,12 +1,39 @@
-using System;
+/*----------------------------------------------------------------
+
+ 文件名:DecodedRunData.cs
+ 文件功能描述:用户运动步数解密类
+
+
+ 创建标识:2019-03-28
+----------------------------------------------------------------*/
+
+using Senparc.Weixin.WxOpen.Entities;
+using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Web;
-namespace Senparc.Weixin.WxOpen.Entities
+namespace Senparc.Weixin.MP.Sample.Models
{
- class DecodedRunData
+ // "stepInfoList": [
+ // {
+ // "timestamp": 1445866601,
+ // "step": 100
+ // },
+ // {
+ // "timestamp": 1445876601,
+ // "step": 120
+ // }
+ //]
+ [Serializable]
+ public class DecodedRunData : DecodeEntityBase
+ {
+ public List stepInfoList { get; set; }
+ }
+
+ public class stepModel
{
+ public long timestamp { get; set; }
+ public long step { get; set; }
}
-}
+}
\ No newline at end of file