Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lzzzzl
/
liexin_scm_service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
af3d942a
authored
May 14, 2020
by
叶明星
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改返回方法
parent
e0c14130
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
41 deletions
app/Http/Controllers/Controller.php
app/Http/Controllers/ServicesController.php
app/Http/Controllers/Controller.php
View file @
af3d942a
...
...
@@ -32,7 +32,7 @@ class Controller extends BaseController
}
else
{
$data
[
'data'
]
=
$dataArr
;
}
return
json_encode
(
$data
);
return
response
()
->
json
(
$data
);
}
/**
...
...
app/Http/Controllers/ServicesController.php
View file @
af3d942a
...
...
@@ -18,46 +18,6 @@ class ServicesController extends Controller
return
$this
->
$id
(
$request
,
$id
);
}
public
function
apiReturn
(
$Errcode
=
0
,
$level
=
1
,
$dataArr
=
''
)
{
//生成错误码
$Errcode
=
$this
->
Errcode
(
$Errcode
,
$level
);
//获取错误描述
$ErrMsg
=
config
(
'errmsg.cn.'
.
$Errcode
);
//上报错误
$data
=
[
'errcode'
=>
$Errcode
,
'errmsg'
=>
$ErrMsg
];
//非正常返回码,上报
if
((
$data
[
'errcode'
]
<
10000
||
$data
[
'errcode'
]
>=
50000
)
&&
$data
[
'errcode'
]
!==
0
){
try
{
ErrorLog
(
$Errcode
,
$ErrMsg
);
}
catch
(
\Exception
$e
){
Log
::
info
(
$e
);
}
}
if
(
!
empty
(
$dataArr
)
&&
is_array
(
$dataArr
)){
foreach
(
$dataArr
as
$k
=>
$v
){
$data
[
'data'
][
$k
]
=
$v
;
}
}
else
{
$data
[
'data'
]
=
$dataArr
;
}
return
json_encode
(
$data
);
}
/**
* @param int $code 错误码
* @param int $level 错误级别 1普通错误 5需关注错误 9致命错误,急需解决
* @return int
*/
protected
function
Errcode
(
$code
=
0
,
$level
=
1
){
if
(
$code
===
0
)
return
0
;
$SystemCode
=
config
(
'website.SystemCode'
);
return
errCode
(
$code
,
$level
,
$SystemCode
);
}
/**
* 获取仓库信息
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment