|
|
|
|
@ -88,6 +88,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;
|
|
|
|
|
$sex = !!$person_info['sex'] ? $person_info['sex'] : 1;
|
|
|
|
|
$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);
|
|
|
|
|
@ -109,6 +110,7 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
}
|
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
|
'date' => date('Y-m-d', strtotime($log_info->created_at)),
|
|
|
|
|
'sex' => $sex,
|
|
|
|
|
'age' => $age,
|
|
|
|
|
'weight' => $wh,
|
|
|
|
|
'items' => $items,
|
|
|
|
|
@ -119,6 +121,11 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
'tuijian' => self::sum_items($items, $check_items_array['tuijian']),
|
|
|
|
|
'gaoduan' => self::sum_items($items, $check_items_array['gaoduan']),
|
|
|
|
|
],
|
|
|
|
|
'original_price' => [
|
|
|
|
|
'jichu' => self::sum_items($items, $check_items_array['jichu'], false),
|
|
|
|
|
'tuijian' => self::sum_items($items, $check_items_array['tuijian'], false),
|
|
|
|
|
'gaoduan' => self::sum_items($items, $check_items_array['gaoduan'], false),
|
|
|
|
|
],
|
|
|
|
|
'count' => [
|
|
|
|
|
'jichu' => self::item_count($items, $check_items_array['jichu']),
|
|
|
|
|
'tuijian' => self::item_count($items, $check_items_array['tuijian']),
|
|
|
|
|
@ -154,7 +161,7 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
return $ic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function sum_items($items, $check_items)
|
|
|
|
|
public function sum_items($items, $check_items, $zk = true)
|
|
|
|
|
{
|
|
|
|
|
if (count($items)) {
|
|
|
|
|
$sum = DB::table('items')->whereIn('item_id', $items)->where('status', 1)->sum('price');
|
|
|
|
|
@ -173,7 +180,11 @@ class QuestionnairesLogsController extends Controller
|
|
|
|
|
$combo = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!!$zk) {
|
|
|
|
|
$zhekou = config('app.globals.Wj_ZheKou');
|
|
|
|
|
} else {
|
|
|
|
|
$zhekou = 1;
|
|
|
|
|
}
|
|
|
|
|
return number_format((($combo + $sum + $check_sum) * $zhekou), 2, '.', '');
|
|
|
|
|
}
|
|
|
|
|
public function submit(Request $request)
|
|
|
|
|
|