// app.js
App({
  onLaunch() {
    var that = this;
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    //续命操作
    setInterval(function () {
      console.log('想要续命');
      if (that.globalData.hasLogin) {
        console.log('开始');
        wx.request({
          url: that.globalData.myUrl+'/delayed',
          method: 'GET',
          data: {
            token : that.globalData.token
          },
          success: function (res) {
            console.log(res.data.msg);
          }
        })
      }
    }, 1500000);
  },

  //全局数据
  globalData: {
    userInfo: null,
    hasLogin: false,
    token: null,

    //图片网络路径
    // httpUrl:"http://10.170.15.123:8088/images",
    httpUrl:"https://kongbai121.xyz/images",

    //后台地址
    // myUrl:"http://10.170.15.123:8080",
    myUrl:"https://kongbai121.xyz/miniapp",

    //(为了减轻服务器负担,只在演示时开)
    //我的页面数据更新定时器开关
    openTime: false,
    // openTime: true,
   },

})
