|
|
@ -107,24 +107,49 @@ class IndexController extends BaseController |
|
|
|
} |
|
|
|
|
|
|
|
//足底温度图 |
|
|
|
$foot_key = "foot"; |
|
|
|
$foot = []; |
|
|
|
for ($i = 1; $i <= 4; $i++) { |
|
|
|
$foot_key = "foot:" . $i; |
|
|
|
|
|
|
|
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 ($timer_shaft == 0 ){ |
|
|
|
//获取最大时间 |
|
|
|
$foot_data = Redis::ZREVRANGE($foot_key, 0, 0); |
|
|
|
} else { |
|
|
|
//获得指定时间 |
|
|
|
$foot_data = Redis::ZREVRANGEBYSCORE($foot_key, $timer_shaft, $timer_shaft - 60); |
|
|
|
} |
|
|
|
|
|
|
|
$foot = []; |
|
|
|
if (!empty($foot_data)){ |
|
|
|
$foot_data = $foot_data[0]; |
|
|
|
for ($i = 0; $i < strlen($foot_data) / 2; $i++) { |
|
|
|
$foot[] = hexdec(substr($foot_data, $i * 2, 2)); |
|
|
|
|
|
|
|
if (!empty($foot_data)){ |
|
|
|
$foot_data = $foot_data[0]; |
|
|
|
|
|
|
|
// Cache::put('blood' . $request_data['node'], ($blood1 + $blood2) * 100); |
|
|
|
|
|
|
|
//体温36.1 |
|
|
|
$temperature = substr($foot_data, 4, 4); |
|
|
|
$foot[] = hexdec($temperature) / 100; |
|
|
|
// Cache::put('temperature' . $request_data['node'], $temperature); |
|
|
|
// |
|
|
|
//血氧80.1 |
|
|
|
$blood = substr($foot_data, 0, 4); |
|
|
|
$blood1 = hexdec(substr($blood, 0, 2)); |
|
|
|
$blood2 = substr($blood, 2, 2); |
|
|
|
$blood2 = CommonService::customHex2dec($blood2); |
|
|
|
|
|
|
|
$foot[] = $blood1 + $blood2; |
|
|
|
|
|
|
|
// //心跳70 |
|
|
|
// $heart = substr($foot_data, 8, 4); |
|
|
|
// $heart = hexdec($heart); |
|
|
|
// Cache::put('heart' . $request_data['node'], $heart); |
|
|
|
// //脉搏70 |
|
|
|
// $heart2 = substr($foot_data, 12, 4); |
|
|
|
// $heart2 = hexdec($heart2); |
|
|
|
// Cache::put('heart2' . $request_data['node'], $heart2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
'pressure' => $chunk3 ?? '', |
|
|
|
'foot' => $foot |
|
|
@ -153,7 +178,7 @@ class IndexController extends BaseController |
|
|
|
//删除过期 |
|
|
|
Redis::ZREMRANGEBYSCORE($pelma_key, 0, ($time - 120)); |
|
|
|
} elseif ($req['type'] == "0002") { |
|
|
|
$pelma_key = "foot"; |
|
|
|
$pelma_key = "foot:" . hexdec($req['device']); |
|
|
|
|
|
|
|
//按时间添加 |
|
|
|
Redis::zadd($pelma_key, $time, $req['send_data']); |
|
|
|