Skip to content

Commit d7b8c59

Browse files
author
lidanyang
committed
fix lib
1 parent 81386e0 commit d7b8c59

13 files changed

+53
-42
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
*.iml
88
out
99
gen
10+
vendor/
11+
composer.lock

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"require": {
3-
"esd/base-server": "~0.1",
4-
"esd/aop-plugin": "~0.1"
3+
"esd/esd-core":"~0.1",
4+
"esd/aop-plugin": "~0.1",
5+
6+
"ext-json": "*"
57
},
68
"autoload": {
79
"psr-4": {

src/Pack/Aspect/PackAspect.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
namespace ESD\Plugins\Pack\Aspect;
1010

1111

12-
use ESD\BaseServer\Plugins\Logger\GetLogger;
13-
use ESD\BaseServer\Server\Beans\Request;
14-
use ESD\BaseServer\Server\Server;
12+
use ESD\Core\Plugins\Logger\GetLogger;
13+
use ESD\Core\Server\Beans\Request;
14+
use ESD\Core\Server\Server;
1515
use ESD\Plugins\Aop\OrderAspect;
1616
use ESD\Plugins\Pack\ClientData;
1717
use ESD\Plugins\Pack\PackConfig;
@@ -44,7 +44,7 @@ public function __construct($packConfigs)
4444
if (!empty($packConfig->getPackTool())) {
4545
if (!isset($this->packTools[$packConfig->getPackTool()])) {
4646
$className = $packConfig->getPackTool();
47-
$this->packTools[$packConfig->getPackTool()] = Server::$instance->getContainer()->get($className);
47+
$this->packTools[$packConfig->getPackTool()] = DIget($className);
4848
}
4949
}
5050
}
@@ -54,9 +54,8 @@ public function __construct($packConfigs)
5454
* around onHttpRequest
5555
*
5656
* @param MethodInvocation $invocation Invocation
57-
* @throws \ESD\BaseServer\Exception
5857
* @throws \Throwable
59-
* @Around("within(ESD\BaseServer\Server\IServerPort+) && execution(public **->onHttpRequest(*))")
58+
* @Around("within(ESD\Core\Server\Port\IServerPort+) && execution(public **->onHttpRequest(*))")
6059
*/
6160
protected function aroundHttpRequest(MethodInvocation $invocation)
6261
{
@@ -76,9 +75,8 @@ protected function aroundHttpRequest(MethodInvocation $invocation)
7675
* around onTcpReceive
7776
*
7877
* @param MethodInvocation $invocation Invocation
79-
* @throws \ESD\BaseServer\Exception
8078
* @throws \Throwable
81-
* @Around("within(ESD\BaseServer\Server\IServerPort+) && execution(public **->onTcpReceive(*))")
79+
* @Around("within(ESD\Core\Server\Port\IServerPort+) && execution(public **->onTcpReceive(*))")
8280
*/
8381
protected function aroundTcpReceive(MethodInvocation $invocation)
8482
{
@@ -97,9 +95,8 @@ protected function aroundTcpReceive(MethodInvocation $invocation)
9795
* around onWsMessage
9896
*
9997
* @param MethodInvocation $invocation Invocation
100-
* @throws \ESD\BaseServer\Exception
10198
* @throws \Throwable
102-
* @Around("within(ESD\BaseServer\Server\IServerPort+) && execution(public **->onWsMessage(*))")
99+
* @Around("within(ESD\Core\Server\Port\IServerPort+) && execution(public **->onWsMessage(*))")
103100
*/
104101
protected function aroundWsMessage(MethodInvocation $invocation)
105102
{
@@ -118,7 +115,7 @@ protected function aroundWsMessage(MethodInvocation $invocation)
118115
* around onUdpPacket
119116
*
120117
* @param MethodInvocation $invocation Invocation
121-
* @Around("within(ESD\BaseServer\Server\IServerPort+) && execution(public **->onUdpPacket(*))")
118+
* @Around("within(ESD\Core\Server\Port\IServerPort+) && execution(public **->onUdpPacket(*))")
122119
* @throws \Throwable
123120
*/
124121
protected function aroundUdpPacket(MethodInvocation $invocation)

src/Pack/ClientData.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
namespace ESD\Plugins\Pack;
1010

1111

12-
use ESD\BaseServer\Server\Beans\ClientInfo;
13-
use ESD\BaseServer\Server\Beans\Request;
14-
use ESD\BaseServer\Server\Beans\Response;
15-
use ESD\BaseServer\Server\Server;
12+
use ESD\Core\Server\Beans\ClientInfo;
13+
use ESD\Core\Server\Beans\Request;
14+
use ESD\Core\Server\Beans\Response;
15+
use ESD\Core\Server\Server;
1616

1717
class ClientData
1818
{

src/Pack/GetBoostSend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace ESD\Plugins\Pack;
1010

1111

12-
use ESD\BaseServer\Server\Server;
12+
use ESD\Core\Server\Server;
1313
use ESD\Plugins\Pack\Aspect\PackAspect;
1414

1515
trait GetBoostSend

src/Pack/PackConfig.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace ESD\Plugins\Pack;
1010

1111

12-
use ESD\BaseServer\Server\Config\PortConfig;
12+
use ESD\Core\Server\Config\PortConfig;
1313
use ESD\Plugins\Pack\PackTool\LenJsonPack;
1414
use ESD\Plugins\Pack\PackTool\NonJsonPack;
1515

@@ -21,7 +21,9 @@ class PackConfig extends PortConfig
2121
protected $packTool;
2222

2323
/**
24-
* @throws \ESD\BaseServer\Server\Exception\ConfigException
24+
* @throws \DI\DependencyException
25+
* @throws \DI\NotFoundException
26+
* @throws \ESD\Core\Plugins\Config\ConfigException
2527
*/
2628
public function merge()
2729
{

src/Pack/PackException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace ESD\Plugins\Pack;
1010

1111

12-
use ESD\BaseServer\Exception;
12+
use ESD\Core\Exception;
1313

1414
class PackException extends Exception
1515
{

src/Pack/PackPlugin.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
namespace ESD\Plugins\Pack;
1010

1111

12-
use ESD\BaseServer\Server\Config\PortConfig;
13-
use ESD\BaseServer\Server\Context;
14-
use ESD\BaseServer\Server\Plugin\AbstractPlugin;
15-
use ESD\BaseServer\Server\PlugIn\PluginInterfaceManager;
16-
use ESD\BaseServer\Server\Server;
12+
use ESD\Core\Server\Config\PortConfig;
13+
use ESD\Core\Context\Context;
14+
use ESD\Core\Plugin\AbstractPlugin;
15+
use ESD\Core\Plugin\PluginInterfaceManager;
16+
use ESD\Core\Server\Server;
1717
use ESD\Plugins\Aop\AopConfig;
1818
use ESD\Plugins\Aop\AopPlugin;
1919
use ESD\Plugins\Pack\Aspect\PackAspect;
@@ -33,6 +33,7 @@ class PackPlugin extends AbstractPlugin
3333
/**
3434
* EasyRoutePlugin constructor.
3535
* @throws \DI\DependencyException
36+
* @throws \DI\NotFoundException
3637
*/
3738
public function __construct()
3839
{
@@ -55,7 +56,8 @@ public function getName(): string
5556
* @return mixed|void
5657
* @throws \DI\DependencyException
5758
* @throws \DI\NotFoundException
58-
* @throws \ESD\BaseServer\Exception
59+
* @throws \ESD\Core\Plugins\Config\ConfigException
60+
* @throws \ESD\Core\Exception
5961
* @throws \ReflectionException
6062
*/
6163
public function init(Context $context)
@@ -69,8 +71,8 @@ public function init(Context $context)
6971
$packConfig->merge();
7072
$this->packConfigs[$packConfig->getPort()] = $packConfig;
7173
}
72-
$serverConfig = $context->getServer()->getServerConfig();
73-
$aopConfig = Server::$instance->getContainer()->get(AopConfig::class);
74+
$serverConfig = Server::$instance->getServerConfig();
75+
$aopConfig = DIget(AopConfig::class);
7476
$aopConfig->addIncludePath($serverConfig->getVendorDir() . "/esd/base-server");
7577
$this->packAspect = new PackAspect($this->packConfigs);
7678
$aopConfig->addAspect($this->packAspect);
@@ -80,7 +82,8 @@ public function init(Context $context)
8082
* @param PluginInterfaceManager $pluginInterfaceManager
8183
* @return mixed|void
8284
* @throws \DI\DependencyException
83-
* @throws \ESD\BaseServer\Exception
85+
* @throws \DI\NotFoundException
86+
* @throws \ESD\Core\Exception
8487
* @throws \ReflectionException
8588
*/
8689
public function onAdded(PluginInterfaceManager $pluginInterfaceManager)
@@ -102,7 +105,6 @@ public function beforeServerStart(Context $context)
102105
/**
103106
* 在进程启动前
104107
* @param Context $context
105-
* @return mixed
106108
*/
107109
public function beforeProcessStart(Context $context)
108110
{

src/Pack/PackTool/AbstractPack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace ESD\Plugins\Pack\PackTool;
1010

1111

12-
use ESD\BaseServer\Server\Config\PortConfig;
12+
use ESD\Core\Server\Config\PortConfig;
1313
use ESD\Plugins\Pack\PackException;
1414

1515
abstract class AbstractPack implements IPack

src/Pack/PackTool/EofJsonPack.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace ESD\Plugins\Pack\PackTool;
1010

11-
use ESD\BaseServer\Plugins\Logger\GetLogger;
12-
use ESD\BaseServer\Server\Config\PortConfig;
11+
use ESD\Core\Plugins\Logger\GetLogger;
12+
use ESD\Core\Server\Config\PortConfig;
1313
use ESD\Plugins\Pack\ClientData;
1414

1515
class EofJsonPack extends AbstractPack
@@ -58,7 +58,9 @@ public function pack(string $data, PortConfig $portConfig, ?string $topic = null
5858
* @param string $data
5959
* @param PortConfig $portConfig
6060
* @return mixed
61-
* @throws \ESD\BaseServer\Server\Exception\ConfigException
61+
* @throws \DI\DependencyException
62+
* @throws \DI\NotFoundException
63+
* @throws \ESD\Core\Plugins\Config\ConfigException
6264
*/
6365
public function unPack(int $fd, string $data, PortConfig $portConfig): ?ClientData
6466
{

0 commit comments

Comments
 (0)