mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 18:12:50 +08:00
feat: 统一修改code默认值,0为正常,500为默认异常,其他数值异常
This commit is contained in:
@@ -20,7 +20,7 @@ trait JumpTraitBase
|
||||
* @return void
|
||||
* @throws HttpResponseException
|
||||
*/
|
||||
protected function success($msg = '', $data = '', $url = null, $wait = 3, array $header = [])
|
||||
protected function success($msg = '', $data = '', $url = null, $code = 0, $wait = 3, array $header = [])
|
||||
{
|
||||
if (is_null($url) && isset($_SERVER['HTTP_REFERER'])) {
|
||||
$url = $_SERVER['HTTP_REFERER'];
|
||||
@@ -29,7 +29,7 @@ trait JumpTraitBase
|
||||
}
|
||||
|
||||
$result = [
|
||||
'code' => 1,
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'data' => $data,
|
||||
'url' => $url,
|
||||
@@ -59,7 +59,7 @@ trait JumpTraitBase
|
||||
* @return void
|
||||
* @throws HttpResponseException
|
||||
*/
|
||||
protected function error($msg = '', $data = '', $url = null, $wait = 3, array $header = [])
|
||||
protected function error($msg = '', $data = '', $url = null, $code = 500, $wait = 3, array $header = [])
|
||||
{
|
||||
if (is_null($url)) {
|
||||
$url = request()->isAjax() ? '' : 'javascript:history.back(-1);';
|
||||
@@ -69,7 +69,7 @@ trait JumpTraitBase
|
||||
|
||||
$type = $this->getResponseType();
|
||||
$result = [
|
||||
'code' => 0,
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'data' => $data,
|
||||
'url' => $url,
|
||||
|
||||
Reference in New Issue
Block a user