|
|
|
@ -18,11 +18,10 @@ class IndexController extends BaseController |
|
|
|
public function getPelmaData() |
|
|
|
{ |
|
|
|
$request_data = request()->all(); |
|
|
|
$timer_shaft = $request_data['timer_shaft']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//足底压力图 |
|
|
|
$pelma_key = "pelma:" . $request_data['item']; |
|
|
|
$timer_shaft = $request_data['timer_shaft']; |
|
|
|
|
|
|
|
if ($timer_shaft == 0 ){ |
|
|
|
//获取最大时间 |
|
|
|
@ -32,10 +31,7 @@ class IndexController extends BaseController |
|
|
|
$data = Redis::ZREVRANGEBYSCORE($pelma_key, $timer_shaft, $timer_shaft - 60); |
|
|
|
} |
|
|
|
|
|
|
|
if (empty($data)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if(!empty($data)){ |
|
|
|
$pelmaArr = str_split($data[0], 2); |
|
|
|
|
|
|
|
$vague = 2; |
|
|
|
@ -88,10 +84,25 @@ class IndexController extends BaseController |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
// dd($chunk3); |
|
|
|
} |
|
|
|
|
|
|
|
//足底温度图 |
|
|
|
$foot_key = "foot"; |
|
|
|
|
|
|
|
if ($timer_shaft == 0 ){ |
|
|
|
//获取最大时间 |
|
|
|
$foot_data = Redis::ZREVRANGE($foot_key, 0, 0); |
|
|
|
} else { |
|
|
|
//获得指定时间 |
|
|
|
$foot_data = Redis::ZREVRANGEBYSCORE($foot_key, $timer_shaft, $timer_shaft - 60); |
|
|
|
} |
|
|
|
|
|
|
|
if (!empty($foot_data)){ |
|
|
|
$foot = $foot_data; |
|
|
|
} |
|
|
|
|
|
|
|
return [ |
|
|
|
'pressure' => $chunk3, |
|
|
|
'pressure' => $chunk3 ?? '', |
|
|
|
'foot' => [36.2, 80, 36.1, 75, 35.9, 79, 36.3, 80] |
|
|
|
]; |
|
|
|
} |
|
|
|
@ -106,21 +117,24 @@ class IndexController extends BaseController |
|
|
|
|
|
|
|
$time = time(); |
|
|
|
// echo Cache::get('pelma'); |
|
|
|
|
|
|
|
if ($req['type'] == 1){ |
|
|
|
$pelma_key = "pelma:" . $req['device']; |
|
|
|
|
|
|
|
//按时间添加 |
|
|
|
Redis::zadd($pelma_key, $time, $req['pelma']); |
|
|
|
Redis::zadd($pelma_key, $time, $req['send_data']); |
|
|
|
|
|
|
|
//删除过期 |
|
|
|
Redis::ZREMRANGEBYSCORE($pelma_key, 0, ($time - 120)); |
|
|
|
} elseif ($req['type'] == 2) { |
|
|
|
$pelma_key = "foot"; |
|
|
|
|
|
|
|
//获取最大时间 |
|
|
|
// $data = Redis::ZREVRANGE($pelma_key, 0, 0); |
|
|
|
//获得指定时间 |
|
|
|
// $data = Redis::ZRANGEBYSCORE($pelma_key, 19, 29); |
|
|
|
|
|
|
|
// var_dump($data); |
|
|
|
//按时间添加 |
|
|
|
Redis::zadd($pelma_key, $time, $req['send_data']); |
|
|
|
|
|
|
|
//删除过期 |
|
|
|
Redis::ZREMRANGEBYSCORE($pelma_key, 0, ($time - 120)); |
|
|
|
} |
|
|
|
|
|
|
|
// $data = request('pelma'); |
|
|
|
// Cache::put('pelma', $data); |
|
|
|
@ -141,20 +155,6 @@ class IndexController extends BaseController |
|
|
|
return view('http.lora2'); |
|
|
|
} |
|
|
|
|
|
|
|
public function getPelmaStore() |
|
|
|
{ |
|
|
|
echo Cache::get('pelma'); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
public function getBlood() |
|
|
|
{ |
|
|
|
$blood = Cache::get('blood'); |
|
|
|
|
|
|
|
return $blood; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 上传血压数据 |
|
|
|
* http://127.0.0.1:8001/storeBlood?node=616162626365&data=0090243050005500 |
|
|
|
|