update to 1.2 version

Generate systemd script
Default info_level set to 2
Modify & add some comment for Example module
Brand new Console
Add daemon command argument
Add #OnTick annotation
Add ZMRobot API class
This commit is contained in:
whale
2020-04-29 15:29:56 +08:00
parent e1983d6dd8
commit 169a751e0f
31 changed files with 872 additions and 200 deletions

View File

@@ -7,7 +7,10 @@ namespace ZM\Context;
use Swoole\Http\Request;
use Swoole\WebSocket\Frame;
use swoole_server;
use ZM\Connection\ConnectionManager;
use ZM\Connection\CQConnection;
use ZM\Http\Response;
use ZM\Utils\ZMRobot;
class Context implements ContextInterface
{
@@ -68,4 +71,12 @@ class Context implements ContextInterface
public function getCid() {
return $this->cid;
}
/**
* @return ZMRobot|null
*/
public function getRobot() {
$conn = ConnectionManager::get($this->getFrame()->fd);
return $conn instanceof CQConnection ? new ZMRobot($conn) : null;
}
}