修改估分
This commit is contained in:
parent
1ead695b7c
commit
568cafb817
|
|
@ -115,56 +115,22 @@ class Estimate extends Base{
|
||||||
// 'list'=>count($v2['content'])==0?[['成绩','无'],['数据','无']]:[['成绩'],['数据']],
|
// 'list'=>count($v2['content'])==0?[['成绩','无'],['数据','无']]:[['成绩'],['数据']],
|
||||||
'list'=>[['成绩'],['数据']],
|
'list'=>[['成绩'],['数据']],
|
||||||
]);
|
]);
|
||||||
foreach ($xmv1['content'] as $gzk1 => $gzv1) {
|
if(count($xmv1['content'])>0){
|
||||||
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][0],$gzv1[2]);
|
foreach ($xmv1['content'] as $gzk1 => $gzv1) {
|
||||||
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][1],$gzv1[1].$gzv1[0]);
|
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][0],$gzv1[2]);
|
||||||
|
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][1],$gzv1[1].$gzv1[0]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][0],'该项无规则,由前端填写输入');
|
||||||
|
array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][1],'该项无规则,由前端填写输入');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return $this->msg($temporary_array2);
|
|
||||||
// foreach ($temporary_array as $key => $value) {
|
|
||||||
// $num = array_push($temporary_array2,[
|
|
||||||
// 'title'=>$key.'评定标准',
|
|
||||||
// 'list'=>[],
|
|
||||||
// ]);
|
|
||||||
// foreach ($value as $k1 => $v1) {
|
|
||||||
// $num2 = array_push($temporary_array2[$num-1]['list'],[
|
|
||||||
// 'title'=>$k1,
|
|
||||||
// 'score'=>'',
|
|
||||||
// 'choose_num'=>'',
|
|
||||||
// 'choose_all'=>count($v1),
|
|
||||||
// 'list'=>[],
|
|
||||||
// ]);
|
|
||||||
// foreach ($v1 as $k2 => $v2) {
|
|
||||||
// $temporary_array2[$num-1]['list'][$num2-1]['score'] = $v2['score'];
|
|
||||||
|
|
||||||
|
|
||||||
// $temporary_array2[$num-1]['list'][$num2-1]['choose_num'] = $v2['choose_num'];
|
|
||||||
// $num3 = array_push($temporary_array2[$num-1]['list'][$num2-1]['list'],[
|
|
||||||
// 'title'=>$k2,
|
|
||||||
// 'gender'=>'',
|
|
||||||
// 'unit_data'=>$v2['unit_data'],
|
|
||||||
// 'proportion'=>$v2['proportion'],
|
|
||||||
// 'list'=>count($v2['content'])==0?[['成绩','无'],['数据','无']]:[['成绩'],['数据']],
|
|
||||||
// ]);
|
|
||||||
// if($v2['gender'] == '1'){
|
|
||||||
// $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '男生';
|
|
||||||
// }else if($v2['gender'] == '2'){
|
|
||||||
// $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '女生';
|
|
||||||
// }else{
|
|
||||||
// $temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['gender'] = '男生&女生';
|
|
||||||
// }
|
|
||||||
// foreach ($v2['content'] as $k3 => $v3) {
|
|
||||||
// array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][0],$v3[2]);
|
|
||||||
// array_push($temporary_array2[$num-1]['list'][$num2-1]['list'][$num3-1]['list'][1],$v3[1].$v3[0]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
$data['list'] = $temporary_array2;
|
$data['list'] = $temporary_array2;
|
||||||
// return $this->msg($data);
|
// return $this->msg($data);
|
||||||
$this->assign([
|
$this->assign([
|
||||||
|
|
@ -199,6 +165,8 @@ class Estimate extends Base{
|
||||||
$original_data = $this->excelToArray(ROOT_PATH . 'public' . DS . 'estimate' . DS . $info->getSaveName());
|
$original_data = $this->excelToArray(ROOT_PATH . 'public' . DS . 'estimate' . DS . $info->getSaveName());
|
||||||
$handle_data = $this->transformation_data($original_data,$address_data,$name['type']);
|
$handle_data = $this->transformation_data($original_data,$address_data,$name['type']);
|
||||||
// die;
|
// die;
|
||||||
|
// dump($handle_data);
|
||||||
|
// die;
|
||||||
if($name['type'] == 'create'){
|
if($name['type'] == 'create'){
|
||||||
$result = Db::table('admin_estimate')->insert($handle_data);
|
$result = Db::table('admin_estimate')->insert($handle_data);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -284,10 +252,17 @@ class Estimate extends Base{
|
||||||
|
|
||||||
|
|
||||||
$gender = [];
|
$gender = [];
|
||||||
|
$rule_c = [];
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$gender = explode(',',$value[5]);
|
$gender = explode(',',$value[5]);
|
||||||
|
if($value[6] == '无' || $value[7] == '无' || $value[8] == '无'){
|
||||||
|
$rule_c = [];
|
||||||
|
}else{
|
||||||
|
$rule_c = [[$value[6],$value[7],$value[8]]];
|
||||||
|
}
|
||||||
foreach ($gender as $gk => $gv) {
|
foreach ($gender as $gk => $gv) {
|
||||||
if(!array_key_exists($gv,$temporary_array)){
|
if(!array_key_exists($gv,$temporary_array)){
|
||||||
|
// 如果性别不存在
|
||||||
// $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
|
// $temporary_array[$gv][$value[0]][$value[1]]['score'] = $value[2];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
|
$temporary_array[$gv][$value[0]][$value[1]]['choose_num'] = $value[9];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]] = [
|
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]] = [
|
||||||
|
|
@ -297,7 +272,7 @@ class Estimate extends Base{
|
||||||
'type'=>$value[12],
|
'type'=>$value[12],
|
||||||
'score'=>$value[2],
|
'score'=>$value[2],
|
||||||
];
|
];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
|
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = $rule_c;
|
||||||
// if($value[6] == null){
|
// if($value[6] == null){
|
||||||
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
||||||
// }else{
|
// }else{
|
||||||
|
|
@ -316,7 +291,7 @@ class Estimate extends Base{
|
||||||
'type'=>$value[12],
|
'type'=>$value[12],
|
||||||
'score'=>$value[2],
|
'score'=>$value[2],
|
||||||
];
|
];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
|
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = $rule_c;
|
||||||
// if($value[6] == null){
|
// if($value[6] == null){
|
||||||
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
||||||
// }else{
|
// }else{
|
||||||
|
|
@ -336,7 +311,7 @@ class Estimate extends Base{
|
||||||
'type'=>$value[12],
|
'type'=>$value[12],
|
||||||
'score'=>$value[2],
|
'score'=>$value[2],
|
||||||
];
|
];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
|
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = $rule_c;
|
||||||
// if($value[6] == null){
|
// if($value[6] == null){
|
||||||
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
||||||
// }else{
|
// }else{
|
||||||
|
|
@ -356,7 +331,7 @@ class Estimate extends Base{
|
||||||
'type'=>$value[12],
|
'type'=>$value[12],
|
||||||
'score'=>$value[2],
|
'score'=>$value[2],
|
||||||
];
|
];
|
||||||
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [[$value[6],$value[7],$value[8]]];
|
$temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = $rule_c;
|
||||||
// if($value[6] == null){
|
// if($value[6] == null){
|
||||||
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
// $temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'] = [];
|
||||||
// }else{
|
// }else{
|
||||||
|
|
@ -364,6 +339,8 @@ class Estimate extends Base{
|
||||||
// }
|
// }
|
||||||
}else{
|
}else{
|
||||||
array_push($temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'],[$value[6],$value[7],$value[8]]);
|
array_push($temporary_array[$gv][$value[0]][$value[1]]['list'][$value[3]]['content'],[$value[6],$value[7],$value[8]]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
}
|
}
|
||||||
//发异步,把数据提交给php
|
//发异步,把数据提交给php
|
||||||
console.log(456);
|
console.log(456);
|
||||||
// add_data()
|
add_data()
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="/x_admin/js/xcity.js"></script>
|
<script type="text/javascript" src="/x_admin/js/xcity2.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var update_id="{$id}"
|
var update_id="{$id}"
|
||||||
var form
|
var form
|
||||||
|
|
@ -324,14 +324,9 @@
|
||||||
formdata.append('type','update')
|
formdata.append('type','update')
|
||||||
formdata.append('update_id',update_id)
|
formdata.append('update_id',update_id)
|
||||||
|
|
||||||
// formdata.append('bluetooth_type',$('#bluetooth_type').val())
|
load()
|
||||||
// formdata.append('page_measure',$('#page_measure').val())
|
pd = false
|
||||||
// formdata.append('content',$('#content').val())
|
|
||||||
// formdata.append('file_extension',file_extension)
|
|
||||||
|
|
||||||
// load()
|
|
||||||
// pd = false
|
|
||||||
// console.log('进来了')
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"/estimate/submit_rule", //请求的url地址
|
url:"/estimate/submit_rule", //请求的url地址
|
||||||
contentType:false,
|
contentType:false,
|
||||||
|
|
@ -340,24 +335,24 @@
|
||||||
data:formdata, //参数值
|
data:formdata, //参数值
|
||||||
type:"POST", //请求方式
|
type:"POST", //请求方式
|
||||||
success:function(req){
|
success:function(req){
|
||||||
// c_load()
|
c_load()
|
||||||
// pd = true
|
pd = true
|
||||||
// console.log()
|
console.log()
|
||||||
// if(req.code == 0){
|
if(req.code == 0){
|
||||||
// layer.alert("增加成功", {icon: 6},function() {
|
layer.alert("更新成功", {icon: 6},function() {
|
||||||
// //关闭当前frame
|
//关闭当前frame
|
||||||
// xadmin.close();
|
xadmin.close();
|
||||||
// // 可以对父窗口进行刷新
|
// 可以对父窗口进行刷新
|
||||||
// xadmin.father_reload();
|
xadmin.father_reload();
|
||||||
// });
|
});
|
||||||
// }else{
|
}else{
|
||||||
// layer.alert("增加失败"+req.msg, {icon: 6},function() {
|
layer.alert("更新失败"+req.msg, {icon: 6},function() {
|
||||||
// //关闭当前frame
|
//关闭当前frame
|
||||||
// xadmin.close();
|
xadmin.close();
|
||||||
// // 可以对父窗口进行刷新
|
// 可以对父窗口进行刷新
|
||||||
// xadmin.father_reload();
|
xadmin.father_reload();
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//请求成功时处理
|
//请求成功时处理
|
||||||
|
|
||||||
console.log(req)
|
console.log(req)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use think\Log;
|
||||||
use \think\Validate;
|
use \think\Validate;
|
||||||
use app\app\controller\Calculatebody;
|
use app\app\controller\Calculatebody;
|
||||||
use app\app\controller\Skip;
|
use app\app\controller\Skip;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class Sportstesting extends Base{
|
class Sportstesting extends Base{
|
||||||
|
|
||||||
|
|
@ -643,7 +644,7 @@ class Sportstesting extends Base{
|
||||||
return $this->sportstesting_get_last_data_action($data);
|
return $this->sportstesting_get_last_data_action($data);
|
||||||
}
|
}
|
||||||
// 计算并存储数据
|
// 计算并存储数据
|
||||||
public function sportstesting_set_once_data($data = ['aud_id'=>'25','parameter_data'=>'上海','result_data'=>'','gender'=>'1','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
public function sportstesting_set_once_data($data = ['aud_id'=>'83','parameter_data'=>'北京,北京','result_data'=>'','gender'=>'1','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||||||
if(count(input('post.')) > 0){
|
if(count(input('post.')) > 0){
|
||||||
$data = input('post.');
|
$data = input('post.');
|
||||||
}
|
}
|
||||||
|
|
@ -752,13 +753,17 @@ class Sportstesting extends Base{
|
||||||
// die;
|
// die;
|
||||||
$result['list'] = [];
|
$result['list'] = [];
|
||||||
$result['total_score'] = 0;
|
$result['total_score'] = 0;
|
||||||
$data = Db::table('admin_estimate')->where($db_condition)->find();
|
$data = Db::table('admin_estimate')->where($db_condition)->select();
|
||||||
// dump($data);
|
// dump($data);
|
||||||
// die;
|
// die;
|
||||||
if($data){
|
if(count($data) > 0){
|
||||||
|
if(count($data) > 1){
|
||||||
|
// 查到不止一条规则
|
||||||
|
return $this->msg(10004,'查询地址不够详细,请重新选择省市地区');
|
||||||
|
}
|
||||||
// dump(568);
|
// dump(568);
|
||||||
// die;
|
// die;
|
||||||
$data = json_decode($data['content'],true);
|
$data = json_decode($data[0]['content'],true);
|
||||||
$result = $this->handle_default_rule_list($data,$gender);
|
$result = $this->handle_default_rule_list($data,$gender);
|
||||||
return $this->msg($result);
|
return $this->msg($result);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -861,6 +866,7 @@ class Sportstesting extends Base{
|
||||||
}
|
}
|
||||||
public function sportstesting_set_once_data_action2($data){
|
public function sportstesting_set_once_data_action2($data){
|
||||||
$return_result['total_score'] = 0;
|
$return_result['total_score'] = 0;
|
||||||
|
$return_result['max_score'] = 0;
|
||||||
|
|
||||||
$parameter_data = explode(',',$data['parameter_data']);
|
$parameter_data = explode(',',$data['parameter_data']);
|
||||||
$gender = $data['gender'];
|
$gender = $data['gender'];
|
||||||
|
|
@ -878,10 +884,10 @@ class Sportstesting extends Base{
|
||||||
$recognition_rule = $find_data[$gender];
|
$recognition_rule = $find_data[$gender];
|
||||||
// dump($recognition_rule);
|
// dump($recognition_rule);
|
||||||
// 测试用删掉s
|
// 测试用删掉s
|
||||||
// $data['result_data'] = $this->handle_default_rule_list2($find_data,$gender);
|
$data['result_data'] = $this->handle_default_rule_list2($find_data,$gender);
|
||||||
// 测试用删掉e
|
// 测试用删掉e
|
||||||
// dump($data);
|
// dump($data);
|
||||||
// die;
|
// return $this->msg($data);
|
||||||
foreach ($data['result_data'] as $key => $value) {
|
foreach ($data['result_data'] as $key => $value) {
|
||||||
// 遍历一级($value['key'] = 现场考试)
|
// 遍历一级($value['key'] = 现场考试)
|
||||||
// dump($value);
|
// dump($value);
|
||||||
|
|
@ -893,9 +899,11 @@ class Sportstesting extends Base{
|
||||||
$temporary_result = $this->obtaining_grades($recognition_rule[$value['key']][$v2['key']]['list'][$v3['name']]['content'],$v3);
|
$temporary_result = $this->obtaining_grades($recognition_rule[$value['key']][$v2['key']]['list'][$v3['name']]['content'],$v3);
|
||||||
$data['result_data'][$key]['list'][$k2]['list'][$k3] = $temporary_result;
|
$data['result_data'][$key]['list'][$k2]['list'][$k3] = $temporary_result;
|
||||||
$return_result['total_score'] = bcadd($return_result['total_score'],$temporary_result['proportion_value'],2);
|
$return_result['total_score'] = bcadd($return_result['total_score'],$temporary_result['proportion_value'],2);
|
||||||
|
$return_result['max_score'] = bcadd($return_result['max_score'],bcmul($v3['total_score'],$v3['proportion'],2),2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$return_result['list'] = $data['result_data'];
|
$return_result['list'] = $data['result_data'];
|
||||||
$user_sportstesting_set = Db::table('app_sportstesting_data')->insert([
|
$user_sportstesting_set = Db::table('app_sportstesting_data')->insert([
|
||||||
'aud_id'=>$data['aud_id'],
|
'aud_id'=>$data['aud_id'],
|
||||||
|
|
@ -904,6 +912,7 @@ class Sportstesting extends Base{
|
||||||
'create_time'=>date('Y-m-d H:i:s'),
|
'create_time'=>date('Y-m-d H:i:s'),
|
||||||
'address'=>$data['parameter_data'],
|
'address'=>$data['parameter_data'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if($user_sportstesting_set){
|
if($user_sportstesting_set){
|
||||||
foreach ($return_result['list'] as $key => $value) {
|
foreach ($return_result['list'] as $key => $value) {
|
||||||
foreach ($value['list'] as $v1k => $v1v) {
|
foreach ($value['list'] as $v1k => $v1v) {
|
||||||
|
|
@ -1087,52 +1096,70 @@ class Sportstesting extends Base{
|
||||||
|
|
||||||
// 取得成绩
|
// 取得成绩
|
||||||
public function obtaining_grades($rule,$data){
|
public function obtaining_grades($rule,$data){
|
||||||
|
|
||||||
// 加 bcadd(,,20)
|
// 加 bcadd(,,20)
|
||||||
// 减 bcsub(,,20)
|
// 减 bcsub(,,20)
|
||||||
// 乘 bcmul(,,20)
|
// 乘 bcmul(,,20)
|
||||||
// 除 bcdiv(,,20)
|
// 除 bcdiv(,,20)
|
||||||
// dump($data['total_score']);
|
// dump($data);
|
||||||
|
// dump($rule);
|
||||||
// die;
|
// die;
|
||||||
foreach ($rule as $key => $value) {
|
if($data['value'] != ''){
|
||||||
if($data['unit'] == '分/秒'){
|
if(count($rule) > 0){
|
||||||
$rule_result = $this->convertMinutesSecondsToStringSeconds($value[0]);
|
foreach ($rule as $key => $value) {
|
||||||
$data_result = $this->convertMinutesSecondsToStringSeconds($data['value']);
|
if($data['unit'] == '分/秒'){
|
||||||
|
$rule_result = $this->convertMinutesSecondsToStringSeconds($value[0]);
|
||||||
|
$data_result = $this->convertMinutesSecondsToStringSeconds($data['value']);
|
||||||
|
}else{
|
||||||
|
$rule_result = $value[0];
|
||||||
|
$data_result = $data['value'];
|
||||||
|
}
|
||||||
|
switch ($value[1]) {
|
||||||
|
case "<=":
|
||||||
|
$result = $data_result <= $rule_result;
|
||||||
|
break;
|
||||||
|
case ">=":
|
||||||
|
$result = $data_result >= $rule_result;
|
||||||
|
break;
|
||||||
|
case "<":
|
||||||
|
$result = $data_result < $rule_result;
|
||||||
|
break;
|
||||||
|
case ">":
|
||||||
|
$result = $data_result > $rule_result;
|
||||||
|
break;
|
||||||
|
case "==":
|
||||||
|
$result = $data_result == $rule_result;
|
||||||
|
break;
|
||||||
|
case "!=":
|
||||||
|
$result = $data_result != $rule_result;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 如果比较符号不是上述任何一个,可以抛出一个异常或错误
|
||||||
|
throw new Exception("Unsupported comparison operator: " . $value[1]);
|
||||||
|
}
|
||||||
|
// dump($result);
|
||||||
|
if($result == true){
|
||||||
|
$data['score'] = $value[2];
|
||||||
|
// 计算比例后分值
|
||||||
|
$proportional_post_score = bcmul($data['total_score'],$data['proportion'],2);
|
||||||
|
$data['proportion_value'] = bcmul($data['score'],bcdiv($proportional_post_score,100,2),1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$rule_result = $value[0];
|
$data['score'] = $data['value'] <= $data['total_score']?bcmul(bcdiv($data['value'],$data['total_score'],20),100,2):100;
|
||||||
$data_result = $data['value'];
|
|
||||||
}
|
|
||||||
switch ($value[1]) {
|
|
||||||
case "<=":
|
|
||||||
$result = $data_result <= $rule_result;
|
|
||||||
break;
|
|
||||||
case ">=":
|
|
||||||
$result = $data_result >= $rule_result;
|
|
||||||
break;
|
|
||||||
case "<":
|
|
||||||
$result = $data_result < $rule_result;
|
|
||||||
break;
|
|
||||||
case ">":
|
|
||||||
$result = $data_result > $rule_result;
|
|
||||||
break;
|
|
||||||
case "==":
|
|
||||||
$result = $data_result == $rule_result;
|
|
||||||
break;
|
|
||||||
case "!=":
|
|
||||||
$result = $data_result != $rule_result;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// 如果比较符号不是上述任何一个,可以抛出一个异常或错误
|
|
||||||
throw new Exception("Unsupported comparison operator: " . $a[1]);
|
|
||||||
}
|
|
||||||
// dump($result);
|
|
||||||
if($result == true){
|
|
||||||
$data['score'] = $value[2];
|
|
||||||
// 计算比例后分值
|
// 计算比例后分值
|
||||||
$proportional_post_score = bcmul($data['total_score'],$data['proportion'],2);
|
// $proportional_post_score = bcmul($data['total_score'],$data['proportion'],2);
|
||||||
$data['proportion_value'] = bcmul($data['score'],bcdiv($proportional_post_score,100,2),1);
|
$data['proportion_value'] = $data['value'] <= $data['total_score']?$data['value']:$data['total_score'];
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$data['score'] = 0;
|
||||||
|
// 计算比例后分值
|
||||||
|
$proportional_post_score = bcmul($data['total_score'],$data['proportion'],2);
|
||||||
|
$data['proportion_value'] = bcmul($data['score'],bcdiv($proportional_post_score,100,2),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1140,8 +1167,11 @@ class Sportstesting extends Base{
|
||||||
public function handle_default_rule_list2($data,$gender){
|
public function handle_default_rule_list2($data,$gender){
|
||||||
$temporary_arr = $data[$gender];
|
$temporary_arr = $data[$gender];
|
||||||
$result = [];
|
$result = [];
|
||||||
|
// dump($temporary_arr);
|
||||||
|
// die;
|
||||||
foreach ($temporary_arr as $key => $value) {
|
foreach ($temporary_arr as $key => $value) {
|
||||||
$num = array_push($result,['name'=>$key,'key'=>$key,'list'=>[]]);
|
$num = array_push($result,['name'=>$key,'key'=>$key,'list'=>[]]);
|
||||||
|
|
||||||
foreach ($value as $s_c_k => $s_c_v) {
|
foreach ($value as $s_c_k => $s_c_v) {
|
||||||
if($s_c_v['choose_num'] == 0){
|
if($s_c_v['choose_num'] == 0){
|
||||||
$num2 = array_push($result[$num-1]['list'],[
|
$num2 = array_push($result[$num-1]['list'],[
|
||||||
|
|
@ -1151,15 +1181,32 @@ class Sportstesting extends Base{
|
||||||
'list'=>[]
|
'list'=>[]
|
||||||
]);
|
]);
|
||||||
foreach ($s_c_v['list'] as $x_m_k => $x_m_v) {
|
foreach ($s_c_v['list'] as $x_m_k => $x_m_v) {
|
||||||
array_push($result[$num-1]['list'][$num2-1]['list'],[
|
$num3 = array_push($result[$num-1]['list'][$num2-1]['list'],[
|
||||||
'name'=>$x_m_k,
|
'name'=>$x_m_k,
|
||||||
'proportion'=>$x_m_v['proportion'],
|
'proportion'=>$x_m_v['proportion'],
|
||||||
'value'=>2,
|
'value'=>'',
|
||||||
'proportion_value'=>null,
|
'proportion_value'=>null,
|
||||||
'unit'=>$x_m_v['unit_data'],
|
'unit'=>$x_m_v['unit_data'],
|
||||||
'type'=>$x_m_v['type'],
|
'type'=>$x_m_v['type'],
|
||||||
'total_score'=>$x_m_v['score'],
|
'total_score'=>$x_m_v['score'],
|
||||||
]);
|
]);
|
||||||
|
// dump($x_m_k);
|
||||||
|
if($x_m_k == '1000米跑'){
|
||||||
|
// dump('11');
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '4:08';
|
||||||
|
}else if($x_m_k == '50米跑'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '7.3';
|
||||||
|
}else if($x_m_k == '乒乓球'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '25';
|
||||||
|
}else if($x_m_k == '足球运球'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '9.5';
|
||||||
|
}else if($x_m_k == '机考'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '8.3';
|
||||||
|
}else if($x_m_k == '1000米'){
|
||||||
|
// dump('22');
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][$num3-1]['value'] = '4:08';
|
||||||
|
}
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$num2 = array_push($result[$num-1]['list'],['name'=>$s_c_k,'key'=>$s_c_k,'is_choice'=>$s_c_v['choose_num'],'list'=>[]]);
|
$num2 = array_push($result[$num-1]['list'],['name'=>$s_c_k,'key'=>$s_c_k,'is_choice'=>$s_c_v['choose_num'],'list'=>[]]);
|
||||||
|
|
@ -1167,12 +1214,13 @@ class Sportstesting extends Base{
|
||||||
array_push($result[$num-1]['list'][$num2-1]['list'],[
|
array_push($result[$num-1]['list'][$num2-1]['list'],[
|
||||||
'name'=>$x_m_k,
|
'name'=>$x_m_k,
|
||||||
'proportion'=>$x_m_v['proportion'],
|
'proportion'=>$x_m_v['proportion'],
|
||||||
'value'=>$x_m_v['value'],
|
'value'=>'',
|
||||||
'proportion_value'=>null,
|
'proportion_value'=>null,
|
||||||
'unit'=>$x_m_v['unit_data'],
|
'unit'=>$x_m_v['unit_data'],
|
||||||
'type'=>$x_m_v['type'],
|
'type'=>$x_m_v['type'],
|
||||||
'total_score'=>$x_m_v['score'],
|
'total_score'=>$x_m_v['score'],
|
||||||
]);
|
]);
|
||||||
|
// dump($x_m_k);
|
||||||
if($x_m_k == '1000米跑'){
|
if($x_m_k == '1000米跑'){
|
||||||
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '4:07';
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '4:07';
|
||||||
}else if($x_m_k == '50米跑'){
|
}else if($x_m_k == '50米跑'){
|
||||||
|
|
@ -1181,12 +1229,20 @@ class Sportstesting extends Base{
|
||||||
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '25';
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '25';
|
||||||
}else if($x_m_k == '足球运球'){
|
}else if($x_m_k == '足球运球'){
|
||||||
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '9.5';
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '9.5';
|
||||||
|
}else if($x_m_k == '引体向上'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '8';
|
||||||
|
}else if($x_m_k == '足球--运球射门'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '40';
|
||||||
|
}else if($x_m_k == '体操双杠组合Ⅰ'){
|
||||||
|
$result[$num-1]['list'][$num2-1]['list'][0]['value'] = '4';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// dump($result);
|
||||||
|
// die;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue