You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.4 KiB
PHP
101 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Admin\YeWu;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class DeleteOperationLogController extends Controller
|
|
{
|
|
public function GetList(Request $request)
|
|
{
|
|
$page = request('page');
|
|
$pageSize = request('pageSize');
|
|
$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']);
|
|
}
|
|
|
|
$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]);
|
|
}
|
|
}
|