Skip to content

Commit

Permalink
0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cjango committed Jun 19, 2018
1 parent 6828489 commit 687ef48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
33 changes: 11 additions & 22 deletions src/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

namespace RuLong\Socket;

use App\Workerman\Events;
use GatewayWorker\BusinessWorker;
use GatewayWorker\Gateway;
use GatewayWorker\Register;
use Illuminate\Console\Command;
use Workerman\Worker;

class Commands extends Command
{
Expand All @@ -13,42 +18,26 @@ class Commands extends Command
public function handle()
{
global $argv;

$action = $this->argument('action');

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

switch ($arg) {
case 'start':
$this->start();
break;
case 'stop':
$this->stop();
break;
case 'restart':
break;
case 'reload':
break;
case 'status':
break;
case 'connections':
break;
}
$this->startServer();
}

protected function start()
protected function startServer()
{
$this->startGateWay();
$this->startBusinessWorker();
$this->startRegister();
Worker::runAll();
}

protected function stop()
{

}

private function startBusinessWorker()
{
$worker = new BusinessWorker();
Expand Down
4 changes: 1 addition & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class ServiceProvider extends LaravelServiceProvider

public function boot()
{
$this->commands($this->commands);

if ($this->app->runningInConsole()) {

$this->commands($this->commands);
}
}

Expand Down

0 comments on commit 687ef48

Please # to comment.