diff --git a/application/app/controller/Calculatebody.php b/application/app/controller/Calculatebody.php index d1d8eb0..742cfec 100644 --- a/application/app/controller/Calculatebody.php +++ b/application/app/controller/Calculatebody.php @@ -219,6 +219,10 @@ class Calculatebody extends Controller{ // die; } + // 加 bcadd(,,20) + // 减 bcsub(,,20) + // 乘 bcmul(,,20) + // 除 bcdiv(,,20) // 计算身体数据,BMI、脂肪率、脂肪量、肌肉率、肌肉量.... function calculate_body_data($height,$weight,$age,$gender,$impedance){ @@ -231,8 +235,9 @@ class Calculatebody extends Controller{ if ($weight != 0 && $height != 0) { // 计算BMI // dump(bcmul($mheight, $mheight,20)); - $bmi = bcmul(bcdiv($weight, bcmul($mheight, $mheight,20), 20), '10.0', 20); // 先算除法再算乘法 - $bmi = bcdiv($bmi, '10.0', 2); // 最后除以10,保留一位小数 + // $bmi = bcmul(bcdiv($weight, bcmul($mheight, $mheight,20), 20), '10.0', 20); // 先算除法再算乘法 + $bmi = bcdiv($weight, bcmul($mheight, $mheight,20), 2); + // $bmi = bcdiv($bmi, '10.0', 2); // 最后除以10,保留2位小数 $result_data['bmi'] = $bmi; $result_data['bone'] = 0; $result_data['muscle'] = 0; diff --git a/application/app/controller/Sportstesting.php b/application/app/controller/Sportstesting.php new file mode 100644 index 0000000..446e910 --- /dev/null +++ b/application/app/controller/Sportstesting.php @@ -0,0 +1,351 @@ +[ + 'xc'=>[ + 'xc_1'=>[ + '1'=>[ + '1000米'=>[ + 'list'=>[ + '4:05'=>'8', + '4:11'=>'7.5', + '4:18'=>'7', + '4:26'=>'6.5', + '4:35'=>'6', + '4:45'=>'5.5', + '4:55'=>'5', + '5:01'=>'4.5', + '5:07'=>'4', + '5:13'=>'3.5', + '5:20'=>'3', + '5:27'=>'2.5', + '5:34'=>'2', + '5:42'=>'1.5', + '5:50'=>'1', + '5:59'=>'0.5', + '6:00'=>'0' + ], + 'unit'=>'分/秒', + 'proportion'=>'1', + ], + ], + '2'=>[ + '800米'=>['list'=>['3:55'=>'8','4:01'=>'7.5','4:08'=>'7','4:16'=>'6.5','4:25'=>'6','4:35'=>'5.5','4:45'=>'5','4:49'=>'4.5','4:53'=>'4','4:57'=>'3.5','5:02'=>'3','5:07'=>'2.5','5:12'=>'2','5:19'=>'1.5','5:26'=>'1','5:35'=>'0.5','5:36'=>'0',],'unit'=>'分/秒','proportion'=>'1',] + ], + ], + 'xc_2'=>[ + '1'=>[ + '引体向上'=>['list'=>['11'=>'8','10'=>'7.5','9'=>'7','8'=>'6.5','7'=>'6','6'=>'5.5','5'=>'5','4'=>'4.5','3'=>'4','2'=>'3.5','1'=>'3'],'unit'=>'次','proportion'=>'1',], + '双杠臂屈伸'=>['list'=>['11'=>'8','10'=>'7.5','9'=>'7','8'=>'6.5','7'=>'6','6'=>'5.5','5'=>'5','4'=>'4.5','3'=>'4','2'=>'3.5','1'=>'3'],'unit'=>'次','proportion'=>'1',], + ], + '2'=>[ + '斜身引体'=>['list'=>['40'=>'8','36'=>'7.5','32'=>'7','28'=>'6.5','24'=>'6','20'=>'5.5','16'=>'5','12'=>'4.5','10'=>'4','9'=>'3.5','8'=>'3','7'=>'2.5','6'=>'2','5'=>'1.5','4'=>'1','3'=>'0.5','2'=>'0'],'unit'=>'次','proportion'=>'1',], + '仰卧起坐'=>['list'=>['42'=>'8','40'=>'7.5','37'=>'7','34'=>'6.5','30'=>'6','26'=>'5.5','22'=>'5','21'=>'4.5','20'=>'4','19'=>'3.5','18'=>'3','17'=>'2.5','16'=>'2','15'=>'1.5','14'=>'1','13'=>'0.5','12'=>'0'],'unit'=>'次','proportion'=>'1',], + ], + ], + 'xc_3'=>[ + '1'=>[ + '足球运球/射门'=>['list'=>['19.5'=>'8','20.0'=>'7.5','20.5'=>'7','21.0'=>'6.5','21.5'=>'6','22.0'=>'5.5','22.5'=>'5','23.0'=>'4.5','23.8'=>'4','24.6'=>'3.5','25.4'=>'3','26.2'=>'2.5','27.0'=>'2','27.8'=>'1.5','28.6'=>'1','29.4'=>'0.5','29.5'=>'0'],'unit'=>'秒','proportion'=>'1',], + ], + '2'=>[ + '足球运球/射门'=>['list'=>['21.0'=>'8','21.5'=>'7.5','22.0'=>'7','22.5'=>'6.5','23.0'=>'6','23.5'=>'5.5','24.0'=>'5','24.5'=>'4.5','25.3'=>'4','26.1'=>'3.5','26.9'=>'3','27.7'=>'2.5','28.5'=>'2','29.3'=>'1.5','30.1'=>'1','30.9'=>'0.5','31.0'=>'0'],'unit'=>'秒','proportion'=>'1',], + ], + ], + 'xc_4'=>[ + '1'=>[ + '100米游泳'=>['list'=>['2:25'=>'6','2:35'=>'5.5','2:45'=>'5','2:55'=>'4.5','3:05'=>'4','3:15'=>'3.5','3:30'=>'3','3:40'=>'2.5','3:50'=>'2','4:00'=>'1.5','4:10'=>'1','4:20'=>'0.5','4:21'=>'0'],'unit'=>'分/秒','proportion'=>'1',], + ], + '2'=>[ + '100米游泳'=>['list'=>['2:40'=>'6','2:48'=>'5.5','2:56'=>'5','3:04'=>'4.5','3:12'=>'4','3:20'=>'3.5','3:30'=>'3','3:40'=>'2.5','3:50'=>'2','4:00'=>'1.5','4:10'=>'1','4:20'=>'0.5','4:21'=>'0'],'unit'=>'分/秒','proportion'=>'1',], + ], + ], + ], + 'gc'=>[ + 'gc_8'=>[ + '1'=>[ + 'BMI'=>['list'=>['15.6'=>'80','22.5'=>'100','25.2'=>'80','100'=>'60'],'unit'=>'','proportion'=>'0.15',], + '肺活量'=>['list'=>['3940'=>'100','3820'=>'95','3700'=>'90','3450'=>'85','3200'=>'80','3080'=>'78','2960'=>'76','2840'=>'74','2720'=>'72','2600'=>'70','2480'=>'68','2360'=>'66','2240'=>'64','2120'=>'62','2000'=>'60','1890'=>'50','1780'=>'40','1670'=>'30','1560'=>'20','1450'=>'10',],'unit'=>'ml','proportion'=>'0.15',], + '50米跑'=>[ + 'list'=>[ + '7.5'=>'100', + '7.6'=>'95', + '7.7'=>'90', + '7.8'=>'85', + '7.9'=>'80', + '8.1'=>'78', + '8.3'=>'76', + '8.5'=>'74', + '8.7'=>'72', + '8.9'=>'70', + '9.1'=>'68', + '9.3'=>'66', + '9.5'=>'64', + '9.7'=>'62', + '9.9'=>'60', + '10.1'=>'50', + '10.3'=>'40', + '10.5'=>'30', + '10.7'=>'20', + '10.9'=>'10', + ], + 'unit'=>'秒', + 'proportion'=>'0.2', + ], + '坐位体前屈'=>[ + 'list'=>[ + '19.6'=>'100', + '17.7'=>'95', + '15.8'=>'90', + '13.7'=>'85', + '11.6'=>'80', + '10.3'=>'78', + '9'=>'76', + '7.7'=>'74', + '6.4'=>'72', + '5.1'=>'70', + '3.8'=>'68', + '2.5'=>'66', + '1.2'=>'64', + '-0.1'=>'62', + '-1.4'=>'60', + '-2.6'=>'50', + '-3.8'=>'40', + '-5'=>'30', + '-6.2'=>'20', + '-7.4'=>'10', + ], + 'unit'=>'cm', + 'proportion'=>'0.1', + ], + '立定跳远'=>[ + 'list'=>[ + '240'=>'100', + '233'=>'95', + '226'=>'90', + '218'=>'85', + '210'=>'80', + '206'=>'78', + '202'=>'76', + '198'=>'74', + '194'=>'72', + '190'=>'70', + '186'=>'68', + '182'=>'66', + '178'=>'64', + '174'=>'62', + '170'=>'60', + '165'=>'50', + '160'=>'40', + '155'=>'30', + '150'=>'20', + '145'=>'10', + ], + 'unit'=>'cm', + 'proportion'=>'0.1', + ], + '引体向上'=>[ + 'list'=>[ + '240'=>'100', + '233'=>'95', + '226'=>'90', + '218'=>'85', + '210'=>'80', + '206'=>'78', + '202'=>'76', + '198'=>'74', + '194'=>'72', + '190'=>'70', + '186'=>'68', + '182'=>'66', + '178'=>'64', + '174'=>'62', + '170'=>'60', + '165'=>'50', + '160'=>'40', + '155'=>'30', + '150'=>'20', + '145'=>'10', + ], + 'unit'=>'cm', + 'proportion'=>'0.1', + ], + ], + '2'=>[ + 'BMI'=>[ + 'list'=>[ + '15.2'=>'80', + '22.2'=>'100', + '24.8'=>'80', + '100'=>'60' + ], + 'unit'=>'', + 'proportion'=>'0.15', + ], + '肺活量'=>[ + 'list'=>[ + '2900'=>'100', + '2850'=>'95', + '2800'=>'90', + '2650'=>'85', + '2500'=>'80', + '2400'=>'78', + '2300'=>'76', + '2200'=>'74', + '2100'=>'72', + '2000'=>'70', + '1900'=>'68', + '1800'=>'66', + '1700'=>'64', + '1600'=>'62', + '1500'=>'60', + '1460'=>'50', + '1420'=>'40', + '1380'=>'30', + '1340'=>'20', + '1300'=>'10', + ], + 'unit'=>'ml', + 'proportion'=>'0.15', + ], + '50米跑'=>[ + 'list'=>[ + '8'=>'100', + '8.1'=>'95', + '8.2'=>'90', + '8.5'=>'85', + '8.8'=>'80', + '9'=>'78', + '9.2'=>'76', + '9.4'=>'74', + '9.6'=>'72', + '9.8'=>'70', + '10'=>'68', + '10.2'=>'66', + '10.4'=>'64', + '10.6'=>'62', + '10.8'=>'60', + '11'=>'50', + '11.2'=>'40', + '11.4'=>'30', + '11.6'=>'20', + '11.8'=>'10', + ], + 'unit'=>'秒', + 'proportion'=>'0.2', + ], + '坐位体前屈'=>[ + 'list'=>[ + '22.7'=>'100', + '21'=>'95', + '19.3'=>'90', + '17.6'=>'85', + '15.9'=>'80', + '14.6'=>'78', + '13.3'=>'76', + '12'=>'74', + '10.7'=>'72', + '9.4'=>'70', + '8.1'=>'68', + '6.8'=>'66', + '5.5'=>'64', + '4.2'=>'62', + '2.9'=>'60', + '2.1'=>'50', + '1.3'=>'40', + '0.5'=>'30', + '-0.3'=>'20', + '-1.1'=>'10', + ], + 'unit'=>'cm', + 'proportion'=>'0.1', + ], + '立定跳远'=>[ + 'list'=>[ + '240'=>'100', + '233'=>'95', + '226'=>'90', + '218'=>'85', + '210'=>'80', + '206'=>'78', + '202'=>'76', + '198'=>'74', + '194'=>'72', + '190'=>'70', + '186'=>'68', + '182'=>'66', + '178'=>'64', + '174'=>'62', + '170'=>'60', + '165'=>'50', + '160'=>'40', + '155'=>'30', + '150'=>'20', + '145'=>'10', + ], + 'unit'=>'cm', + 'proportion'=>'0.1', + ], + ], + ] + ] + ], + ]; + + // 加 bcadd(,,20) + // 减 bcsub(,,20) + // 乘 bcmul(,,20) + // 除 bcdiv(,,20) + ################################################################接口################################################################ + ################################################################接口################################################################ + ################################################################接口################################################################ + // 获取体测最后一次数据 + public function sportstesting_get_last_data($data = ['aud_id'=>'25','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + if(count(input('post.')) > 0){ + $data = input('post.'); + } + if(!array_key_exists('aud_id', $data) || !array_key_exists('card_order', $data) || !array_key_exists('token', $data)){ + return $this->msg(10001); + } + if($this->token_time_validate($data['token']) === false){ + return $this->msg(20001); + } + unset($data['token']); + return $this->sportstesting_get_last_data_action($data); + } + + // 获取体测最后一次数据 + public function sportstesting_set_once_data($data = ['aud_id'=>'25','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + if(count(input('post.')) > 0){ + $data = input('post.'); + } + if(!array_key_exists('aud_id', $data) || !array_key_exists('card_order', $data) || !array_key_exists('token', $data)){ + return $this->msg(10001); + } + if($this->token_time_validate($data['token']) === false){ + return $this->msg(20001); + } + unset($data['token']); + return $this->sportstesting_get_last_data_action($data); + } + + ################################################################业务################################################################ + + public function sportstesting_get_last_data_action($data){ + + + } +} \ No newline at end of file