where('name', 'like', '%' . $searchInfo['name'] . '%'); } if (!empty($searchInfo['id_card_num'])) { $encrypt = \App\Lib\HSM::HsmEncrypt($searchInfo['id_card_num']); if ($encrypt['status']) { $query->where('id_card_num', $encrypt['data']); } } if (!empty($searchInfo['operator_name'])) { $query->where('operator_name', 'like', '%' . $searchInfo['operator_name'] . '%'); } if (!empty($searchInfo['table_name'])) { $query->where('table_name', $searchInfo['table_name']); } if (!empty($searchInfo['type'])) { $query->where('type', $searchInfo['type']); } if (!empty($searchInfo['dateRange'])) { $query->whereBetween('created_at', [$searchInfo['dateRange'][0] . ' 00:00:00', $searchInfo['dateRange'][1] . ' 23:59:59']); } $count = $query->count(); $list = $query->orderBy('id', 'desc') ->offset(($page - 1) * $pageSize) ->limit($pageSize) ->get(); foreach ($list as $item) { if (!empty($item->id_card_num)) { $decrypt = \App\Lib\HSM::HsmDecrypt($item->id_card_num); if ($decrypt['status']) { $item->id_card_num = $decrypt['data']; } } } return \Yz::Return(true, '查询成功', ['list' => $list, 'count' => $count]); } public function ExportList(Request $request) { $searchInfo = request('searchInfo'); $query = DB::table('delete_operation_log'); if (!empty($searchInfo['name'])) { $query->where('name', 'like', '%' . $searchInfo['name'] . '%'); } if (!empty($searchInfo['id_card_num'])) { $encrypt = \App\Lib\HSM::HsmEncrypt($searchInfo['id_card_num']); if ($encrypt['status']) { $query->where('id_card_num', $encrypt['data']); } } if (!empty($searchInfo['operator_name'])) { $query->where('operator_name', 'like', '%' . $searchInfo['operator_name'] . '%'); } if (!empty($searchInfo['table_name'])) { $query->where('table_name', $searchInfo['table_name']); } if (!empty($searchInfo['type'])) { $query->where('type', $searchInfo['type']); } if (!empty($searchInfo['dateRange'])) { $query->whereBetween('created_at', [$searchInfo['dateRange'][0] . ' 00:00:00', $searchInfo['dateRange'][1] . ' 23:59:59']); } $list = $query->orderBy('id', 'desc')->get(); foreach ($list as $item) { if (!empty($item->id_card_num)) { $decrypt = \App\Lib\HSM::HsmDecrypt($item->id_card_num); if ($decrypt['status']) { $item->id_card_num = $decrypt['data']; } } } return \Yz::Return(true, '查询成功', ['list' => $list]); } }