diff --git a/index/index.js b/index/index.js index 09988d3..8f3f720 100644 --- a/index/index.js +++ b/index/index.js @@ -82,7 +82,7 @@ Page({ // 连接指定设备 // if(device.deviceId=="03:02:02:07:65:98"){ // if(device.deviceId=="03:02:02:07:5C:B7"){ - if(device.deviceId=="03:02:02:07:62:3E"){ + if(device.deviceId=="03:02:02:07:5E:C6"){ // if(device.deviceId=="03:02:02:07:5E:BE"){ this.connectToDevice(device.deviceId); } @@ -336,6 +336,7 @@ Page({ sleepList.sort((a, b) => { return Number(a.minute) - Number(b.minute); // b.minute > a.minute 排前面 }); + // console.log("日期打印:",sleepList[0].yyyyMMdd) console.log("排序后数据:",sleepList) // 获取当前已存在的 sleepList(如果有) let currentSleepList = this.data.sleepList || []; diff --git a/project.config.json b/project.config.json index b2492cb..b5c94f9 100644 --- a/project.config.json +++ b/project.config.json @@ -43,5 +43,5 @@ "ignore": [], "include": [] }, - "appid": "wx700a26638f1850fe" + "appid": "wxb761a6f5c6200ed8" } \ No newline at end of file diff --git a/utils/CommonUtil.js b/utils/CommonUtil.js index a049ad4..17e8f5b 100644 --- a/utils/CommonUtil.js +++ b/utils/CommonUtil.js @@ -376,31 +376,52 @@ const CommonUtil = { let currentDate = data[i].yyyyMMdd; let nextDate = data[i + 1].yyyyMMdd; - // if(CommonUtil.isNextDay(currentDate,nextDate) && - // currentMinute > 1200 && nextDate > 480 ){ - // console.log(currentDate,currentMinute); - // console.log(nextDate,nextMinute); - // console.log("相减的差值:",nextMinute - currentMinute); - // console.log("是否跨天:",CommonUtil.isNextDay(currentDate,nextDate)); - // if(currentMinute < 1439){ - // for (let j = currentMinute + 1; j < 1440; j++) { + if(CommonUtil.isNextDay(currentDate,nextDate) && + currentMinute > 1200 && nextDate > 480 ){ + console.log(currentDate,currentMinute); + console.log(nextDate,nextMinute); + console.log("相减的差值:",nextMinute - currentMinute); + console.log("是否跨天:",CommonUtil.isNextDay(currentDate,nextDate)); + if(currentMinute < 1439){ + for (let j = currentMinute + 1; j < 1440; j++) { + result.push({ + minute: j, + status: 3, + yyyyMMdd: data[i].yyyyMMdd + }); + } + } + if(0 < nextMinute){ + for (let j = 0; j < nextMinute; j++) { + result.push({ + minute: j, + status: 3, + yyyyMMdd: data[i + 1].yyyyMMdd + }); + } + } + } + + // if(nextMinute - currentMinute < 1){ + // let currentDate = parseInt(data[i].yyyyMMdd); + // let nextDate = parseInt(data[i + 1].yyyyMMdd); + // if((nextDate - currentDate) == 1){ + // for (let j = currentMinute + 1; j <= 1440; j++) { // result.push({ // minute: j, // status: 3, // yyyyMMdd: data[i].yyyyMMdd // }); // } - // } - // if(0 < nextMinute){ + // for (let j = 0; j < nextMinute; j++) { // result.push({ // minute: j, // status: 3, - // yyyyMMdd: data[i + 1].yyyyMMdd + // yyyyMMdd: data[i].yyyyMMdd // }); // } // } - // } } diff --git a/utils/ParseDataPacket.js b/utils/ParseDataPacket.js index 530d1be..e16e860 100644 --- a/utils/ParseDataPacket.js +++ b/utils/ParseDataPacket.js @@ -345,8 +345,8 @@ const parseDataPacket = { // 获取当天00:00:00的时间戳 const midnight = this.dateFormat(year,month,day,0,0,0); let startMinutesOfDay = Math.floor((time - midnight) / 60); // 计算从当天00:00:00开始到当前时间的分钟数 - console.log("当天的0点0分0秒:",midnight) - console.log("几点几分的睡眠数据:",startMinutesOfDay) + // console.log("当天的0点0分0秒:",midnight) + // console.log("几点几分的睡眠数据:",startMinutesOfDay) // 1天最后1分钟是1440 let maxLastminute = 1440;