<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Controllers\Admin;use App\Models\OperateLog;use Illuminate\Http\Request;use App\Http\Controllers\Controller;class OperateLogController extends Controller{public function index(Request $request){return view('admin.operate_log.index');}public function data(Request $request){$limit=$request->input('limit',$this->pageSize);$logs=OperateLog::select()->with(['user'])->orderBy('id','desc')->paginate($limit)->toArray();$P2gAC0=array();$P2gAC0['code']=0;$P2gAC0['msg']='正在请求中...';$P2gAC0['count']=$logs['total'];$P2gAC0['data']=$logs['data'];$data=$P2gAC0;return response()->json($data);}public function destroy(Request $request){$ids=$request->get('ids');if(OperateLog::whereIn('id',$ids)->delete())goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:return response()->json(['code'=>0,'msg'=>'删除成功']);goto P2gx1;P2gNextx2:return response()->json(['code'=>1,'msg'=>'删除失败']);P2gx1:}public function excel(Request $request){$ids=$request->input('ids','');if($ids)goto P2gBodyx4;goto P2gNextx4;P2gBodyx4:$AAA__AA="explode";$P2gAC0=$AAA__AA(',',$ids);$ids=$P2gAC0;goto P2gx3;P2gNextx4:P2gx3:$query=OperateLog::select()->with(['user']);if($ids)goto P2gBodyx6;goto P2gNextx6;P2gBodyx6:$query->whereIn('id',$ids);goto P2gx5;P2gNextx6:P2gx5:$logs=$query->orderBy('id','desc')->get();$data=$logs->map(function($item){return[$item->id,$item->user?($item->user->name.'('.$item->user->username.')'):'',$item->path,$item->ip,$item->input,$item->created_at];})->toArray();array_unshift($data,['ID','管理员','路由地址','Ip地址','请求参数','记录时间']);excel_export('操作日志',$data);}}
?>