where('lable',$item['label'])->order("id","desc")->value("time"); $data[] = [ 'mac' => $mac, 'lable' => $item['label'], 'rssi' => $item['rssi'], 'time' => $item['time'], 'addTime' => time(), 'move' => $item['move'], 'step' => empty($item['step']) ? 0 : $item['step'], 'temperature' => empty($item['temperature']) ? 0 : $item['temperature'], //告警 'temperWarn' => empty($item['temperWarn']) ? 00 : $item['temperWarn'], // "interval_time"=>empty($onetime) ?0:($item['time']-$onetime) ]; } $tage = new TagHistory(); $tage->saveAll($data); json_success('上传成功'); } //储存数据到mysql // public function redis_to_mysql(){ // Cache::store('redis')-> // } /** * 删除前1天的数据 * * @return void */ public function deleteHistory() { while(true) { $where[] = ['addTime','<',strtotime("-1 day")]; Db::name('tag_history')->where($where)->delete(); sleep(60*60*24); } } /** * 检测小程序版本版本 function * * @return void */ public function detectionVersion(){ $token = $_GET['token']; if (!$token || $token != '444333d3') { json_fail('缺少token或者token不对'); } $data["url"]="http://116.62.220.88:8112/static/app/蓝牙小程序/1.1.1/rl-release.apk"; $data["version"]="1.1.1"; json_success("查询版本成功",$data); } }