forked from kitelife/feed-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xiayongfeng
committed
Mar 16, 2015
0 parents
commit e519629
Showing
7 changed files
with
425 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Composer template | ||
composer.phar | ||
vendor/ | ||
|
||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
# composer.lock | ||
|
||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "youngsterxyf/rss-world", | ||
"description": "A rss aggregation service based on Slim and Vue.js", | ||
"keywords": ["microframework","rest","router"], | ||
"homepage": "http://github.com/youngsterxyf/rss-world", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "youngsterxyf", | ||
"email": "[email protected]", | ||
"homepage": "http://youngsterxyf.github.io" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.0", | ||
"monolog/monolog": "1.*", | ||
"slim/slim": "2.*", | ||
"rmccue/requests": ">=1.0" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: xiayongfeng | ||
* Date: 2015/3/16 | ||
* Time: 15:38 | ||
*/ | ||
|
||
namespace RSSWorld\Helpers; | ||
|
||
class CodeStatus | ||
{ | ||
|
||
const OK = 1000; // 成功 | ||
const PARAMETER_NOT_EXISTED = 1001; // 缺少必要的请求参数 | ||
const RESOURCE_NOT_ACCESSIBLE = 1002; // 资源不可访问 | ||
const NOT_VALID_RESOURCE = 1003; // 无效资源 | ||
|
||
public static $statusCode = array( | ||
self::OK => '成功', | ||
self::PARAMETER_NOT_EXISTED => '缺少必要的请求参数', | ||
self::RESOURCE_NOT_ACCESSIBLE => '资源不可访问', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: xiayongfeng | ||
* Date: 2015/3/16 | ||
* Time: 15:30 | ||
*/ | ||
|
||
namespace RSSWorld\Helpers; | ||
|
||
class ResponseUtils | ||
{ | ||
|
||
public static function responseError($errCode) | ||
{ | ||
echo json_encode(array( | ||
'code' => $errCode, | ||
'message' => CodeStatus::$statusCode[$errCode], | ||
)); | ||
|
||
return true; | ||
} | ||
|
||
public static function responseJSON($data) | ||
{ | ||
echo json_encode(array( | ||
'code' => CodeStatus::OK, | ||
'data' => $data, | ||
)); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: xiayongfeng | ||
* Date: 2015/3/16 | ||
* Time: 17:04 | ||
*/ | ||
|
||
// 注册应用自己的autoload | ||
spl_autoload_register(function ($className) { | ||
$prefix = 'RSSWorld\\'; | ||
$baseDir = __DIR__ . '/'; | ||
$len = strlen($prefix); | ||
if (strncmp($prefix, $className, $len) !== 0) { | ||
return; | ||
} | ||
$relativeClassName = substr($className, $len); | ||
$targetFile = $baseDir . str_replace('\\', '/', $relativeClassName) . '.php'; | ||
if (file_exists($targetFile)) { | ||
require $targetFile; | ||
} | ||
}); |
Oops, something went wrong.