Skip to content

Commit 687ef48

Browse files
committed
0.0.4
1 parent 6828489 commit 687ef48

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

src/Commands.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
namespace RuLong\Socket;
44

5+
use App\Workerman\Events;
6+
use GatewayWorker\BusinessWorker;
7+
use GatewayWorker\Gateway;
8+
use GatewayWorker\Register;
59
use Illuminate\Console\Command;
10+
use Workerman\Worker;
611

712
class Commands extends Command
813
{
@@ -13,42 +18,26 @@ class Commands extends Command
1318
public function handle()
1419
{
1520
global $argv;
21+
1622
$action = $this->argument('action');
1723

24+
if (!in_array($action, ['start', 'stop', 'restart', 'reload', 'status', 'connections'])) {
25+
return 'Error';
26+
}
1827
$argv[1] = $action;
1928
$argv[2] = $this->option('d') ? '-d' : '';
2029

21-
switch ($arg) {
22-
case 'start':
23-
$this->start();
24-
break;
25-
case 'stop':
26-
$this->stop();
27-
break;
28-
case 'restart':
29-
break;
30-
case 'reload':
31-
break;
32-
case 'status':
33-
break;
34-
case 'connections':
35-
break;
36-
}
30+
$this->startServer();
3731
}
3832

39-
protected function start()
33+
protected function startServer()
4034
{
4135
$this->startGateWay();
4236
$this->startBusinessWorker();
4337
$this->startRegister();
4438
Worker::runAll();
4539
}
4640

47-
protected function stop()
48-
{
49-
50-
}
51-
5241
private function startBusinessWorker()
5342
{
5443
$worker = new BusinessWorker();

src/ServiceProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class ServiceProvider extends LaravelServiceProvider
1313

1414
public function boot()
1515
{
16-
$this->commands($this->commands);
17-
1816
if ($this->app->runningInConsole()) {
19-
17+
$this->commands($this->commands);
2018
}
2119
}
2220

0 commit comments

Comments
 (0)