Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
bda6b766
Commit
bda6b766
authored
Jun 19, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结构规范
parent
9b1035ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
25 deletions
+10
-25
BaseResponse.php
api/base/BaseResponse.php
+3
-1
ArticleController.php
api/controllers/ArticleController.php
+2
-1
NoticeController.php
api/controllers/NoticeController.php
+3
-2
SiteController.php
api/controllers/SiteController.php
+2
-21
No files found.
api/base/BaseResponse.php
View file @
bda6b766
...
@@ -24,10 +24,12 @@ class BaseResponse extends Response
...
@@ -24,10 +24,12 @@ class BaseResponse extends Response
if
(
empty
(
$data
))
{
if
(
empty
(
$data
))
{
$return
[
'code'
]
=
1
;
$return
[
'code'
]
=
1
;
$return
[
'msg'
]
=
'数据为空'
;
$return
[
'msg'
]
=
'数据为空'
;
}
else
{
}
else
if
(
is_array
(
$data
)
&&
!
isset
(
$data
[
'code'
]))
{
$return
[
'code'
]
=
0
;
$return
[
'code'
]
=
0
;
$return
[
'count'
]
=
count
(
$data
);
$return
[
'count'
]
=
count
(
$data
);
$return
[
'data'
]
=
$data
;
$return
[
'data'
]
=
$data
;
}
else
{
$return
=
$data
;
}
}
\Yii
::
$app
->
response
->
data
=
$return
;
\Yii
::
$app
->
response
->
data
=
$return
;
parent
::
send
();
parent
::
send
();
...
...
api/controllers/ArticleController.php
View file @
bda6b766
...
@@ -52,6 +52,6 @@ class ArticleController extends BaseController
...
@@ -52,6 +52,6 @@ class ArticleController extends BaseController
}
}
$data
=
Article
::
getList
(
$page
,
$limit
,
$condition
);
$data
=
Article
::
getList
(
$page
,
$limit
,
$condition
);
Yii
::
$app
->
response
->
data
=
$data
;
return
$data
;
}
}
}
}
\ No newline at end of file
api/controllers/NoticeController.php
View file @
bda6b766
...
@@ -25,6 +25,7 @@ class NoticeController extends BaseController
...
@@ -25,6 +25,7 @@ class NoticeController extends BaseController
* @var $page
* @var $page
* @var $limit
* @var $limit
* @var $condition 筛选条件
* @var $condition 筛选条件
* @return array
*/
*/
public
function
actionList
()
public
function
actionList
()
{
{
...
@@ -62,7 +63,6 @@ class NoticeController extends BaseController
...
@@ -62,7 +63,6 @@ class NoticeController extends BaseController
$condition
[]
=
[
'>='
,
'update_at'
,
$post
[
'update_at'
]];
$condition
[]
=
[
'>='
,
'update_at'
,
$post
[
'update_at'
]];
}
}
$data
=
Notice
::
getList
(
$page
,
$limit
,
$condition
);
$data
=
Notice
::
getList
(
$page
,
$limit
,
$condition
);
return
$data
;
Yii
::
$app
->
response
->
data
=
$data
;
}
}
}
}
\ No newline at end of file
api/controllers/SiteController.php
View file @
bda6b766
...
@@ -24,26 +24,6 @@ class SiteController extends BaseController
...
@@ -24,26 +24,6 @@ class SiteController extends BaseController
*/
*/
public
function
actionError
()
public
function
actionError
()
{
{
// $page = 'error';
// $e = Yii::$app->errorHandler->exception;
// $errMsg = $e->getMessage();
// $errCode = isset($e->statusCode) ? $e->statusCode :
// (isset(Yii::$app->response->statusCode) ? Yii::$app->response->statusCode : 500);
// if ($e !== null) {
//
// switch ($errCode) {
// case 404:
// $page = 404;
// break;
// case 500:
// $page = 500;
// break;
// }
// }
//
// return $this->render($page, [
// 'code' => isset($errCode) ? $errCode : 500,
// 'message' => isset($errMsg) ? $errMsg : ''
// ]);
}
}
}
}
\ No newline at end of file
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