# wx.getWeRunData(Object object)
Start from base library version 1.2.0. Please remaining backward compatible.
with Promise style call: Not supported
User authorization: Need scope.werun
Mini Program plugin: Not supported
Get the user's WeChat movement steps in the past 30 days. Need to call first wx.login Interface. Step count information is updated when the user actively enters the Mini Program.
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Interface calls the end of the callback function (call success or failure will be executed) |
# object.success callback
# parameter
# Object res
attribute | type | Introductions | Minimum version |
---|---|---|---|
encryptedData | string | Encrypted data for complete user information including sensitive data, seeEncryption data decryption algorithm. The data structure obtained after decryption is shown below | |
iv | string | The initial vector of the encryption algorithm, seeEncryption data decryption algorithm | |
cloudID | string | Cloud of sensitive data ID, open cloud development program will return, through the cloud call directly access to open data, seeDirect access to open data for cloud calls | 2.7.0 |
# sample code
wx.getWeRunData({
success (res) {
// take encryptedData Decrypt open data to developer backend
const encryptedData = res.encryptedData
// Or take cloudID Direct access to open data through cloud calls
const cloudID = res.cloudID
}
})
# Open data JSON structure
There are two ways to access sensitive data. One is to use [Encryption data decryption algorithm]((open-ability/signature#Encryption data decryption algorithm)) 。 Get the open data as follows json Structure:
{
"stepInfoList": [
{
"timestamp": 1445866601,
"step": 100
},
{
"timestamp": 1445876601,
"step": 120
}
]
}
stepInfoList The structure of each is as follows:
attribute | type | Introductions |
---|---|---|
timestamp | number | Timestamp, representing the time of the data |
step | number | WeChat movement steps |