mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-10 03:42:49 +08:00
优化error和success方法
This commit is contained in:
@@ -64,7 +64,8 @@ abstract class BaseController
|
||||
|
||||
// 初始化
|
||||
protected function initialize()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
@@ -111,11 +112,13 @@ abstract class BaseController
|
||||
} else {
|
||||
if ($jump_to_url instanceof Url) {
|
||||
|
||||
$jump_to_url = $jump_to_url;
|
||||
$jump_to_url = (string)$jump_to_url;
|
||||
} else {
|
||||
if (strpos($jump_to_url, 'http') !== 0) {
|
||||
$jump_to_url = url($jump_to_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'msg' => $msg,
|
||||
@@ -124,7 +127,7 @@ abstract class BaseController
|
||||
];
|
||||
|
||||
if (\request()->isAjax()) {
|
||||
$data['jump_to_url'] = (string)$jump_to_url;
|
||||
$data['jump_to_url'] = $jump_to_url;
|
||||
if ($code == 200) {
|
||||
$code = 0;
|
||||
}
|
||||
@@ -142,10 +145,11 @@ abstract class BaseController
|
||||
} else {
|
||||
if ($jump_to_url instanceof Url) {
|
||||
|
||||
$jump_to_url = $jump_to_url;
|
||||
$jump_to_url = (string)$jump_to_url;
|
||||
} else {
|
||||
if (strpos($jump_to_url, 'http') !== 0) {
|
||||
$jump_to_url = url($jump_to_url);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +160,7 @@ abstract class BaseController
|
||||
];
|
||||
|
||||
if (\request()->isAjax()) {
|
||||
$data['jump_to_url'] = (string)$jump_to_url;
|
||||
$data['jump_to_url'] = $jump_to_url;
|
||||
if ($code == 200) {
|
||||
$code = 500;
|
||||
}
|
||||
@@ -166,5 +170,4 @@ abstract class BaseController
|
||||
View::assign($data);
|
||||
throw new HttpResponseException(response(View::fetch('common@tpl/error'), $code));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user