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
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:
Then the following is the decryption The final structure:
After reading the document, start testing. Look at the code:
##Step count decrypted data
##About
: 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?##2.
小 Pigcms (PigCms) micro-e-commerce system operation version (independent micro-store mall + three-level distribution system) WeChat People King v3.4.5 Advanced Business Edition WeChat Rubik’s Cube Source CodeThe 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!