作者 liyuhang

gx

... ... @@ -3,7 +3,6 @@
namespace App\Exceptions;
use App\Enums\Common\Code;
use App\Enums\Common\Common;
use App\Services\DingService;
use App\Utils\EncryptUtils;
use App\Utils\LogUtils;
... ... @@ -129,12 +128,13 @@ class Handler extends ExceptionHandler
$exception->getLine();
(new DingService())->handle(['keyword' => "ERROR", 'msg' => config('app.env') . '环境报错:' . $exceptionMessage, 'isAtAll' => false]);
}
//生成日志
$log = config('logging.operator_log');
if(isset($log,$log['log'],$log['action']) && $log['log'] == true){
if(empty($log['action']) || (strpos($log['action'],Route::currentRouteName()) < 0)){
if(empty($log['action']) || (strpos($log['action'],$request->route()->getName()) < 0)){
$info = Cache::get($request->header('token'));
if(!empty($info)){
\App\Helper\Common::set_user_log(['model'=>Route::currentRouteName(),'remark'=>'请求的参数:param = '.json_encode($request->all()),'operator_id'=>$info['id']]);
\App\Helper\Common::set_user_log(['model'=>$request->route()->getName(),'remark'=>'请求的参数:param = '.json_encode($request->all()),'operator_id'=>$info['id']]);
}
}
}
... ...
... ... @@ -34,8 +34,6 @@ class BaseController extends Controller
$info = Cache::get($this->token);
$this->user = $info;
$this->uid = $info['id'];
}else{
return response(['code'=>Code::USER_ERROR,'msg'=>'当前用户未登录']);
}
$this->get_param();
}
... ... @@ -75,8 +73,7 @@ class BaseController extends Controller
return response()->json($response,200,$this->header);
}
/**
* @name 参数过滤
* @return void
* @name :参数过滤
* @author :liyuhang
* @method
*/
... ... @@ -138,23 +135,12 @@ class BaseController extends Controller
/**
* 菜单权限->得到子级数组
* @param int
* @return array
* @param $data
* @name :返回参数统一处理
* @return array|string
* @author :liyuhang
* @method
*/
public function _get_child($my_id, $arr)
{
$new_arr = array();
foreach ($arr as $k => $v) {
$v = (array)$v;
if ($v['pid'] == $my_id) {
$v['sub'] = $this->_get_child($v['id'],$arr);
$new_arr[] = $v;
}
}
return $new_arr ? $new_arr : false;
}
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
... ... @@ -170,7 +156,7 @@ class BaseController extends Controller
}
switch ((string) $k) {
case 'image':
$v['image_link'] = file_get_contents($v);
$v['image_link'] = url('/a/image/' . $v);
break;
}
}
... ...