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