260311部分测试
This commit is contained in:
parent
0f0a17b87e
commit
2b5d5e3fcf
|
|
@ -137,7 +137,7 @@ class Base extends Controller{
|
|||
];
|
||||
}
|
||||
|
||||
// 判断token是否过期
|
||||
// 判断token是否过期(有用)
|
||||
public function token_time_validate($token){
|
||||
// 591b70e0d80b5fa6d77e6e1384453ab9
|
||||
if(is_string($token)){
|
||||
|
|
|
|||
|
|
@ -62,24 +62,47 @@ class Index extends Base{
|
|||
public function login_invalid_version(){
|
||||
|
||||
$data = input('post.');
|
||||
try {
|
||||
if(!array_key_exists('token', $data)){
|
||||
return $this->msg(-1,'已过期');
|
||||
return $this->msg(10001);
|
||||
}
|
||||
|
||||
$result = Db::table($this->index_db_name['banben'])->order('is_del,id desc')->find();
|
||||
if($result){
|
||||
$version = $result['version_num_original'];
|
||||
$url = $result['download_url'];
|
||||
}else{
|
||||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||||
return $this->msg(10005);
|
||||
$version = '';
|
||||
$url = '';
|
||||
}
|
||||
if($data['token'] == ''){
|
||||
return $this->msg(-2,'未登录',['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(-2,'未登录',['version'=>$version,'url'=>$url,'language'=>'zh-Hans','language_arr'=>$this->process_Language()]);
|
||||
}
|
||||
$user_token_state = $this->token_time_validate($data['token']);
|
||||
// $language_data = $this->pd_language($user_token_state['language'],$isSupportedLanguage,$language);
|
||||
|
||||
if($user_token_state['state'] === false){
|
||||
return $this->msg(-1,'已过期');
|
||||
// return [['code'=>-1,'description'=>'已过期'],['version'=>$version,'url'=>$url]];
|
||||
return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(-1,'未登录',['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]);
|
||||
}else{
|
||||
$zh = Db::table($this->index_db_name['zhanghao'])->where(['token' => $data['token']])->cache(86400)->field('id,token,nickname')->find();
|
||||
return $this->msg($zh);
|
||||
// return [['code'=>0,'description'=>'未过期'],['version'=>$version,'url'=>$url]];
|
||||
return $this->msg(['version'=>$version,'url'=>$url,]);
|
||||
// return $this->msg(['version'=>$version,'url'=>$url,'language'=>$language_data,'language_arr'=>$this->process_Language()]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// 捕获异常
|
||||
$logContent["flie"] = $e->getFile();
|
||||
$logContent["line"] = $e->getLine();
|
||||
$logContent['all_content'] = "异常信息:\n";
|
||||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||||
$this->record_api_log($data, $logContent, null);
|
||||
return $this->msg(99999);
|
||||
}
|
||||
|
||||
}
|
||||
// 配置信息
|
||||
public function config(){
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Userbody extends Base{
|
|||
'unit' => '分',
|
||||
"description"=>"",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/score.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/score.png",
|
||||
'standard_list' => [
|
||||
['min_val'=>'0','max_val'=>'70','text'=>'较差','color'=>'#C2831C'],
|
||||
['min_val'=>'71','max_val'=>'80','text'=>'一般','color'=>'#F5A623'],
|
||||
|
|
@ -79,7 +79,7 @@ class Userbody extends Base{
|
|||
'bmi' => [
|
||||
'name' => 'BMI',
|
||||
'unit' => '',
|
||||
"description"=>"BMI是身体质量指数(BodyMassIndex)的缩写,是一种常用的衡量人体肥胖程度的指标",
|
||||
"description"=>"BMI是身体质量指数(BodyMasslndex)的缩写,是一种常用的衡量人体肥胖程度的指标",
|
||||
"smart_tip_description"=>"",
|
||||
'standard_list' => [
|
||||
['min_val'=>'0','max_val'=>'','text'=>'消瘦','color'=>'#FDDA6B'],
|
||||
|
|
@ -92,9 +92,9 @@ class Userbody extends Base{
|
|||
'fat_r' => [
|
||||
'name' => '脂肪率',
|
||||
'unit' => '%',
|
||||
"description"=>"",
|
||||
"description"=>"体脂率指人体中脂肪组织所占的百分比。体脂率是评估一个人身体脂肪含量和肥胖程度的指标。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/fat_r.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/fat_r.png",
|
||||
'list' => [
|
||||
'偏低' => '#FCDB67',
|
||||
'标准' => '#58D268',
|
||||
|
|
@ -136,9 +136,9 @@ class Userbody extends Base{
|
|||
'fat_w' => [
|
||||
'name' => '脂肪量',
|
||||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
"description"=>"脂肪量指人体含有脂肪的总量。脂肪在身体中起着能量储存、保护内脏器官和维持体温等重要作用。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/fat_w.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/fat_w.png",
|
||||
'list' => [
|
||||
'偏低' => '#FCDB67',
|
||||
'标准' => '#58D268',
|
||||
|
|
@ -180,9 +180,9 @@ class Userbody extends Base{
|
|||
'muscle' => [
|
||||
'name' => '肌肉率',
|
||||
'unit' => '%',
|
||||
"description"=>"",
|
||||
"description"=>"肌肉率指人体成分中肌肉占体重的百分比。肌肉率越高,BMR越大,消耗的热量越多,就不容易发胖。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/muscle.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/muscle.png",
|
||||
'list' => [
|
||||
'不足' => '#FFDA68',
|
||||
'标准' => '#59CD6F',
|
||||
|
|
@ -205,9 +205,9 @@ class Userbody extends Base{
|
|||
'muscleval' => [
|
||||
'name' => '肌肉量',
|
||||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
"description"=>"肌肉量指人体所有肌肉的含量,包括水分量、骨骼肌、心肌和平滑肌等。肌肉是人体内的主要代谢组织之一,具有维持基础代谢率、提高身体稳定性、促进脂肪分解等重要作用。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/muscleval.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/muscleval.png",
|
||||
'list' => [
|
||||
'不足' => '#FFDA68',
|
||||
'标准' => '#59CD6F',
|
||||
|
|
@ -229,10 +229,10 @@ class Userbody extends Base{
|
|||
],
|
||||
'water' => [
|
||||
'name' => '水分',
|
||||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
'unit' => '%',
|
||||
"description"=>"体水分率指人体组织中的水分占总体重的百分比,也称为身体水分含量。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/water.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/water.png",
|
||||
'list' => [
|
||||
'不足' => '#FED966',
|
||||
'标准' => '#58CF6B',
|
||||
|
|
@ -255,9 +255,9 @@ class Userbody extends Base{
|
|||
'bone' => [
|
||||
'name' => '骨重',
|
||||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
"description"=>"身体骨量指人体骨骼所含的骨基质和矿物质的质量。骨量的大小直接影响骨骼健康,对身体的稳定性和功能起着至关重要的作用。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/bone.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/bone.png",
|
||||
'list' => [
|
||||
'不足' => '#FED966',
|
||||
'标准' => '#58CF6F',
|
||||
|
|
@ -304,9 +304,9 @@ class Userbody extends Base{
|
|||
'protein' => [
|
||||
'name' => '蛋白率',
|
||||
'unit' => '%',
|
||||
"description"=>"",
|
||||
"description"=>"蛋白质率指人体组织中蛋白质含量占总体重的百分比。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/protein.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/protein.png",
|
||||
'list' => [
|
||||
'不足' => '#FED966',
|
||||
'标准' => '#58CF6F',
|
||||
|
|
@ -331,7 +331,7 @@ class Userbody extends Base{
|
|||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/proteinval.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/proteinval.png",
|
||||
'list' => [
|
||||
'不足' => '#FED966',
|
||||
'标准' => '#58CF6F',
|
||||
|
|
@ -354,9 +354,9 @@ class Userbody extends Base{
|
|||
'visceral' => [
|
||||
'name' => '内脏指数',
|
||||
'unit' => '',
|
||||
"description"=>"",
|
||||
"description"=>"内脏脂肪指围绕脏器的脂肪组织,主要分布于腹腔内,包括肝脏、心脏、肾脏、胰腺等器官周围的脂肪。身体内脏脂肪的增加会导致慢性代谢性疾病的风险增加。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/visceral.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/visceral.png",
|
||||
'list' => [
|
||||
'标准' => '#55CF6C',
|
||||
'警惕' => '#FEAC00',
|
||||
|
|
@ -379,9 +379,9 @@ class Userbody extends Base{
|
|||
'sfr' => [
|
||||
'name' => '皮下脂肪',
|
||||
'unit' => '%',
|
||||
"description"=>"",
|
||||
"description"=>"皮下脂肪率指身体内皮下脂肪组织占身体总重量的百分比。皮下脂肪适量时对身体有益,但过量会使身体处于肥胖状态,并可能导致多种健康问题。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/sfr.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/sfr.png",
|
||||
'list' => [
|
||||
'不足' => '#FCDB68',
|
||||
'标准' => '#59D16F',
|
||||
|
|
@ -406,7 +406,7 @@ class Userbody extends Base{
|
|||
'unit' => '',
|
||||
"description"=>"肥胖等级指根据个体BMI来评估一个人是否超重或肥胖的指标。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/body_level.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/body_level.png",
|
||||
'list' => [],
|
||||
'standard_list' => [],
|
||||
'key_name'=>'body_level',
|
||||
|
|
@ -416,7 +416,7 @@ class Userbody extends Base{
|
|||
'unit' => '',
|
||||
"description"=>"身体类型是对人体外形的总体描述和评定",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/body_type.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/body_type.png",
|
||||
'list' => [],
|
||||
'standard_list' => [],
|
||||
'key_name'=>'body_type',
|
||||
|
|
@ -426,7 +426,7 @@ class Userbody extends Base{
|
|||
'unit' => '岁',
|
||||
"description"=>"身体年龄指衡量身体健康状况的指标,它反映了一个人的生理状态相对于实际年龄的健康程度。相关模型主要与BMI有关。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/body_age.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/body_age.png",
|
||||
'list' => [],
|
||||
'standard_list' => [],
|
||||
'key_name'=>'body_age',
|
||||
|
|
@ -442,7 +442,7 @@ class Userbody extends Base{
|
|||
'heart_rate' => [
|
||||
'name' => '心率',
|
||||
'unit' => '跳/分钟',
|
||||
"description"=>"保持均衡营养的饮食,摄入足够的碳水化合物、蛋白质、脂肪等。适度进行运动,保持良好的生活习惯。",
|
||||
"description"=>"心率指正常人安静状态下每分钟心跳的次数,可因年龄、性别或其他生理因素产生个体差异。",
|
||||
"smart_tip_description"=>"注意减少压力和焦虑,适度锻炼,保持良好的睡眠质量,避免过度用力或剧烈运动。",
|
||||
'standard_list' => [
|
||||
['min_val'=>'0','max_val'=>'','text'=>'偏低','color'=>'#FCDB67'],
|
||||
|
|
@ -454,9 +454,9 @@ class Userbody extends Base{
|
|||
'ideal_weight' => [
|
||||
'name' => '理想体重',
|
||||
'unit' => 'kg',
|
||||
"description"=>"",
|
||||
"description"=>"理想体重是反映和衡量一个人健康状况的重要标志之一。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/ideal_weight.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/ideal_weight.png",
|
||||
'standard_list' => [],
|
||||
'key_name'=>'ideal_weight',
|
||||
],
|
||||
|
|
@ -465,7 +465,7 @@ class Userbody extends Base{
|
|||
'unit' => 'cm',
|
||||
"description"=>"",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/ideal_height.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/ideal_height.png",
|
||||
'standard_list' => [],
|
||||
'key_name'=>'ideal_height',
|
||||
],
|
||||
|
|
@ -474,7 +474,7 @@ class Userbody extends Base{
|
|||
'unit' => '',
|
||||
"description"=>"",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/ideal_bmi.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/ideal_bmi.png",
|
||||
'standard_list' => [],
|
||||
'key_name'=>'ideal_bmi',
|
||||
],
|
||||
|
|
@ -483,7 +483,7 @@ class Userbody extends Base{
|
|||
'unit' => 'kcal',
|
||||
"description"=>"BMR是基础代谢率(BasalMetabolicRate)的缩写,指人体在安静状态下,维持基本生命活动所需的最低能量消耗率。",
|
||||
"smart_tip_description"=>"",
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/ideal_bmi.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/ideal_bmi.png",
|
||||
'list' => [
|
||||
'偏低' => '#FF5656',
|
||||
'优' => '#3A68D4'
|
||||
|
|
@ -734,7 +734,6 @@ class Userbody extends Base{
|
|||
// return $this->msg(99999);
|
||||
// }
|
||||
}
|
||||
|
||||
// 修改目标体重
|
||||
public function set_target_weight(){
|
||||
$data = input('post.');
|
||||
|
|
@ -989,7 +988,14 @@ class Userbody extends Base{
|
|||
"standard"=>"",
|
||||
"standard_color"=>"#000000",
|
||||
'target_weight'=>'0',
|
||||
'target_weight_unit'=>'kg'
|
||||
'target_weight_unit'=>'kg',
|
||||
'bk_color'=>'#fffae4',
|
||||
'curve_list'=>[
|
||||
'title'=>'体重',
|
||||
'key'=>'weight',
|
||||
'line'=>['categories'=>[],'series'=>[['color'=>'#f78814','data'=>[]]]],
|
||||
],
|
||||
'ideal_weight'=>'',
|
||||
],
|
||||
[
|
||||
"name"=>$this->merged_data['height']['name'],
|
||||
|
|
@ -998,6 +1004,13 @@ class Userbody extends Base{
|
|||
"unit"=>$this->merged_data['height']['unit'],
|
||||
"standard"=>"",
|
||||
"standard_color"=>"#000000",
|
||||
'bk_color'=>'#f6eefd',
|
||||
'curve_list'=>[
|
||||
'title'=>'身高',
|
||||
'key'=>'height',
|
||||
'line'=>['categories'=>[],'series'=>[['color'=>'#dab8f4','data'=>[]]]],
|
||||
],
|
||||
'ideal_height'=>'',
|
||||
],
|
||||
[
|
||||
"name"=>$this->merged_data['bmi']['name'],
|
||||
|
|
@ -1006,10 +1019,16 @@ class Userbody extends Base{
|
|||
"unit"=>$this->merged_data['bmi']['unit'],
|
||||
"standard"=>"",
|
||||
"standard_color"=>"#000000",
|
||||
'bk_color'=>'#edf8fe',
|
||||
'curve_list'=>[
|
||||
'title'=>'BMI',
|
||||
'key'=>'bmi',
|
||||
'line'=>['categories'=>[],'series'=>[['color'=>'#a8def6','data'=>[]]]],
|
||||
],
|
||||
'ideal_bmi'=>'',
|
||||
],
|
||||
],
|
||||
'card_list'=>[
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -1031,6 +1050,15 @@ class Userbody extends Base{
|
|||
return $this->msg($result_return);
|
||||
}
|
||||
|
||||
$body_last_data_3_list = Db::table($this->body_db_name['body_data_new'])
|
||||
->where(['is_del'=>0,'aud_id'=>$data['aud_id']])
|
||||
->order('record_time desc,id desc')
|
||||
->field('id,weight,height,bmi,record_time')
|
||||
->page('1,5')
|
||||
->select();
|
||||
|
||||
|
||||
|
||||
|
||||
$record_time = substr($body_last_data['record_time'], 11, 5);
|
||||
// 处理体重
|
||||
|
|
@ -1041,6 +1069,14 @@ class Userbody extends Base{
|
|||
$result_return['top_list'][0]['standard_color'] = $temporary_standard_color[2];
|
||||
$result_return['top_list'][0]['target_weight'] = $user_data['target_weight'];
|
||||
$result_return['top_list'][0]['key_name'] = 'weight';
|
||||
foreach ($body_last_data_3_list as $key => $value) {
|
||||
$result_return['top_list'][0]['curve_list']['line']['categories'][] = $value['record_time'];
|
||||
$result_return['top_list'][0]['curve_list']['line']['series'][0]['data'][] = floatval($value['weight']);
|
||||
$result_return['top_list'][1]['curve_list']['line']['categories'][] = $value['record_time'];
|
||||
$result_return['top_list'][1]['curve_list']['line']['series'][0]['data'][] = floatval($value['height']);
|
||||
$result_return['top_list'][2]['curve_list']['line']['categories'][] = $value['record_time'];
|
||||
$result_return['top_list'][2]['curve_list']['line']['series'][0]['data'][] = floatval($value['bmi']);
|
||||
}
|
||||
$user_data['weight'] = $result_return['top_list'][0]['value'];
|
||||
// 处理身高
|
||||
$result_return['top_list'][1]['time'] = $record_time;
|
||||
|
|
@ -1049,6 +1085,7 @@ class Userbody extends Base{
|
|||
$result_return['top_list'][1]['standard'] = $temporary_standard_color[1];
|
||||
$result_return['top_list'][1]['standard_color'] = $temporary_standard_color[2];
|
||||
$result_return['top_list'][1]['key_name'] = 'height';
|
||||
|
||||
// 处理BMI
|
||||
$result_return['top_list'][2]['time'] = $record_time;
|
||||
$result_return['top_list'][2]['value'] = floatval($body_last_data['bmi']);
|
||||
|
|
@ -1059,6 +1096,21 @@ class Userbody extends Base{
|
|||
// 如果有头围
|
||||
if($body_last_data['head_circumference']){
|
||||
$temporary_head_circumference = json_decode($body_last_data['head_circumference'],true);
|
||||
$body_last_data_head_circumference_list = Db::table($this->body_db_name['body_data_new'])
|
||||
->where("is_del = 0 AND aud_id = ".$data['aud_id']." AND head_circumference IS NOT NULL")
|
||||
->order('record_time desc,id desc')
|
||||
->field('id,head_circumference,record_time')
|
||||
->page('1,5')
|
||||
->select();
|
||||
$head_circumference_curve_list = [
|
||||
'title'=>'头围',
|
||||
'key'=>'head_circumference',
|
||||
'line'=>['categories'=>[],'series'=>[['color'=>'#55d87b','data'=>[]]]],
|
||||
];
|
||||
foreach ($body_last_data_head_circumference_list as $key => $value) {
|
||||
$head_circumference_curve_list['line']['categories'][] = $value['record_time'];
|
||||
$head_circumference_curve_list['line']['series'][0]['data'][] = floatval($value['head_circumference']);
|
||||
}
|
||||
$result_return['top_list'][] = [
|
||||
"name"=>$this->merged_data['head_circumference']['name'],
|
||||
'time' => $record_time,
|
||||
|
|
@ -1066,12 +1118,29 @@ class Userbody extends Base{
|
|||
"unit"=>$this->merged_data['head_circumference']['unit'],
|
||||
'standard' => $temporary_head_circumference['level']?$temporary_head_circumference['level']:0,
|
||||
'standard_color' => $temporary_head_circumference['color']?$temporary_head_circumference['color']:0,
|
||||
'key_name' => 'head_circumference',
|
||||
'bk_color'=>'#ddfaef',
|
||||
'curve_list' => $head_circumference_curve_list,
|
||||
'ideal_head_circumference' => '',
|
||||
];
|
||||
}
|
||||
// 如果有心率
|
||||
if($body_last_data['heart_rate']){
|
||||
$temporary_standard_color = $this->judgment_standard_color(floatval($body_last_data['heart_rate']),'heart_rate',$user_data);
|
||||
$body_last_data_heart_rate_list = Db::table($this->body_db_name['body_data_new'])
|
||||
->where("is_del = 0 AND aud_id = ".$data['aud_id']." AND heart_rate IS NOT NULL")
|
||||
->order('record_time desc,id desc')
|
||||
->field('id,heart_rate,record_time')
|
||||
->page('1,5')
|
||||
->select();
|
||||
$heart_rate_curve_list = [
|
||||
'title'=>'心率',
|
||||
'key'=>'heart_rate',
|
||||
'line'=>['categories'=>[],'series'=>[['color'=>'#fb8587','data'=>[]]]],
|
||||
];
|
||||
foreach ($body_last_data_heart_rate_list as $key => $value) {
|
||||
$heart_rate_curve_list['line']['categories'][] = $value['record_time'];
|
||||
$heart_rate_curve_list['line']['series'][0]['data'][] = floatval($value['heart_rate']);
|
||||
}
|
||||
$result_return['top_list'][] = [
|
||||
"name"=>$this->merged_data['heart_rate']['name'],
|
||||
'time' => $record_time,
|
||||
|
|
@ -1080,17 +1149,16 @@ class Userbody extends Base{
|
|||
'standard' => $temporary_standard_color[1],
|
||||
'standard_color' => $temporary_standard_color[2],
|
||||
'key_name' => 'heart_rate',
|
||||
'bk_color'=>'#fbeeee',
|
||||
'curve_list' => $heart_rate_curve_list,
|
||||
'ideal_heart_rate' => $temporary_standard_color[3],
|
||||
];
|
||||
}
|
||||
// 处理卡片数据
|
||||
if($body_last_data['record_type'] == 'by_hand_means'){
|
||||
return $this->msg($result_return);
|
||||
}else{
|
||||
// 设置卡片顺序
|
||||
$set_order = [
|
||||
'ideal_weight', //体脂率
|
||||
'ideal_height', //体脂率
|
||||
'ideal_bmi', //体脂率
|
||||
// 'ideal_weight', //体脂率
|
||||
// 'ideal_height', //体脂率
|
||||
// 'ideal_bmi', //体脂率
|
||||
'fat_r', //体脂率
|
||||
'fat_w', //脂肪量
|
||||
'muscle', //肌肉率
|
||||
|
|
@ -1106,6 +1174,41 @@ class Userbody extends Base{
|
|||
'score', //身体得分☆
|
||||
'body_age', //身体年龄☆
|
||||
];
|
||||
// 处理卡片数据
|
||||
if($body_last_data['record_type'] == 'by_hand_means'){
|
||||
foreach ($set_order as $key => $value) {
|
||||
$result_return['card_list'][] = [
|
||||
'name'=>$this->merged_data[$value]['name'],
|
||||
'icon'=>$this->merged_data[$value]['icon'],
|
||||
'value'=>'--',
|
||||
'unit'=>$this->merged_data[$value]['unit'],
|
||||
'standard'=>'',
|
||||
'standard_color'=>'',
|
||||
'key_name'=>$value,
|
||||
];
|
||||
}
|
||||
return $this->msg($result_return);
|
||||
}else{
|
||||
// 设置卡片顺序
|
||||
// $set_order = [
|
||||
// 'ideal_weight', //体脂率
|
||||
// 'ideal_height', //体脂率
|
||||
// 'ideal_bmi', //体脂率
|
||||
// 'fat_r', //体脂率
|
||||
// 'fat_w', //脂肪量
|
||||
// 'muscle', //肌肉率
|
||||
// 'muscleval', //肌肉量
|
||||
// 'protein', //蛋白率
|
||||
// 'proteinval', //蛋白量
|
||||
// 'water', //水分
|
||||
// 'sfr', //皮下脂肪
|
||||
// 'body_level', //肥胖等级☆
|
||||
// 'visceral', //内脏指数
|
||||
// 'bone', //骨重
|
||||
// 'body_type', //身体类型☆
|
||||
// 'score', //身体得分☆
|
||||
// 'body_age', //身体年龄☆
|
||||
// ];
|
||||
$temporary_three = [];
|
||||
foreach ($set_order as $key => $value) {
|
||||
|
||||
|
|
@ -1123,7 +1226,13 @@ class Userbody extends Base{
|
|||
}else{
|
||||
if($value == 'ideal_weight' || $value == 'ideal_height' || $value == 'ideal_bmi'){
|
||||
$temporary_standard_color = $this->judgment_standard_color('none',$value,$user_data);
|
||||
// dump($temporary_standard_color);
|
||||
if($temporary_standard_color){
|
||||
|
||||
if($value == 'ideal_weight'){
|
||||
// dump($temporary_standard_color);
|
||||
// die;
|
||||
$result_return['top_list'][0]['ideal_weight'] = $temporary_standard_color;
|
||||
$result_return['card_list'][] = [
|
||||
'name'=>$this->merged_data[$value]['name'],
|
||||
'icon'=>$this->merged_data[$value]['icon'],
|
||||
|
|
@ -1133,7 +1242,13 @@ class Userbody extends Base{
|
|||
'standard_color'=>'',
|
||||
'key_name'=>$value,
|
||||
];
|
||||
}else if($value == 'ideal_height'){
|
||||
$result_return['top_list'][1]['ideal_height'] = $temporary_standard_color;
|
||||
}else if($value == 'ideal_bmi'){
|
||||
$result_return['top_list'][2]['ideal_bmi'] = $temporary_standard_color;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if($value == 'fat_w' || $value == 'muscleval' || $value == 'proteinval'){
|
||||
|
|
@ -1287,15 +1402,24 @@ class Userbody extends Base{
|
|||
if($temporary_data_list){
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}else if($value == 'body_type'){
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data[$value],$value,$user_data);
|
||||
if($temporary_data_list){
|
||||
$temporary_data_list['l_line_color'] = ['name'=>'体脂率','standard_list'=>[['name'=>'偏低','color'=>'#EAAE29'],['name'=>'标准、偏高','color'=>'#0AD2B0'],['name'=>'过高、超高','color'=>'#F83F29']]];
|
||||
$temporary_data_list['r_line_color'] = ['name'=>'肌肉量','standard_list'=>[['name'=>'偏低','color'=>'#4db4ec'],['name'=>'标准','color'=>'#8bcc4c'],['name'=>'优秀','color'=>'#159383']]];
|
||||
$temporary_data_list['box_list'] = ['浮肿肥胖型','偏胖肌肉型','肌肉型偏胖','缺乏运动型','标准型','标准肌肉型','偏瘦型','偏瘦肌肉型','肌肉发达型'];
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}else{
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data[$value],$value,$user_data);
|
||||
if($temporary_data_list){
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//身体
|
||||
|
||||
return $this->msg($result_return);
|
||||
|
||||
|
|
@ -1323,8 +1447,8 @@ class Userbody extends Base{
|
|||
$user_data['weight'] = $body_last_data['weight'];
|
||||
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data['score'],'score',$user_data);
|
||||
$result_return[] = [
|
||||
'title_key'=>'user_data',
|
||||
$result_return['user_data'] = [
|
||||
// 'title_key'=>'user_data',
|
||||
'title_name'=>'',
|
||||
'nickname'=>$user_data['nickname'],
|
||||
'head_pic'=>$user_data['head_pic'],
|
||||
|
|
@ -1332,16 +1456,17 @@ class Userbody extends Base{
|
|||
'record_time'=>$body_last_data['record_time'],
|
||||
'age'=>$this->calculate_age($user_data['birthday']),
|
||||
'height'=>$body_last_data['height'],
|
||||
'weight'=>$body_last_data['weight'],
|
||||
'score'=>$temporary_data_list?$temporary_data_list['value']:0,
|
||||
];
|
||||
|
||||
// 如果有心率
|
||||
if($body_last_data['heart_rate']){
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data['heart_rate'],'heart_rate',$user_data);
|
||||
$result_return[] = [
|
||||
'title_key'=>'heart_rate',
|
||||
$result_return['heart_rate'] = [
|
||||
// 'title_key'=>'heart_rate',
|
||||
'title_name'=>'心脏健康',
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/heart_rate.png",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/heart_rate.png",
|
||||
'value'=>"心率 ".$temporary_data_list['value'],
|
||||
'unit'=>$temporary_data_list['unit'],
|
||||
'standard'=>$temporary_data_list['standard'],
|
||||
|
|
@ -1349,6 +1474,8 @@ class Userbody extends Base{
|
|||
'standard_list'=>$temporary_data_list['standard_list'],
|
||||
'offset'=>$temporary_data_list['offset'],
|
||||
];
|
||||
}else{
|
||||
$result_return['heart_rate'] = [];
|
||||
}
|
||||
|
||||
$temporary_data_list['weight'] = $this->judgment_standard_color_detailed($body_last_data['weight'],'weight',$user_data);
|
||||
|
|
@ -1361,7 +1488,7 @@ class Userbody extends Base{
|
|||
if(count($temporary_data_list['weight']['standard_list'])){
|
||||
foreach ($temporary_data_list['weight']['standard_list'] as $key => $value) {
|
||||
if($value['text'] == $temporary_data_list['weight']['standard']){
|
||||
$temporary_body_data['weight'][0] = "体重(".$value['min_val']."~".$value['max_val'].")";
|
||||
$temporary_body_data['weight'][0] = $value['min_val']."~".$value['max_val'].")";
|
||||
$temporary_body_data['weight'][1] = '';
|
||||
}
|
||||
}
|
||||
|
|
@ -1382,17 +1509,17 @@ class Userbody extends Base{
|
|||
$temporary_body_data['fat_w'][1] = bcdiv($body_last_data['fat_w'],$body_last_data['weight'],2);
|
||||
}
|
||||
// 肌肉量
|
||||
if(count($temporary_data_list['muscleval']['standard_list'])){
|
||||
foreach ($temporary_data_list['muscleval']['standard_list'] as $key => $value) {
|
||||
if($value['text'] == $temporary_data_list['muscleval']['standard']){
|
||||
$temporary_body_data['muscleval'][0] = "(".$value['min_val']."~".$value['max_val'].")";
|
||||
$temporary_body_data['muscleval'][1] = bcdiv($body_last_data['muscleval'],$body_last_data['weight'],2);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$temporary_body_data['muscleval'][0] = '';
|
||||
$temporary_body_data['muscleval'][1] = bcdiv($body_last_data['muscleval'],$body_last_data['weight'],2);
|
||||
}
|
||||
// if(count($temporary_data_list['muscleval']['standard_list'])){
|
||||
// foreach ($temporary_data_list['muscleval']['standard_list'] as $key => $value) {
|
||||
// if($value['text'] == $temporary_data_list['muscleval']['standard']){
|
||||
// $temporary_body_data['muscleval'][0] = "(".$value['min_val']."~".$value['max_val'].")";
|
||||
// $temporary_body_data['muscleval'][1] = bcdiv($body_last_data['muscleval'],$body_last_data['weight'],2);
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// $temporary_body_data['muscleval'][0] = '';
|
||||
// $temporary_body_data['muscleval'][1] = bcdiv($body_last_data['muscleval'],$body_last_data['weight'],2);
|
||||
// }
|
||||
// 蛋白量
|
||||
if(count($temporary_data_list['proteinval']['standard_list'])){
|
||||
foreach ($temporary_data_list['proteinval']['standard_list'] as $key => $value) {
|
||||
|
|
@ -1418,35 +1545,35 @@ class Userbody extends Base{
|
|||
$temporary_body_data['water'][1] = bcdiv($body_last_data['water'],$body_last_data['weight'],2);
|
||||
}
|
||||
// 骨重
|
||||
if(count($temporary_data_list['bone']['standard_list'])){
|
||||
foreach ($temporary_data_list['bone']['standard_list'] as $key => $value) {
|
||||
if($value['text'] == $temporary_data_list['bone']['standard']){
|
||||
$temporary_body_data['bone'][0] = "(".$value['min_val']."~".$value['max_val'].")";
|
||||
$temporary_body_data['bone'][1] = bcdiv($body_last_data['bone'],$body_last_data['weight'],2);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$temporary_body_data['bone'][0] = '';
|
||||
$temporary_body_data['bone'][1] = bcdiv($body_last_data['bone'],$body_last_data['weight'],2);
|
||||
}
|
||||
// if(count($temporary_data_list['bone']['standard_list'])){
|
||||
// foreach ($temporary_data_list['bone']['standard_list'] as $key => $value) {
|
||||
// if($value['text'] == $temporary_data_list['bone']['standard']){
|
||||
// $temporary_body_data['bone'][0] = "(".$value['min_val']."~".$value['max_val'].")";
|
||||
// $temporary_body_data['bone'][1] = bcdiv($body_last_data['bone'],$body_last_data['weight'],2);
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// $temporary_body_data['bone'][0] = '';
|
||||
// $temporary_body_data['bone'][1] = bcdiv($body_last_data['bone'],$body_last_data['weight'],2);
|
||||
// }
|
||||
|
||||
// 加 bcadd(,,20)
|
||||
// 减 bcsub(,,20)
|
||||
// 乘 bcmul(,,20)
|
||||
// 除 bcdiv(,,20)
|
||||
$result_return[] = [
|
||||
'title_key'=>'body_data',
|
||||
$result_return['body_data'] = [
|
||||
// 'title_key'=>'body_data',
|
||||
'title_name'=>'身体成分分析',
|
||||
"icon"=>"http://tc.pcxbc.com/new_reedaw/icon/body_data.png",
|
||||
"title"=>$temporary_body_data['weight'][0],
|
||||
'standard'=>$temporary_body_data == ''?'':$temporary_data_list['standard'],
|
||||
"description"=>"*总体重=体水分量+蛋白质量+脂肪量+肌肉量+骨重+其他",
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/body_data.png",
|
||||
"title"=>"体重(".$temporary_body_data['weight'][0]."",
|
||||
'standard'=>$temporary_data_list['weight']['standard'] == ''?'':$temporary_data_list['weight']['standard'],
|
||||
"description"=>"*总体重=体水分量+蛋白质量+脂肪量+其他",
|
||||
'list'=>[
|
||||
['color'=>'#3E7AF6','name'=>'体水分量','scope'=>$temporary_body_data['water'][0],'value'=>$body_last_data['water'],'offset'=>$temporary_body_data['water'][1]],
|
||||
['color'=>'#FFB119','name'=>'蛋白质量','scope'=>$temporary_body_data['proteinval'][0],'value'=>$body_last_data['proteinval'],'offset'=>$temporary_body_data['proteinval'][1]],
|
||||
['color'=>'#31D4F5','name'=>'脂肪量','scope'=>$temporary_body_data['fat_w'][0],'value'=>$body_last_data['fat_w'],'offset'=>$temporary_body_data['fat_w'][1]],
|
||||
['color'=>'#E749F5','name'=>'肌肉量','scope'=>$temporary_body_data['muscleval'][0],'value'=>$body_last_data['muscleval'],'offset'=>$temporary_body_data['muscleval'][1]],
|
||||
['color'=>'#1EA04A','name'=>'骨重','scope'=>$temporary_body_data['bone'][0],'value'=>$body_last_data['bone'],'offset'=>$temporary_body_data['bone'][1]],
|
||||
// ['color'=>'#E749F5','name'=>'肌肉量','scope'=>$temporary_body_data['muscleval'][0],'value'=>$body_last_data['muscleval'],'offset'=>$temporary_body_data['muscleval'][1]],
|
||||
// ['color'=>'#1EA04A','name'=>'骨重','scope'=>$temporary_body_data['bone'][0],'value'=>$body_last_data['bone'],'offset'=>$temporary_body_data['bone'][1]],
|
||||
[
|
||||
'color'=>'#999999',
|
||||
'name'=>'其他',
|
||||
|
|
@ -1456,74 +1583,268 @@ class Userbody extends Base{
|
|||
],
|
||||
],
|
||||
'value'=>$body_last_data['weight'],
|
||||
'unit'=>$temporary_data_list['unit'],
|
||||
'unit'=>$temporary_data_list['weight']['unit'],
|
||||
];
|
||||
//肌肉脂肪分析
|
||||
$result_return['muscle_fat'] = [
|
||||
// 'title_key'=>'muscle_fat',
|
||||
'title_name'=>'肌肉脂肪分析',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/muscle_fat.png",
|
||||
// "title"=>$temporary_body_data['weight'][0],
|
||||
'list'=>[
|
||||
[
|
||||
'name'=>'体重',
|
||||
'unit'=>'kg',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>50,
|
||||
'standard'=>'标准',
|
||||
'standard_color'=>'#59D168',
|
||||
'offset'=>'50',
|
||||
],
|
||||
[
|
||||
'name'=>'骨骼肌量(kg)',
|
||||
'unit'=>'kg',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>45,
|
||||
'standard'=>'标准',
|
||||
'standard_color'=>'#59D168',
|
||||
'offset'=>'45',
|
||||
],
|
||||
[
|
||||
'name'=>'脂肪量',
|
||||
'unit'=>'kg',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>70,
|
||||
'standard'=>'偏高',
|
||||
'standard_color'=>'#FFAF04',
|
||||
'offset'=>'70',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
// 节段脂肪分析
|
||||
$result_return['segment_fat'] = [
|
||||
// 'title_key'=>'segment_fat',
|
||||
'title_name'=>'节段脂肪分析',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/segment_fat.png",
|
||||
"bg_img"=>"https://tc.pcxbc.com/new_reedaw/icon/segment_fat".$user_data['gender'].".png",
|
||||
'list'=>[
|
||||
[
|
||||
'name'=>'L:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'R:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'B:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'L:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'R:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
],
|
||||
];
|
||||
// 肌肉平衡
|
||||
$result_return['segment_muscle'] = [
|
||||
// 'title_key'=>'segment_muscle',
|
||||
'title_name'=>'肌肉平衡',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/segment_fat.png",
|
||||
"bg_img"=>"https://tc.pcxbc.com/new_reedaw/icon/segment_fat".$user_data['gender'].".png",
|
||||
'list'=>[
|
||||
[
|
||||
'name'=>'L:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'R:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'B:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'L:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
[
|
||||
'name'=>'R:',
|
||||
'value'=>'1',
|
||||
'unit'=>'kg',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
//肥胖分析
|
||||
$result_return['fat_analysis'] = [
|
||||
// 'title_key'=>'fat_analysis',
|
||||
'title_name'=>'肥胖分析',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/fat_analysis.png",
|
||||
// "title"=>$temporary_body_data['weight'][0],
|
||||
'list'=>[
|
||||
[
|
||||
'name'=>'BMI',
|
||||
'unit'=>'kg/m²',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>70,
|
||||
'standard'=>'偏高',
|
||||
'standard_color'=>'#FFAF04',
|
||||
'offset'=>'70',
|
||||
],
|
||||
[
|
||||
'name'=>'体脂率',
|
||||
'unit'=>'%',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>50,
|
||||
'standard'=>'标准',
|
||||
'standard_color'=>'#59D168',
|
||||
'offset'=>'50',
|
||||
],
|
||||
[
|
||||
'name'=>'肥胖水平',
|
||||
'unit'=>'',
|
||||
'description'=>$this->merged_data['weight']['description'],
|
||||
'smart_tip_description'=>'',
|
||||
'icon'=>'',
|
||||
'list'=>$this->merged_data['weight']['standard_list'],
|
||||
'standard_list'=>[
|
||||
['min_val'=>'0','max_val'=>'20','text'=>'低','color'=>'#F8595D'],
|
||||
['min_val'=>'20','max_val'=>'40','text'=>'偏低','color'=>'#FFAF04'],
|
||||
['min_val'=>'40','max_val'=>'60','text'=>'标准','color'=>'#59D168'],
|
||||
['min_val'=>'60','max_val'=>'80','text'=>'偏高','color'=>'#FFAF04'],
|
||||
['min_val'=>'80','max_val'=>'100','text'=>'高','color'=>'#F8595D'],
|
||||
],
|
||||
'key_name'=>'weight',
|
||||
'value'=>9,
|
||||
'standard'=>'低',
|
||||
'standard_color'=>'#F8595D',
|
||||
'offset'=>'9',
|
||||
]
|
||||
],
|
||||
];
|
||||
//体重控制
|
||||
$result_return['weight_controller'] = [
|
||||
// 'title_key'=>'weight_controller',
|
||||
'title_name'=>'体重控制',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/weight_controller.png",
|
||||
// "title"=>$temporary_body_data['weight'][0],
|
||||
'list'=>[
|
||||
['name'=>'数据','value'=>'测量值'],
|
||||
['name'=>'标准体重','value'=>'62kg'],
|
||||
['name'=>'控制体重','value'=>'-3.5kg'],
|
||||
['name'=>'BMR','value'=>'1500kcal'],
|
||||
],
|
||||
];
|
||||
//身体类型
|
||||
$result_return['body_type'] = [
|
||||
// 'title_key'=>'body_type',
|
||||
'title_name'=>'身体类型',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/body_data.png",
|
||||
// "title"=>$temporary_body_data['weight'][0],
|
||||
'l_line_color'=>['name'=>'脂肪率','standard_list'=>[['name'=>'偏低','color'=>'#4db4ec'],['name'=>'标准','color'=>'#8bcc4c'],['name'=>'偏高','color'=>'#dc0225']]],
|
||||
'r_line_color'=>['name'=>'肌肉量','standard_list'=>[['name'=>'偏低','color'=>'#4db4ec'],['name'=>'标准','color'=>'#8bcc4c'],['name'=>'优秀','color'=>'#299744']]],
|
||||
'box_list'=>['浮肿肥胖型','偏胖肌肉型','肌肉型偏胖','缺乏运动型','标准型','标准肌肉型','偏瘦型','偏瘦肌肉型','肌肉发达型'],
|
||||
'value'=>'浮肿肥胖型',
|
||||
];
|
||||
|
||||
//其他指标
|
||||
$result_return['other_data'] = [
|
||||
// 'title_key'=>'other_data',
|
||||
'title_name'=>'其他指标',
|
||||
"icon"=>"https://tc.pcxbc.com/new_reedaw/icon/other_data.png",
|
||||
// "title"=>$temporary_body_data['weight'][0],
|
||||
'list'=>[
|
||||
['name'=>'项目','value'=>'测量值'],
|
||||
['name'=>'去脂体重','value'=>'47.6kg'],
|
||||
['name'=>'皮下脂肪量','value'=>'15.2kg'],
|
||||
['name'=>'身体年龄','value'=>'33'],
|
||||
['name'=>'内脏脂肪','value'=>'9'],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->msg($result_return);
|
||||
|
||||
|
||||
|
||||
$set_order = [
|
||||
'weight', //体重
|
||||
'height', //身高
|
||||
'heart_rate', //心率
|
||||
'head_circumference', //头围
|
||||
'kcal', //BMR 静态基础代谢
|
||||
'bmi', //BMI
|
||||
'fat_r', //体脂率
|
||||
'fat_w', //脂肪量
|
||||
'muscle', //肌肉率
|
||||
'muscleval', //肌肉量
|
||||
'protein', //蛋白率
|
||||
'proteinval', //蛋白量
|
||||
'water', //水分
|
||||
'sfr', //皮下脂肪
|
||||
// '', //骨骼肌率
|
||||
// '', //骨路肌量
|
||||
'visceral', //内脏指数
|
||||
// '', //肌肉控制量
|
||||
// '', //脂筋控制量
|
||||
'ideal_weight', //理想体重
|
||||
'ideal_height', //理想身高
|
||||
'ideal_bmi', //理想bmi
|
||||
// '', //去脂体重
|
||||
// '', //控制体量
|
||||
'bone', //骨重
|
||||
'body_type', //身体类型☆
|
||||
'body_level', //肥胖等级☆
|
||||
// '', //健康评价
|
||||
'body_age', //身体年龄☆
|
||||
'score', //身体得分☆
|
||||
];
|
||||
|
||||
foreach ($set_order as $key => $value) {
|
||||
if($body_last_data['record_type'] == 'by_hand_means'){
|
||||
if($value == 'weight' || $value == 'height' || $value == 'bmi' || $value == 'head_circumference'){
|
||||
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data[$value],$value,$user_data);
|
||||
if($temporary_data_list){
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if($value == 'ideal_weight' || $value == 'ideal_height' || $value == 'ideal_bmi'){
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed(null,$value,$user_data);
|
||||
if($temporary_data_list){
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}else{
|
||||
$temporary_data_list = $this->judgment_standard_color_detailed($body_last_data[$value],$value,$user_data);
|
||||
if($temporary_data_list){
|
||||
$result_return[] = $temporary_data_list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $this->msg($result_return);
|
||||
|
||||
}
|
||||
public function set_target_weight_action($data){
|
||||
|
|
@ -2047,29 +2368,31 @@ class Userbody extends Base{
|
|||
// 如果落在区间内
|
||||
$return_data[] = $v['text'];
|
||||
$return_data[] = $v['color'];
|
||||
$return_data[] = bcdiv(bcadd($linshi_data['standard_list'][1]['min_val'],$linshi_data['standard_list'][1]['max_val'],20),2,0);
|
||||
}
|
||||
}
|
||||
if(count($return_data) <= 1){
|
||||
$return_data[] = '异常';
|
||||
$return_data[] = '#000000';
|
||||
$return_data[] = 0;
|
||||
}
|
||||
return $return_data;
|
||||
}else if($type == 'ideal_weight'){
|
||||
$bhw_date = Db::table($this->body_db_name['weight'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->cache(86400)->select();
|
||||
$bhw_date = Db::table($this->body_db_name['weight'])->where("Month >= $month_num and Sex = '$gender_val'")->order('Month')->limit(1)->cache(86400)->select();
|
||||
if($bhw_date){
|
||||
return $bhw_date[0]['median'];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else if($type == 'ideal_height'){
|
||||
$bhw_date = Db::table($this->body_db_name['height'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->cache(86400)->select();
|
||||
$bhw_date = Db::table($this->body_db_name['height'])->where("Month >= $month_num and Sex = '$gender_val'")->order('Month')->limit(1)->cache(86400)->select();
|
||||
if($bhw_date){
|
||||
return $bhw_date[0]['median'];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else if($type == 'ideal_bmi'){
|
||||
$bhw_date = Db::table($this->body_db_name['bmi'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->cache(86400)->select();
|
||||
$bhw_date = Db::table($this->body_db_name['bmi'])->where("Month >= $month_num and Sex = '$gender_val'")->order('Month')->limit(1)->cache(86400)->select();
|
||||
if($bhw_date){
|
||||
return $bhw_date[0]['median'];
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,9 @@ class Card extends Base{
|
|||
}
|
||||
|
||||
// 曲线页面-曲线接口
|
||||
public function card_curve_chart($data = ['aud_id'=>'11','s_time'=>'2024-04-01','e_time'=>'2024-12-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||
public function card_curve_chart($data = ['aud_id'=>'61','s_time'=>'2025-04-01','e_time'=>'2025-12-25','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||
// dump($data);
|
||||
// die;
|
||||
try {
|
||||
// 你的业务逻辑
|
||||
if(count(input('post.')) > 0){
|
||||
|
|
@ -946,6 +948,9 @@ class Card extends Base{
|
|||
->order('record_time desc')
|
||||
->select();
|
||||
|
||||
// dump($user_data_list);
|
||||
// die;
|
||||
|
||||
// 下面业务逻辑是取每天的,最近后一次记录成绩
|
||||
$data_arr = [];
|
||||
$record_arr1 = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue