-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (26 loc) · 752 Bytes
/
app.js
File metadata and controls
33 lines (26 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// app.js
const mqttService = require('utils/mqttService.js');
App({
globalData: {
userInfo: null
},
onLaunch: function() {
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
const deviceConfig = {
productKey: "k0t8ejX211I",
deviceName: "wechat",
deviceSecret: "7e9e072ba7db938fc30c825b6721813f",
regionId: "cn-shanghai",
};
mqttService.connect(deviceConfig);
},
mqttService: mqttService
})