|
|
|
|
@ -89,6 +89,7 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
$person_info = json_decode($log_info->person_info, true);
|
|
|
|
|
$age = !!$person_info['birthday'] ? date('Y') - date('Y', strtotime($person_info['birthday'])) : 0;
|
|
|
|
|
$weight = !!$log_info->weight ? $log_info->weight : 0;
|
|
|
|
|
$height = !!$log_info->height ? $log_info->height : 0;
|
|
|
|
|
$items_ids = json_decode($log_info->check_items, true);
|
|
|
|
|
$check_items = [];
|
|
|
|
|
if (!!count($items_ids)) {
|
|
|
|
|
@ -102,10 +103,14 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
$items = json_decode($log_info->items, true);
|
|
|
|
|
$check_items_array = json_decode($log_info->check_items_array, true);
|
|
|
|
|
$wh = '-';
|
|
|
|
|
if (!!$weight && $height) {
|
|
|
|
|
$wh = round($weight / pow($height / 100, 2), 2);
|
|
|
|
|
}
|
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
|
'date' => date('Y-m-d', strtotime($log_info->created_at)),
|
|
|
|
|
'age' => $age,
|
|
|
|
|
'weight' => $weight == '0' ? '-' : $weight,
|
|
|
|
|
'weight' => $wh,
|
|
|
|
|
'items' => $items,
|
|
|
|
|
'check_items' => $check_items,
|
|
|
|
|
'check_items_array' => $check_items_array,
|
|
|
|
|
@ -217,6 +222,7 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
$question_questions = [];
|
|
|
|
|
}
|
|
|
|
|
$weight = 0;
|
|
|
|
|
$height = 0;
|
|
|
|
|
$score = 0;
|
|
|
|
|
foreach ($question_questions as $value) {
|
|
|
|
|
$id = $value->id;
|
|
|
|
|
@ -227,6 +233,12 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
$weight = $question_map["q{$id}"]['value'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($option['input']['value'] === '${身高}') {
|
|
|
|
|
if (isset($question_map["q{$id}"])) {
|
|
|
|
|
$height = $question_map["q{$id}"]['value'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (isset($question_map["q{$id}"])) {
|
|
|
|
|
$v = $question_map["q{$id}"]['active'];
|
|
|
|
|
@ -339,6 +351,9 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
preg_match_all('/\d+/', $weight, $matches);
|
|
|
|
|
$weight = $matches[0][0];
|
|
|
|
|
$weight = $weight ? $weight : 0;
|
|
|
|
|
preg_match_all('/\d+/', $height, $matches);
|
|
|
|
|
$height = $matches[0][0];
|
|
|
|
|
$height = $height ? $height : 0;
|
|
|
|
|
$ip = self::getTrustedProxiesIp();
|
|
|
|
|
$ip2region = new \Ip2Region();
|
|
|
|
|
$record = $ip2region->simple($ip);
|
|
|
|
|
@ -350,6 +365,7 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
'question_id' => $question_id,
|
|
|
|
|
'type' => $type,
|
|
|
|
|
'weight' => $weight,
|
|
|
|
|
'height' => $height,
|
|
|
|
|
'use_time' => $use_time,
|
|
|
|
|
'ip' => $ip,
|
|
|
|
|
'ip_info' => $ip_info,
|
|
|
|
|
|