Commit 2053d6d5 by banice

添加of命令

parent 0b01c7ed
...@@ -10,13 +10,15 @@ namespace Application\controller\business\power; ...@@ -10,13 +10,15 @@ namespace Application\controller\business\power;
use Application\controller\Controller; use Application\controller\Controller;
use Lib\Gateway;
use Lib\log\Log;
class ShutdownController extends Controller class ShutdownController extends Controller
{ {
protected $parameterMap = [ protected $parameterMap = [
'04' => [] '0F' => []
]; ];
public function __construct(string $clientId, string $message, string $command) public function __construct(string $clientId, string $message, string $command)
...@@ -27,6 +29,13 @@ class ShutdownController extends Controller ...@@ -27,6 +29,13 @@ class ShutdownController extends Controller
public function shutdown() public function shutdown()
{ {
if (isset($_SESSION['gateway_mac'])) {
try {
Gateway::closeCurrentClient();
} catch (\Exception $exception) {
Log::error($exception->getMessage());
}
}
} }
......
...@@ -33,7 +33,7 @@ class Api ...@@ -33,7 +33,7 @@ class Api
$this->add('08', 'business\port\OnlineController@online'); $this->add('08', 'business\port\OnlineController@online');
$this->add('09', 'business\port\OfflineController@offline'); $this->add('09', 'business\port\OfflineController@offline');
// $this->add('0F', 'business\power\ShutdownController@shutdown'); $this->add('0F', 'business\power\ShutdownController@shutdown');
$this->add('0A', 'setting\SettingController@get'); $this->add('0A', 'setting\SettingController@get');
$this->add('31', 'card\PayRuleController@get'); $this->add('31', 'card\PayRuleController@get');
......
...@@ -142,7 +142,7 @@ class WaitingState extends State ...@@ -142,7 +142,7 @@ class WaitingState extends State
]; ];
//更新订单状态 //更新订单状态
$startCapacity = $this->order->getStartCapacity(); $startCapacity = $this->order->getStartCapacity();
if ($startCapacity !== -2 && $startCapacity > 0) { if ($startCapacity !== -2 && $startCapacity >= 0) {
$update['start_capacity'] = (int)$this->order->getStartCapacity(); $update['start_capacity'] = (int)$this->order->getStartCapacity();
} }
$orderModel = new OrderModel(); $orderModel = new OrderModel();
......
...@@ -10,6 +10,7 @@ namespace Src; ...@@ -10,6 +10,7 @@ namespace Src;
use Lib\Gateway; use Lib\Gateway;
use Lib\log\Log;
class BroadcastToAgent class BroadcastToAgent
{ {
...@@ -26,11 +27,19 @@ class BroadcastToAgent ...@@ -26,11 +27,19 @@ class BroadcastToAgent
public function broadcast(array $data) public function broadcast(array $data)
{ {
Log::debug('agent_id' . $this->agentId);
$redis = \Events::getRedis();
$superAgentIds = $redis->hGetAll('cdz:super_agent_id:hash');
foreach ($superAgentIds as $id => $value) {
Gateway::sendToUid($id, json_encode($data));
}
if ($this->agentId !== '') { if ($this->agentId !== '') {
Gateway::sendToUid($this->agentId, json_encode($data)); Gateway::sendToUid($this->agentId, json_encode($data));
return true; return true;
} else { } else {
Log::error('agent_id can not find');
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment