更新 调试

main
鹿和sa0ChunLuyu 1 year ago
parent cdd39676b0
commit 49633464cf

@ -32,7 +32,7 @@ class QuestionnairesLogsController extends Controller
} }
$log = DB::table('questionnaires_logs')->select(['*']) $log = DB::table('questionnaires_logs')->select(['*'])
->selectRaw("IFNULL((select `name` from questionnaires where questionnaires.id = questionnaires_logs.person_id),'') as title") ->selectRaw("IFNULL((select `name` from questionnaires where questionnaires.id = questionnaires_logs.person_id),'') as title")
->where('items', '[]') ->where('items', '!=', '[]')
->where('person_id', $person_id) ->where('person_id', $person_id)
->where('del', 2) ->where('del', 2)
->orderBy('id', 'desc')->get(); ->orderBy('id', 'desc')->get();
@ -40,15 +40,16 @@ class QuestionnairesLogsController extends Controller
foreach ($log as $value) { foreach ($log as $value) {
$person_info = json_decode($value->person_info, true); $person_info = json_decode($value->person_info, true);
$age = !!$person_info['birthday'] ? date('Y') - date('Y', strtotime($person_info['birthday'])) : 0; $age = !!$person_info['birthday'] ? date('Y') - date('Y', strtotime($person_info['birthday'])) : 0;
// $check_items = json_decode($value->check_items, true); $check_items = [];
// $count = count($check_items); $items = json_decode($value->items, true);
$count = count($items);
$list[] = [ $list[] = [
'id' => $value->id, 'id' => $value->id,
'title' => $value->title, 'title' => $value->title,
'name' => $person_info['name'], 'name' => $person_info['name'],
'age' => $age, 'age' => $age,
'created_at' => $value->created_at, 'created_at' => $value->created_at,
'count' => 0 'count' => $count
]; ];
} }
return \Yz::Return(true, '操作完成', [ return \Yz::Return(true, '操作完成', [

Loading…
Cancel
Save