forked from ctfang/ppe
-
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
baichou
committed
Dec 15, 2017
1 parent
e44b8c5
commit b94aaba
Showing
23 changed files
with
211 additions
and
23 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,15 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: 明月有色 | ||
* Date: 2017/12/15 | ||
* Time: 19:43 | ||
*/ | ||
|
||
namespace Apps\Events; | ||
|
||
|
||
class LoginToIndexEvent | ||
{ | ||
|
||
} |
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,18 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: 明月有色 | ||
* Date: 2017/12/15 | ||
* Time: 17:27 | ||
*/ | ||
|
||
namespace Apps\Http\Index\Controllers; | ||
|
||
|
||
class ConfigController | ||
{ | ||
public function index() | ||
{ | ||
dump(\Config::get('database','默认')); | ||
} | ||
} |
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: 明月有色 | ||
* Date: 2017/12/15 | ||
* Time: 17:26 | ||
*/ | ||
|
||
namespace Apps\Http\Index\Controllers; | ||
|
||
|
||
use Apps\Http\Common\Controllers\Controller; | ||
use Phalcon\Di; | ||
|
||
class DbController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
dump($this->db->listTables()); | ||
dump($this->di); | ||
} | ||
} |
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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,49 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: 明月有色 | ||
* Date: 2017/12/15 | ||
* Time: 19:58 | ||
*/ | ||
|
||
namespace Apps\Listeners; | ||
|
||
|
||
class DbListener | ||
{ | ||
protected $_profiler; | ||
|
||
protected $_logger; | ||
|
||
/** | ||
*创建分析器并开始纪录 | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->_profiler = new Profiler(); | ||
$this->_logger = new Logger("../apps/logs/db.log"); | ||
} | ||
|
||
/** | ||
* 如果事件触发器是'beforeQuery',此函数将会被执行 | ||
*/ | ||
public function beforeQuery($event, $connection) | ||
{ | ||
$this->_profiler->startProfile($connection->getSQLStatement()); | ||
} | ||
|
||
/** | ||
* 如果事件触发器是'afterQuery',此函数将会被执行 | ||
*/ | ||
public function afterQuery($event, $connection) | ||
{ | ||
$this->_logger->log($connection->getSQLStatement(), Logger::INFO); | ||
$this->_profiler->stopProfile(); | ||
} | ||
|
||
public function getProfiler() | ||
{ | ||
return $this->_profiler; | ||
} | ||
|
||
} |
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
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<?php | ||
|
||
return [ | ||
'default'=>[ | ||
|
||
'default' => [ | ||
'host' => env('DB_HOST', 'mysql'), | ||
'username' => env('DB_USERNAME', 'root'), | ||
'password' => env('DB_PASSWORD', '123456'), | ||
'dbname' => env('DB_DATABASE', 'full_crm'), | ||
'port' => '3306', | ||
'charset' => 'utf8' | ||
], | ||
]; |
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
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
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