From 2bd3991a965c2061cb586b7f48c1243eb27393fb Mon Sep 17 00:00:00 2001 From: tiansf Date: Mon, 3 Jun 2024 01:42:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=B0=E5=88=86=E6=B5=8B=E8=AF=950603?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/app/controller/Sportstesting.php | 516 +++++++++++++++++-- application/route.php | 13 +- 2 files changed, 486 insertions(+), 43 deletions(-) diff --git a/application/app/controller/Sportstesting.php b/application/app/controller/Sportstesting.php index 446e910..c3992ac 100644 --- a/application/app/controller/Sportstesting.php +++ b/application/app/controller/Sportstesting.php @@ -13,7 +13,6 @@ use app\app\controller\Skip; class Sportstesting extends Base{ protected $color = ['#FF5656','#FF5656','#5AD06D','#6492F6','#3967D6']; - protected $city_data_rule2 = [ '北京'=>[ 'xc'=>[ @@ -40,45 +39,46 @@ class Sportstesting extends Base{ '6:00'=>'0' ], 'unit'=>'分/秒', + 'value'=>'00:00', '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',] + '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'=>'分/秒','value'=>'00:00','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',], + '引体向上'=>['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'=>'次','value'=>'0','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'=>'次','value'=>'0','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',], + '斜身引体'=>['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'=>'次','value'=>'0','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'=>'次','value'=>'0','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',], + '足球运球/射门'=>['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'=>'秒','value'=>'00.0','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',], + '足球运球/射门'=>['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'=>'秒','value'=>'00.0','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',], + '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'=>'分/秒','value'=>'00:00','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',], + '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'=>'分/秒','value'=>'00:00','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',], + 'BMI'=>['list'=>['15.6'=>'80','22.5'=>'100','25.2'=>'80','100'=>'60'],'unit'=>'','value'=>'0','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','value'=>'0','proportion'=>'0.15',], '50米跑'=>[ 'list'=>[ '7.5'=>'100', @@ -103,6 +103,7 @@ class Sportstesting extends Base{ '10.9'=>'10', ], 'unit'=>'秒', + 'value'=>'0', 'proportion'=>'0.2', ], '坐位体前屈'=>[ @@ -129,6 +130,7 @@ class Sportstesting extends Base{ '-7.4'=>'10', ], 'unit'=>'cm', + 'value'=>'0', 'proportion'=>'0.1', ], '立定跳远'=>[ @@ -155,33 +157,81 @@ class Sportstesting extends Base{ '145'=>'10', ], 'unit'=>'cm', + 'value'=>'0', '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', + '14'=>'100', + '13'=>'95', + '12'=>'90', + '11'=>'85', + '10'=>'80', + '9'=>'76', + '8'=>'72', + '7'=>'68', + '6'=>'64', + '5'=>'60', + '4'=>'50', + '3'=>'40', + '2'=>'30', + '1'=>'20', + '0'=>'10', ], 'unit'=>'cm', + 'value'=>'0', 'proportion'=>'0.1', + 'add_point'=>[ + '10'=>'10', + '9'=>'9', + '8'=>'8', + '7'=>'7', + '6'=>'6', + '5'=>'5', + '4'=>'4', + '3'=>'3', + '2'=>'2', + '1'=>'1', + ] + ], + '男生1000米'=>[ + 'list'=>[ + '3:50'=>'100', + '3:55'=>'95', + '4:00'=>'90', + '4:07'=>'85', + '4:15'=>'80', + '4:20'=>'78', + '4:25'=>'76', + '4:30'=>'74', + '4:35'=>'72', + '4:40'=>'70', + '4:45'=>'68', + '4:50'=>'66', + '4:55'=>'64', + '5:00'=>'62', + '5:05'=>'60', + '5:25'=>'50', + '5:45'=>'40', + '6:05'=>'30', + '6:25'=>'20', + '6:45'=>'10', + ], + 'unit'=>'cm', + 'value'=>'00:00', + 'proportion'=>'0.2', + 'add_point'=>[ + '-35'=>'10', + '-32'=>'9', + '-29'=>'8', + '-26'=>'7', + '-23'=>'6', + '-20'=>'5', + '-16'=>'4', + '-12'=>'3', + '-8'=>'2', + '-4'=>'1', + ] ], ], '2'=>[ @@ -193,6 +243,7 @@ class Sportstesting extends Base{ '100'=>'60' ], 'unit'=>'', + 'value'=>'0', 'proportion'=>'0.15', ], '肺活量'=>[ @@ -219,6 +270,7 @@ class Sportstesting extends Base{ '1300'=>'10', ], 'unit'=>'ml', + 'value'=>'0', 'proportion'=>'0.15', ], '50米跑'=>[ @@ -245,6 +297,7 @@ class Sportstesting extends Base{ '11.8'=>'10', ], 'unit'=>'秒', + 'value'=>'0', 'proportion'=>'0.2', ], '坐位体前屈'=>[ @@ -271,6 +324,7 @@ class Sportstesting extends Base{ '-1.1'=>'10', ], 'unit'=>'cm', + 'value'=>'0', 'proportion'=>'0.1', ], '立定跳远'=>[ @@ -297,8 +351,87 @@ class Sportstesting extends Base{ '145'=>'10', ], 'unit'=>'cm', + 'value'=>'0', 'proportion'=>'0.1', ], + '一分钟仰卧起坐'=>[ + 'list'=>[ + '51'=>'100', + '49'=>'95', + '47'=>'90', + '44'=>'85', + '41'=>'80', + '39'=>'78', + '37'=>'76', + '35'=>'74', + '33'=>'72', + '31'=>'70', + '29'=>'68', + '27'=>'66', + '25'=>'64', + '23'=>'62', + '21'=>'60', + '19'=>'50', + '17'=>'40', + '15'=>'30', + '13'=>'20', + '11'=>'10', + ], + 'unit'=>'cm', + 'value'=>'0', + 'proportion'=>'0.1', + 'add_point'=>[ + '13'=>'10', + '12'=>'9', + '11'=>'8', + '10'=>'7', + '9'=>'6', + '8'=>'5', + '7'=>'4', + '6'=>'3', + '4'=>'2', + '2'=>'1', + ] + ], + '女生800米'=>[ + 'list'=>[ + '3:30'=>'100', + '3:37'=>'95', + '3:44'=>'90', + '3:52'=>'85', + '4:00'=>'80', + '4:05'=>'78', + '4:10'=>'76', + '4:15'=>'74', + '4:20'=>'72', + '4:25'=>'70', + '4:30'=>'68', + '4:35'=>'66', + '4:40'=>'64', + '4:45'=>'62', + '4:50'=>'60', + '5:00'=>'50', + '5:10'=>'40', + '5:20'=>'30', + '5:30'=>'20', + '5:40'=>'10', + ], + 'unit'=>'cm', + 'value'=>'00:00', + 'proportion'=>'0.2', + 'add_point'=>[ + '-50'=>'10', + '-45'=>'9', + '-40'=>'8', + '-35'=>'7', + '-30'=>'6', + '-25'=>'5', + '-20'=>'4', + '-15'=>'3', + '-10'=>'2', + '-5'=>'1', + ] + ], ], ] ] @@ -312,12 +445,42 @@ class Sportstesting extends Base{ ################################################################接口################################################################ ################################################################接口################################################################ ################################################################接口################################################################ + // 获取单个类型列表 + public function sportstesting_get_type_list($data = ['aud_id'=>'25','parameter_data'=>'北京-xc-2','gender'=>'1','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + if(count(input('post.')) > 0){ + $data = input('post.'); + } + if(!array_key_exists('aud_id', $data) || !array_key_exists('parameter_data', $data) || !array_key_exists('token', $data)){ + return $this->msg(10001); + } + // cache($data['token'], time()); + if($this->token_time_validate($data['token']) === false){ + return $this->msg(20001); + } + unset($data['token']); + return $this->sportstesting_get_type_list_action($data); + } + // 获取地区类型列表 + public function sportstesting_get_region_list($data = ['aud_id'=>'25','parameter_data'=>'北京','gender'=>'1','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + if(count(input('post.')) > 0){ + $data = input('post.'); + } + if(!array_key_exists('aud_id', $data) || !array_key_exists('parameter_data', $data) || !array_key_exists('token', $data)){ + return $this->msg(10001); + } + // cache($data['token'], time()); + if($this->token_time_validate($data['token']) === false){ + return $this->msg(20001); + } + unset($data['token']); + return $this->sportstesting_get_region_list_action($data); + } // 获取体测最后一次数据 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)){ + if(!array_key_exists('aud_id', $data) || !array_key_exists('token', $data)){ return $this->msg(10001); } if($this->token_time_validate($data['token']) === false){ @@ -327,25 +490,296 @@ class Sportstesting extends Base{ return $this->sportstesting_get_last_data_action($data); } - // 获取体测最后一次数据 - public function sportstesting_set_once_data($data = ['aud_id'=>'25','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){ + // 计算并存储数据 + public function sportstesting_set_once_data($data = ['aud_id'=>'25','parameter_data'=>'北京市,province','result_data'=>'','gender'=>'1','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)){ + if(!array_key_exists('aud_id', $data) || !array_key_exists('parameter_data', $data) || !array_key_exists('result_data', $data) || !array_key_exists('gender', $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); + return $this->sportstesting_set_once_data_action($data); } ################################################################业务################################################################ - - public function sportstesting_get_last_data_action($data){ - - + ################################################sportstesting_get_type_list + public function sportstesting_get_type_list_action($data){ + $parameter_data = explode('-',$data['parameter_data']); + if(count($parameter_data) < 3){ + return $this->msg(10005); + } + if(!array_key_exists($parameter_data[0], $this->city_data_rule2)){ + return $this->msg(10005); + } + if(!array_key_exists($parameter_data[1], $this->city_data_rule2[$parameter_data[0]])){ + return $this->msg(10005); + } + if(!array_key_exists($parameter_data[1].'_'.$parameter_data[2], $this->city_data_rule2[$parameter_data[0]][$parameter_data[1]])){ + return $this->msg(10005); + } + $data['gender'] = $data['gender'] == 2?$data['gender']:1; + $result['list'] = []; + foreach ($this->city_data_rule2[$parameter_data[0]][$parameter_data[1]][$parameter_data[1].'_'.$parameter_data[2]][$data['gender']] as $key => $value) { + // dump($key); + array_push($result['list'],['name'=>$key,'unit'=>$value['unit'],'value'=>'0']); + } + return $this->msg($result); } + ################################################sportstesting_get_region_list + public function sportstesting_get_region_list_action($data){ + if(!array_key_exists($data['parameter_data'], $this->city_data_rule2)){ + return $this->msg(10005); + } + $result = []; + foreach ($this->city_data_rule2[$data['parameter_data']] as $key => $value) { + // 现场/过程 + $result[$key] = []; + foreach ($value as $k1 => $v1) { + // 现场1234/过程1234 + // $result[$key][$k1] = []; + $result[$key][$k1]['list'] = []; + foreach ($v1[$data['gender']] as $k2 => $v2) { + // dump($k2); + array_push($result[$key][$k1]['list'],['name'=>$k2,'unit'=>$v2['unit'],'value'=>$v2['value']]); + } + } + } + // dump($result); + return $this->msg($result); + } + ################################################sportstesting_set_once_data + public function sportstesting_set_once_data_action($data){ + $region = explode(',',$data['parameter_data']); + $region_rule = Db::table('app_region_scores_rule')->where($region[1]."='".$region[0]."'")->find(); + $rule = json_decode($region_rule['content'],true); + $result = []; + + if($region[0] == '北京市'){ + $data_data = [ + 'xc'=>[ + 'xc_1'=>['name'=>'1000米','value'=>'4:40'], + 'xc_2'=>['name'=>'引体向上','value'=>'8'], + 'xc_3'=>['name'=>'足球运球/射门','value'=>'21.6'], + 'xc_4'=>['name'=>'100米游泳','value'=>'3:16'], + ], + 'gc'=>[ + 'gc_8'=>[ + ['name'=>'BMI','value'=>'22.5'], + ['name'=>'肺活量','value'=>'3000'], + ['name'=>'50米跑','value'=>'8.2'], + ['name'=>'坐位体前屈','value'=>'10.4'], + ['name'=>'立定跳远','value'=>'200'], + ['name'=>'引体向上','value'=>'10'], + ['name'=>'男生1000米','value'=>'4:05'], + ] + ] + ]; + $data['result_data'] = $data_data; + foreach ($data['result_data']['xc'] as $k1 => $v1) { + $temporary_rule = $rule['xc'][$k1][$data['gender']][$v1['name']]; + $data['result_data']['xc'][$k1]['rule'] = $temporary_rule; + $result['xc'][$k1][0]['name'] = $v1['name']; + $result['xc'][$k1][0]['proportion'] = $temporary_rule['proportion']; + } + foreach ($data['result_data']['gc']['gc_8'] as $k1 => $v1) { + $temporary_rule = $rule['gc']['gc_8'][$data['gender']][$v1['name']]; + $data['result_data']['gc']['gc_8'][$k1]['rule'] = $temporary_rule; + $result['gc']['gc_8'][$k1]['name'] = $v1['name']; + } + + // dump($result); + // xc_1 + foreach ($data['result_data']['xc']['xc_1']['rule']['list'] as $key => $value) { + if($this->calculate_minutes_seconds($key,$data['result_data']['xc']['xc_1']['value'])[0]){ + $result['xc']['xc_1'][0]['value'] = $value; + $result['xc']['xc_1'][0]['proportion_value'] = $value; + break; + } + } + // dump($result); + // die; + // xc_2 + foreach ($data['result_data']['xc']['xc_2']['rule']['list'] as $key => $value) { + if(in_array($data['result_data']['xc']['xc_2']['name'],['引体向上','双杠臂屈伸','斜身引体','仰卧起坐'])){ + if($data['result_data']['xc']['xc_2']['value'] >= $key){ + $result['xc']['xc_2'][0]['value'] = $value; + $result['xc']['xc_2'][0]['proportion_value'] = $value; + break; + } + } + } + // xc_3 + foreach ($data['result_data']['xc']['xc_3']['rule']['list'] as $key => $value) { + if(in_array($data['result_data']['xc']['xc_3']['name'],['足球运球/射门'])){ + if($data['result_data']['xc']['xc_3']['value'] <= $key){ + $result['xc']['xc_3'][0]['value'] = $value; + $result['xc']['xc_3'][0]['proportion_value'] = $value; + break; + } + } + } + // xc_4 + foreach ($data['result_data']['xc']['xc_4']['rule']['list'] as $key => $value) { + if(in_array($data['result_data']['xc']['xc_4']['name'],['100米游泳'])){ + if($this->calculate_minutes_seconds($key,$data['result_data']['xc']['xc_4']['value'])[0]){ + $result['xc']['xc_4'][0]['value'] = $value; + $result['xc']['xc_4'][0]['proportion_value'] = $value; + break; + } + } + } + + // gc_8 + foreach ($data['result_data']['gc']['gc_8'] as $key => $value) { + $result['gc']['gc_8'][$key]['name'] = $value['name']; + $result['gc']['gc_8'][$key]['proportion'] = $value['rule']['proportion']; + foreach ($value['rule']['list'] as $k1 => $v1) { + if($value['name'] == 'BMI'){ + if($value['value'] <= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + break; + } + }else if($value['name'] == '肺活量'){ + if($value['value'] >= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + break; + } + }else if($value['name'] == '50米跑'){ + if($value['value'] <= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + break; + } + }else if($value['name'] == '坐位体前屈'){ + if($value['value'] >= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + break; + } + }else if($value['name'] == '立定跳远'){ + if($value['value'] >= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + break; + } + }else if($value['name'] == '引体向上'){ + if($value['value'] >= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + $add_point = $value['value'] - 14; + if(($add_point>=1) && ($add_point<=10)){ + $result['gc']['gc_8'][$key]['value'] = $add_point + $result['gc']['gc_8'][$key]['value']; + } + break; + } + }else if($value['name'] == '一分钟仰卧起坐'){ + if($value['value'] >= $k1){ + $result['gc']['gc_8'][$key]['value'] = $v1; + $add_point = $value['value'] - 51; + if(($add_point>=2) && ($add_point<=13)){ + foreach ($value['rule']['add_point'] as $kk1 => $vv1) { + if($add_point >= $kk1){ + $result['gc']['gc_8'][$key]['value'] = $vv1 + $result['gc']['gc_8'][$key]['value']; + break; + } + } + }else{ + break; + } + + } + }else if($value['name'] == '男生1000米' || $value['name'] == '女生800米'){ + $temporary_js = $this->calculate_minutes_seconds($k1,$value['value']); + if($temporary_js[0]){ + $result['gc']['gc_8'][$key]['value'] = $v1; + if($result['gc']['gc_8'][$key]['value'] == 100 && $temporary_js[1] < -4){ + foreach ($value['rule']['add_point'] as $kk1 => $vv1) { + if($temporary_js[1] <= $kk1){ + $result['gc']['gc_8'][$key]['value'] = $vv1 + $result['gc']['gc_8'][$key]['value']; + break; + } + } + }else{ + break; + } + } + } + } + } + + // 乘 bcmul(,,20) + // 除 bcdiv(,,20) + foreach ($result['gc']['gc_8'] as $key => $value) { + $result['gc']['gc_8'][$key]['proportion_value'] = bcmul(bcdiv($result['gc']['gc_8'][$key]['value'],10,20),$result['gc']['gc_8'][$key]['proportion'],1); + } + $num = 0; + foreach ($result as $key => $value) { + foreach ($value as $k1 => $v1) { + foreach ($v1 as $k2 => $v2) { + $num = bcadd($num,$v2['proportion_value'],1); + } + } + } + $result['total_score'] = $num; + } + $user_card_list = Db::table('app_region_scores_data')->insert([ + 'region'=>$data['parameter_data'], + 'aud_id'=>$data['aud_id'], + 'content'=>json_encode($result), + 'score'=>$result['total_score'], + 'create_time'=>date('Y-m-d H:i:s'), + ]); + if($user_card_list){ + return $this->msg($result); + }else{ + return $this->msg(10002); + } + + } + + + ################################################################其他################################################################ + + public function calculate_minutes_seconds($a,$b){ + // 分解时间字符串 + list($minutesA, $secondsA) = explode(':', $a); + list($minutesB, $secondsB) = explode(':', $b); + + // 转换为秒 + $totalSecondsA = intval($minutesA) * 60 + intval($secondsA); + $totalSecondsB = intval($minutesB) * 60 + intval($secondsB); + + $result = $totalSecondsB - $totalSecondsA; + if($result <= 0){ + return [true,$result]; + }else{ + return [false,$result]; + } + // 比较两个时间(秒) + // return $totalSecondsB <= $totalSecondsA; + } + + + + + public function set_rule_action(){ + + $user_card_list = Db::table('app_region_scores_rule')->insert([ + 'province'=>'北京市', + 'city'=>'', + 'area'=>'', + 'content'=>json_encode($this->city_data_rule2['北京']), + 'create_time'=>date('Y-m-d H:i:s'), + 'update_time'=>date('Y-m-d H:i:s'), + ]); + // $user_card_list = Db::table('app_region_scores_rule')->insert([ + // 'province'=>'北京市', + // 'city'=>'', + // 'area'=>'', + // 'content'=>json_encode($this->city_data_rule2), + // 'create_time'=>date('Y-m-d H:i:s'), + // 'update_time'=>date('Y-m-d H:i:s'), + // ]); + } + } \ No newline at end of file diff --git a/application/route.php b/application/route.php index fa14ddc..82a0604 100644 --- a/application/route.php +++ b/application/route.php @@ -77,8 +77,6 @@ Route::any('/get_card_all_list', 'app/index/get_card_all_list'); Route::any('/save_user_card_order', 'app/index/save_user_card_order'); // 获取年级列表 Route::any('/get_grade_list', 'app/index/get_grade_list'); - - // ################################身体数据卡片接口################################ // 报告页详情 Route::any('/card_data_detailed', 'app/card/card_data_detailed'); @@ -106,7 +104,18 @@ Route::any('/vitalcapacity_save_record_data', 'app/vitalcapacity/vitalcapacity_s Route::any('/vitalcapacity_data_report', 'app/vitalcapacity/vitalcapacity_data_report'); // 曲线 Route::any('/vitalcapacity_curve_chart', 'app/vitalcapacity/vitalcapacity_curve_chart'); +// ################################估分接口################################ +// 获取类型列表 +Route::any('/sportstesting_get_type_list', 'app/sportstesting/sportstesting_get_type_list'); +// 获取类型列表 +Route::any('/sportstesting_get_region_list', 'app/sportstesting/sportstesting_get_region_list'); +// 计算并存储数据 +Route::any('/sportstesting_set_once_data', 'app/sportstesting/sportstesting_set_once_data'); +// // 报告数据(上次数据) +// Route::any('/vitalcapacity_data_report', 'app/sportstesting/vitalcapacity_data_report'); +// // 曲线 +// Route::any('/vitalcapacity_curve_chart', 'app/sportstesting/vitalcapacity_curve_chart'); // Route::any('/skip_device_check', 'app/skip/skip_device_check'); // Route::any('/skip_device_check', 'app/skip/skip_device_check'); // Route::any('/skip_device_check', 'app/skip/skip_device_check');