Skip to content

Commit

Permalink
优化自动加载模式,缓存设置
Browse files Browse the repository at this point in the history
  • Loading branch information
bingcool committed May 19, 2019
1 parent e5b4f45 commit 8c1fc71
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions score/Core/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function afterRequest(callable $callback, $prepend = false) {
return true;
}
}else {
throw new \Exception(__NAMESPACE__.'::'.__function__.' the first param of type is callable');
throw new \Exception(__NAMESPACE__.'::'.__function__.' the first param of type must be seted callable');
}

}
Expand Down Expand Up @@ -195,7 +195,7 @@ public function pushComponentPools() {

/**
* beforeAction 在处理实际action之前执行
* EventController不会执行该动作,所以继承与EventController不要调用该method
* EventController不会执行该动作,所以继承于EventController其他类不要调用该method
* @return mixed
*/
public function _beforeAction() {
Expand Down
4 changes: 2 additions & 2 deletions score/Core/HttpRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function invoke($module = null, $controller = null, $action = null) {
$this->response->header('Content-Type','application/json; charset=UTF-8');
$query_string = isset($this->request->server['QUERY_STRING']) ? '?'.$this->request->server['QUERY_STRING'] : '';
if(isset($this->request->post) && !empty($this->request->post)) {
$post = json_encode($this->request->post,JSON_UNESCAPED_UNICODE);
$post = json_encode($this->request->post, JSON_UNESCAPED_UNICODE);
$msg = "call {$class}::_beforeAction return false, forbiden continue call {$class}::{$action}, please checkout it ||| ".$this->request->server['REQUEST_URI'].$query_string.' post_data:'.$post;
}else {
$msg = "call {$class}::_beforeAction return false, forbiden continue call {$class}::{$action}, please checkout it ||| ".$this->request->server['REQUEST_URI'].$query_string;
Expand Down Expand Up @@ -280,7 +280,7 @@ public function invoke($module = null, $controller = null, $action = null) {
'ret' => 500,
'msg' => $msg,
'data' => ''
],JSON_UNESCAPED_UNICODE));
], JSON_UNESCAPED_UNICODE));
}
}else {
Application::getApp()->setEnd();
Expand Down
3 changes: 0 additions & 3 deletions score/Core/Memory/ChannelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class ChannelManager {
* @throws mixed
*/
public function addChannel(string $name, int $capacity = null) {
if(!class_exists('Swoole\\Coroutine\\Channel')) {
throw new \Exception("after swoole 4.3.0, \Swoole\channel is removed, you can not use it");
}
if(!isset($this->list[$name])) {
if($capacity) {
$chan = new \Swoole\Coroutine\Channel($capacity);
Expand Down
3 changes: 3 additions & 0 deletions score/Core/ServiceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public static function getMomeryIncludeFiles() {
* @return array
*/
public static function getConf() {
if(!empty(Swfy::$config)) {
return Swfy::$config;
}
return BaseServer::getConf();
}

Expand Down
2 changes: 1 addition & 1 deletion score/Core/Task/AsyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function registerTaskfinish($data, $task = null) {
*/
public static function finish($data, $task = null) {
if(is_array($data)) {
$data = json_encode($data);
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
}
if(BaseServer::isTaskEnableCoroutine() && $task instanceof \Swoole\Server\Task) {
$task->finish($data);
Expand Down
1 change: 0 additions & 1 deletion score/Websocket/WebsocketServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public function start() {
});
}


/**
* finish 函数,异步任务完成
*/
Expand Down

0 comments on commit 8c1fc71

Please sign in to comment.