Home  >  Article  >  WeChat Applet  >  Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

零下一度
零下一度Original
2018-05-10 15:47:2615490browse

Recently, the WeChat mini program has been officially updated again, but I won’t care about the rest.

"wx.getWeRunData obtains WeChat sports data", this interface is really useful, because the company happens to be doing a lottery related to WeChat steps.

The only question is that the official document says that the data of the past 30 days can be obtained, so can the data of the current day be obtained? Let’s not complain about the ambiguity in the description of the document. I can only test it myself (the focus of this test is whether I can obtain the sports data of the day, and some operations will be briefly mentioned).

First look at the document description:

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

WeChat Sports Interface Document

Then the following is the decryption The final structure:

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

After decrypting the motion data

After reading the document, start testing. Look at the code:

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

##Code picture

The data request is successful, take a look at the encrypted motion data:

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day

Encrypted motion data

At this point, we are only one step away from the truth. Decrypt it:

Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day
##Step count decrypted data

You can see the last time node in the above picture, "1495468800"" after transcoding is today ""May 23"", my step count You can get it!


##About

Timestamp

: All timestamps are displayed as 00:00:00 of a certain day after being converted to date, such as: 2008/8/8 00:00:00; including the last one, which is my timestamp today after transcoding: 2017/5/23 00:00:00 (no matter which time period it is obtained on the 23rd, They are all in this format). The timestamp under the watermark is the time of the interface request.
##Note (of course this is just what I encountered. For reference):

There is a problem. There will be a delay between the number of steps obtained by this applet and the number of steps in WeChat Sports (of course, let’s not talk about the delay of WeChat Sports itself. Now we only study what we can see in WeChat Sports. The data of the mini program and the data of the step count interface)

There will be a situation where if the user does not enter the WeChat exercise and directly requests the mini program to obtain the step count interface, the data will remain unchanged. It will change! The data will be reacquired after a long period of time.

After testing, first enter WeChat Sports and then request the mini program to obtain the step count. Then the data will be consistent at this time. That is to say, is it equivalent to the user going into WeChat Sports to submit the step count to the database? Then the applet obtains the step count interface to get the latest? Otherwise, it has to wait for WeChat Sports' own data to be updated....

So, without entering the WeChat sports interface, how often will the mini program obtain the step count interface data refreshed?


Some experts have research results? Yes, welcome to communicate and discuss!

[Related recommendations]##1. WeChat public account platform source code download

##2.

小 Pigcms (PigCms) micro-e-commerce system operation version (independent micro-store mall + three-level distribution system)

3.

WeChat People King v3.4.5 Advanced Business Edition WeChat Rubik’s Cube Source Code

The above is the detailed content of Share the method of using the mini program to obtain and decrypt the WeChat step count to obtain the data of the day. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn