Commit 0b01c7ed by banice

更新开始充,用电量错误

parent 93410bf8
......@@ -134,10 +134,11 @@ class Events
$exceptionModel = new \Application\model\ExceptionModel();
if (isset($_SESSION['station_id']) && isset($_SESSION['gateway_id'])) {
$exceptionModel->insertRow([
'message' => '网关离线',
'message' => '网关离线',
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'type' => 1,
'type' => 1,
'created_at' => date('Y-m-d H:i:s'),
]);
}
......@@ -163,8 +164,6 @@ class Events
$orderExceptionModel = new \Application\model\OrderExceptionModel();
$date = date('Y-m-d H:i:s');
foreach ($portsId as $portId) {
//所有端口状态设置为离线
......@@ -177,10 +176,10 @@ class Events
$exceptionModel->insertRow([
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'port_id' => $portId,
'message' => '口子离线',
'port_id' => $portId,
'message' => '口子离线',
'created_at' => $date,
'type' => 1,
'type' => 1,
]);
$portUsingOrderId = $port->getPortUsingOrderId();
......@@ -197,10 +196,10 @@ class Events
$orderExceptionModel->insertRow([
'order_id' => $order->getId(),
'state' => \Lib\StateCode::PORT_OFFLINE,
'order_id' => $order->getId(),
'state' => \Lib\StateCode::PORT_OFFLINE,
'created_at' => date('Y-m-d H:i:s'),
'desc' => '网关离线,订单离线',
'desc' => '网关离线,订单离线',
]);
......@@ -213,10 +212,10 @@ class Events
$broadcastToAgent->broadcast([
'notice_exception_code' => 15,
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'station_name' => $stationName,
'gateway_mac' => isset($_SESSION['gateway_mac']) ? $_SESSION['gateway_mac'] : '',
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'station_name' => $stationName,
'gateway_mac' => isset($_SESSION['gateway_mac']) ? $_SESSION['gateway_mac'] : '',
]);
......
......@@ -11,7 +11,9 @@ namespace Application\controller\accept;
use Application\controller\Controller;
use Application\model\DeviceModel;
use Application\model\GatewayLogModel;
use Application\model\GatewayModel;
use Application\model\OrderExceptionModel;
use Application\model\ParkModel;
use Application\model\StationModel;
use Lib\cdz\order\Order;
......@@ -48,93 +50,95 @@ class AccessController extends Controller
}
private function test($mac)
{
Gateway::bindUid($this->clientId, $mac);
$_SESSION['gateway_mac'] = $mac;
$gatewayModel = new GatewayModel();
if (isset($_SESSION['gateway_mac'])) {
if ($_SESSION['gateway_mac'] != $mac) {
Gateway::closeClient($this->clientId);
}
$gatewayModelResult = $gatewayModel->getColumns([
'station_id',
'id',
'name',
'type_id'
], 'mac_address = ' . "'$mac'");
if ($gatewayModelResult == false) {
Gateway::closeClient($this->clientId);
return;
}
$stationId = $gatewayModelResult['station_id'];
$gatewayId = $gatewayModelResult['id'];
$_SESSION['gateway_name'] = $gatewayModelResult['name'];
$_SESSION['gateway_id'] = $gatewayModelResult['id'];
$_SESSION['gateway_type'] = $gatewayModelResult['type_id'];
$stationModel = new StationModel();
$stationData = $stationModel->getColumns([
'park_id',
'name',
], 'id = ' . $stationId);
if (isset($stationData['park_id']) && isset($stationData['name'])) {
$parkId = $stationData['park_id'];
$_SESSION['station_name'] = $stationData['name'];
if (isset($parkId)) {
$parkModel = new ParkModel();
$_SESSION['park_id'] = $parkId;
$agentId = $parkModel->getColumn('agent_id', 'id = ' . $parkId);
if (isset($agentId)) {
$_SESSION['agent_id'] = $agentId;
}
}
}
$deviceModel = new DeviceModel();
$deviceModelResult = $deviceModel->getAllColumns([
'id',
'device_mac',
'name',
], 'gateway_id = ' . $gatewayId);
$tmp = [];
$portsIdName = [];
foreach ($deviceModelResult as $item) {
$tmp[$item['device_mac']] = $item['id'];
$portsIdName[$item['id']] = $item['name'];
}
$_SESSION['port_id_name'] = $portsIdName;
$_SESSION['port_mac_id'] = $tmp;
$_SESSION['port_id_mac'] = array_flip($tmp);
$_SESSION['station_id'] = $stationId;
$_SESSION['gateway_id'] = $gatewayId;
$_SESSION['client_id'] = $this->clientId;
}
}
// private function test($mac)
// {
//
//
// Gateway::bindUid($this->clientId, $mac);
//
// $_SESSION['gateway_mac'] = $mac;
// $gatewayModel = new GatewayModel();
//
//
// if (isset($_SESSION['gateway_mac'])) {
// if ($_SESSION['gateway_mac'] != $mac) {
// Gateway::closeClient($this->clientId);
//
// }
//
// $gatewayModelResult = $gatewayModel->getColumns([
// 'station_id',
// 'id',
// 'name',
// 'type_id'
// ], 'mac_address = ' . "'$mac'");
//
// if ($gatewayModelResult == false) {
// Gateway::closeClient($this->clientId);
// return;
// }
// $stationId = $gatewayModelResult['station_id'];
//
// $gatewayId = $gatewayModelResult['id'];
//
// $_SESSION['gateway_name'] = $gatewayModelResult['name'];
//
// $_SESSION['gateway_id'] = $gatewayModelResult['id'];
//
// $_SESSION['gateway_type'] = $gatewayModelResult['type_id'];
//
// $stationModel = new StationModel();
// $stationData = $stationModel->getColumns([
// 'park_id',
// 'name',
// ], 'id = ' . $stationId);
//
// if (isset($stationData['park_id']) && isset($stationData['name'])) {
// $parkId = $stationData['park_id'];
// $_SESSION['station_name'] = $stationData['name'];
// if (isset($parkId)) {
// $parkModel = new ParkModel();
// $_SESSION['park_id'] = $parkId;
// $agentId = $parkModel->getColumn('agent_id', 'id = ' . $parkId);
// if (isset($agentId)) {
// $_SESSION['agent_id'] = $agentId;
// }
//
// }
//
// }
//
//
// $deviceModel = new DeviceModel();
//
// $deviceModelResult = $deviceModel->getAllColumns([
//
// 'id',
// 'device_mac',
// 'name',
// 'status_id',
// ], 'gateway_id = ' . $gatewayId);
//
// $tmp = [];
// $portsIdName = [];
// $portsStatus = [];
// foreach ($deviceModelResult as $item) {
//
// $tmp[$item['device_mac']] = $item['id'];
// $portsIdName[$item['id']] = $item['name'];
// $portsStatus[$item['id']] = $item['status_id'];
// }
// $_SESSION['port_id_status'] = $portsStatus;
// $_SESSION['port_id_name'] = $portsIdName;
// $_SESSION['port_mac_id'] = $tmp;
// $_SESSION['port_id_mac'] = array_flip($tmp);
//
// $_SESSION['station_id'] = $stationId;
// $_SESSION['gateway_id'] = $gatewayId;
// $_SESSION['client_id'] = $this->clientId;
//
// }
// }
/**
* 请求入网
......@@ -212,19 +216,22 @@ class AccessController extends Controller
'id',
'device_mac',
'name',
'status_id'
], 'gateway_id = ' . $gatewayId);
$tmp = [];
$portsIdName = [];
$portsStatus = [];
foreach ($deviceModelResult as $item) {
$tmp[$item['device_mac']] = $item['id'];
$portsIdName[$item['id']] = $item['name'];
$portsStatus[$item['id']] = $item['status_id'];
}
$_SESSION['port_id_name'] = $portsIdName;
$_SESSION['port_mac_id'] = $tmp;
$_SESSION['port_id_status'] = $portsStatus;
$_SESSION['port_id_mac'] = array_flip($tmp);
$_SESSION['station_id'] = $stationId;
......@@ -300,6 +307,8 @@ class AccessController extends Controller
}
$logicStartTmp = $logicStart;
$portsIdStatus = $_SESSION['port_id_status'];
foreach ($portMacState as $mac => $state) {
$portId = isset($portsMacId[$mac]) ? $portsMacId[$mac] : false;
......@@ -307,9 +316,14 @@ class AccessController extends Controller
continue;
}
$port->setPortId($portId);
if (isset($portsIdStatus[$portId])) {
if ($portsIdStatus[$portId] === 8) {
$state = 8;
}
}
//设置端口状态
$port->setState($state);
$port->setGatewayId($_SESSION['gateway_id']);
......@@ -339,6 +353,9 @@ class AccessController extends Controller
$orderCount = '00';
$orderExceptionModel = new OrderExceptionModel();
$gatewayLod = new GatewayLogModel();
foreach ($portsId as $portId) {
$order = new Order();
......@@ -370,13 +387,25 @@ class AccessController extends Controller
$orderId = sprintf('%012x', $order->getId());
$time = sprintf('%04x', $remainTime);
$orderExceptionModel->insertRow([
'order_id' => $orderId,
'state' => '1011',
'created_at' => date('Y-m-d H:i:s'),
'desc' => '口子离线或断网后重新上线',
'data' => json_encode([
'remain_time' => $time,
'offline_reason' => $offlineReason,
])
]);
array_push($responseOrder, $logicNum . $orderId . $time);
}
$port->setPortId($portId);
$port->setGatewayId($_SESSION['gateway_id']);
$port->setStationId($_SESSION['station_id']);
$port->setState(StateCode::PORT_CHARGER);
// $port->setState(StateCode::PORT_CHARGER);
$port->setState($order->getStateCode());
$port->updatePortState();
......
......@@ -27,9 +27,9 @@ class OverController extends Controller
protected $parameterMap = [
'05' => [
'type' => 1,
'type' => 1,
'logic_id' => 1,
'state' => 1,
'state' => 1,
'order_id' => 6,
'capacity' => 4,
]
......@@ -67,10 +67,12 @@ class OverController extends Controller
if ($portId !== 0) {
$this->logRecord->setPortId($portId);
}
// 逻辑地址不相同则认为已经更换过口子
// if ($logicId != $order->getPortLogicId()) {
// $this->response->send('15', sprintf('%02x', $logicId) . sprintf('%012x', $orderId));
// }
// 逻辑地址不相同则认为已经更换过口子
if ($logicId != $order->getPortLogicId()) {
$this->response->send('15', sprintf('%02x', $logicId) . sprintf('%012x', $orderId));
return;
}
if (Gateway::isUidOnline($order->getUserId()) === 1) {
......@@ -105,9 +107,9 @@ class OverController extends Controller
$orderModel = new OrderModel();
$orderModel->update([
'is_stop' => StateCode::FINISH_REFUND,
'is_stop' => StateCode::FINISH_REFUND,
'end_capacity' => $order->getEndCapacity(),
'end_time' => date('Y-m-d H:i:s'),
'end_time' => date('Y-m-d H:i:s'),
], 'id = ' . $order->getId());
break;
......@@ -149,10 +151,10 @@ class OverController extends Controller
$orderExceptionModel = new OrderExceptionModel();
$orderExceptionModel->insertRow([
'order_id' => $orderId,
'order_id' => $orderId,
'created_at' => date('Y-m-d H:i:s'),
'state' => '-1' . StateCode::CHANGE_PORT,
'desc' => '更换口子,' . $portId . '关闭成功',
'state' => '-1' . StateCode::CHANGE_PORT,
'desc' => '更换口子,' . $portId . '关闭成功',
]);
$this->logRecord->setDesc('更换口子,' . $portId . '关闭成功');
......
......@@ -46,14 +46,9 @@ class StartController extends Controller
$logic = $this->getRequest()->get('logic_id');
$state = hexdec($this->getRequest()->get('state'));
$orderId = hexdec($this->getRequest()->get('order_id'));
$this->logRecord->setOrderId($orderId);
$capacity = hexdec($this->getRequest()->get('capacity'));
Log::debug('order_id-->' . $orderId);
Log::debug('capacity-->' . $capacity);
if ($type == 1) {
$order = new Order($orderId);
if ($order->getOrderCache(\Events::getRedis()) == false) {
$this->response->send('14', sprintf('%012x', $orderId));
......
......@@ -85,18 +85,21 @@ class OfflineController extends Controller
Log::debug('offline port_id' . $portId);
$port->setPortId($portId);
if ($port->isPortBan() === true) {
continue;
}
$port->setStationId($_SESSION['station_id']);
$port->setGatewayId($_SESSION['gateway_id']);
$port->setState(StateCode::PORT_OFFLINE);
$port->updatePortState();
// 记录口子离线
$exceptionModel->insertRow([
'message' => '口子离线',
'message' => '口子离线',
'gateway_id' => isset($_SESSION['gateway_id']) ? $_SESSION['gateway_id'] : '',
'station_id' => isset($_SESSION['station_id']) ? $_SESSION['station_id'] : '',
'port_id' => $portId,
'port_id' => $portId,
'created_at' => date('Y-m-d H:i:s'),
'type' => 1,
'type' => 1,
]);
}
......@@ -105,11 +108,11 @@ class OfflineController extends Controller
$broadcastToAgent->broadcast([
'notice_exception_code' => StateCode::PORT_OFFLINE,
'ports' => $offlinePorts,
'station_name' => $_SESSION['station_name'],
'gateway_name' => $_SESSION['gateway_name'],
'station_id' => $_SESSION['station_id'],
'gateway_id' => $_SESSION['gateway_id'],
'ports' => $offlinePorts,
'station_name' => $_SESSION['station_name'],
'gateway_name' => $_SESSION['gateway_name'],
'station_id' => $_SESSION['station_id'],
'gateway_id' => $_SESSION['gateway_id'],
]);
}
......
......@@ -72,6 +72,9 @@ class OnlineController extends Controller
if (isset($portsMacId[$portMac])) {
$portId = $portsMacId[$portMac];
if ($port->isPortBan() === true) {
continue;
}
$port->setPortId($portId);
$port->setStationId($_SESSION['station_id']);
$port->setGatewayId($_SESSION['gateway_id']);
......@@ -80,7 +83,7 @@ class OnlineController extends Controller
// 记录口子上线
$exceptionModel->insertRow([
'port_id' => $portId,
'port_id' => $portId,
'gateway_id' => isset($_SESSION['gateway_id']) ? $_SESSION['gateway_id'] : '',
'station_id' => isset($_SESSION['station_id']) ? $_SESSION['station_id'] : '',
'created_at' => date('Y-m-d H:i:s'),
......
......@@ -29,8 +29,8 @@ class StateController extends Controller
'0B' => [
'port_logic' => 1,
'mac' => 8,
'state' => 1,
'mac' => 8,
'state' => 1,
]
];
......@@ -68,7 +68,10 @@ class StateController extends Controller
$port = new Port($portId);
if ($port->isPortBan() === true) {
return;
}
$usingOrderId = $port->getPortUsingOrderId();
if ($usingOrderId == false || $usingOrderId == '') {
......@@ -83,6 +86,8 @@ class StateController extends Controller
$order = new Order((int)$usingOrderId);
$order->setIsChangeState(true);
if ($order->getOrderCache(\Events::getRedis()) == false) {
$port->setState($state);
......
......@@ -11,6 +11,7 @@ namespace Application\controller\card;
use Application\controller\Controller;
use Application\model\CardModel;
use Application\model\UserModel;
class BalanceController extends Controller
{
......@@ -18,7 +19,7 @@ class BalanceController extends Controller
'32' => [
'card_id' => 3
'card_id' => 4
]
];
......@@ -32,14 +33,17 @@ class BalanceController extends Controller
$cardModel = new CardModel();
$balance = $cardModel->getColumn('balance', 'card_number = ' . $cardId);
$userId = $cardModel->getColumn('user_id', 'card_number = ' . $cardId);
if (isset($userId)) {
$userModel = new UserModel();
$balance = $userModel->getColumn('balance', 'id = ' . $userId);
}
$balance = isset($balance) ? $balance : 0;
$balance = sprintf('%08x', $balance);
var_dump($balance);
$this->response->send('32', $cardId . $balance);
}
......
......@@ -37,12 +37,7 @@ class PayRuleController extends Controller
Gateway::closeClient($this->clientId);
}
Log::debug($_SESSION['station_id']);
$rule = $billingTmp->getColumn('context', 'id = ' . $_SESSION['station_id']);
Log::debug($rule);
if (isset($rule)) {
$rule = json_decode($rule, true);
......
......@@ -12,6 +12,7 @@ namespace Application\controller\card\charger;
use Application\controller\Controller;
use Application\model\CardModel;
use Application\model\OrderModel;
use Application\model\UserModel;
use Lib\cdz\order\Order;
use Lib\cdz\order\save\OrderSaveRedis;
use Lib\log\Log;
......@@ -22,11 +23,11 @@ class RequestController extends Controller
protected $parameterMap = [
'33' => [
'type' => 1,
'type' => 1,
'logic_id' => 1,
'card_id' => 3,
'time' => 2,
'price' => 2,
'card_id' => 4,
'time' => 2,
'price' => 2,
],
];
......@@ -61,14 +62,13 @@ class RequestController extends Controller
$cardModel = new CardModel();
$balance = $cardModel->getColumn('balance', 'card_number = ' . $cardId);
$userId = $cardModel->getColumn('user_id', 'card_number = ' . $cardId);
Log::debug($balance);
if (isset($balance) === false || $balance == '') {
return;
if (isset($userId)) {
$userModel = new UserModel();
$balance = $userModel->getColumn('balance', 'id = ' . $userId);
}
$balance = isset($balance) ? $balance : 0;
if ((int)$balance < (int)$price) {
$orderId = 0;
......@@ -84,15 +84,15 @@ class RequestController extends Controller
$orderModel = new OrderModel();
$outTradeNo = '3' . time() . $stationId . $portId . $gatewayId;
$orderModel->insertRow([
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'port_id' => $portId,
'gateway_id' => $gatewayId,
'station_id' => $stationId,
'port_id' => $portId,
'out_trade_no' => $outTradeNo,
'pay_amount' => $price,
'pay_amount' => $price,
'charger_time' => $time,
'created_at' => $date,
'logic_num' => $logicId,
'pay_type' => 3,
'created_at' => $date,
'logic_num' => $logicId,
'pay_type' => 3,
'station_name' => $stationName,
]);
$orderId = $orderModel->getColumn('id', 'out_trade_no = ' . $outTradeNo);
......
......@@ -62,7 +62,6 @@ class QueryController extends Controller
$hardwareVersion = $this->request->get('hardware_version');
$softwareVersion = $this->request->get('software_version');
$response = '';
Log::debug('session', Gateway::getSession($this->clientId));
$gatewayType = isset($_SESSION['gateway_type']) ? $_SESSION['gateway_type'] : false;
......@@ -74,14 +73,23 @@ class QueryController extends Controller
$gatewayUpdateModel = new GatewayUpdateModel();
$updateInfo = $gatewayUpdateModel->getColumns(['hardware_version', 'software_version', 'sign'], 'gateway_type = ' . $gatewayType);
if (count($updateInfo) !== 0) {
$returnCode = '10';
if ($gatewayType == 4 && $hardwareVersion == '01010201') {
$returnCode = '10';
} else if ($updateInfo == false) {
$returnCode = '10';
} else if (count($updateInfo) !== 0) {
$updateHardwareVersion = $updateInfo['hardware_version'];
$sign = $updateInfo['sign'];
// $updateSoftwareVersion = sprintf('%08x', $updateInfo['software_version']);
$updateSoftwareVersion = sprintf($updateInfo['software_version']);
if ($updateHardwareVersion == $hardwareVersion && $updateSoftwareVersion == $softwareVersion) {
if ($updateHardwareVersion === null || $updateSoftwareVersion === null) {
$returnCode = '10';
} else if ($updateHardwareVersion == $hardwareVersion && $updateSoftwareVersion == $softwareVersion) {
$returnCode = '10';
} else {
......@@ -93,7 +101,9 @@ class QueryController extends Controller
if ($host === false) {
throw new \Exception('can not find download host');
}
$downloadUrl = $host . '/update/' . $updateHardwareVersion . $updateSoftwareVersion . '.bin';
$downloadUrl = $host . '/gateway/' . $updateHardwareVersion . '_' . $updateSoftwareVersion . '.bin';
Log::debug($downloadUrl);
$urlHex = '';
for ($i = 0; $i < strlen($downloadUrl); $i++) {
......@@ -115,7 +125,7 @@ class QueryController extends Controller
$this->response->send('d1', $returnCode);
return;
}
$this->response->send('d1', '11');
$this->response->send('d1', $returnCode);
return;
......
......@@ -12,5 +12,5 @@ namespace Application\model;
class CardModel extends Model
{
protected $table = 'cards';
protected $table = 'unreal_cards';
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/11/14
* Time: 下午2:20
*/
namespace Application\model;
class UserModel extends Model
{
protected $table = 'wx_users';
}
\ No newline at end of file
......@@ -18,6 +18,8 @@ class Order
const ORDER_HASH_PREFIX = 'cdz:order:state:';
private $isChangeState = false;
/**
* @var int
*/
......@@ -650,5 +652,21 @@ class Order
$this->cardId = $cardId;
}
/**
* @return bool
*/
public function isChangeState(): bool
{
return $this->isChangeState;
}
/**
* @param bool $isChangeState
*/
public function setIsChangeState(bool $isChangeState): void
{
$this->isChangeState = $isChangeState;
}
}
\ No newline at end of file
......@@ -45,8 +45,6 @@ class OrderSaveRedis
}
}
Log::debug('update', $update);
$this->redis->hMset($this->order->getCacheKeyName(), $update);
$this->redis->expire($this->order->getCacheKeyName(), 60 * 60 * 24);
......
......@@ -107,7 +107,11 @@ class WaitingState extends State
$this->order->setStateCode(12);
\Events::pipe();
$orderSaveRedis = new OrderSaveRedis($this->order);
$orderSaveRedis->save(['stateCode', 'startTime', 'startCapacity']);
if ($this->order->isChangeState() === false) {
$orderSaveRedis->save(['stateCode', 'startTime', 'startCapacity']);
} else {
$orderSaveRedis->save(['stateCode', 'startTime']);
}
//更新口子状态
$port = new Port();
......@@ -137,11 +141,12 @@ class WaitingState extends State
'start_time' => date('Y-m-d H:i:s', $this->order->getStartTime()),
];
//更新订单状态
if ($this->order->getStartCapacity() !== -2) {
$startCapacity = $this->order->getStartCapacity();
if ($startCapacity !== -2 && $startCapacity > 0) {
$update['start_capacity'] = (int)$this->order->getStartCapacity();
}
$orderModel = new OrderModel();
Log::debug('update_order_state -> ' . $this->order->getId(), $update);
$orderModel->update($update, 'id = ' . $this->order->getId());
......@@ -168,7 +173,8 @@ class WaitingState extends State
$orderModel = new OrderModel();
$orderModel->update([
'is_charger' => StateCode::PORT_EXCEPTION,
'is_charger' => StateCode::PORT_EXCEPTION,
'start_capacity' => $this->order->getStartCapacity(),
], 'id = ' . $this->order->getId());
//添加订单异常
......@@ -227,22 +233,25 @@ class WaitingState extends State
public function toShedState()
{
$this->order->setStateCode(-1);
$orderModel = new OrderModel();
$orderSave = new OrderSaveRedis($this->order);
Log::debug('waiting to shed ->start_capacity' . $this->order->getStartCapacity());
$orderSave->save(['stateCode']);
$orderSave->deleteHashKey(['startTime', 'startCapacity']);
if ($this->order->getStartCapacity() >= 0) {
$orderModel->update([
'start_capacity' => (int)$this->order->getStartCapacity(),
], 'id = ' . $this->order->getId());
$orderModel = new OrderModel();
}
Log::debug('update shed start_capacity' . $this->order->getId());
Log::debug('waiting to shed' . $this->order->getStartCapacity());
$this->order->setStateCode(-1);
$orderModel->update([
'start_capacity' => (int)$this->order->getStartCapacity(),
], 'id = ' . $this->order->getId());
$orderSave = new OrderSaveRedis($this->order);
$orderSave->save(['stateCode']);
// $orderSave->deleteHashKey(['startTime', 'startCapacity']);
Log::debug('update shed start_capacity' . $this->order->getId());
}
......
......@@ -9,7 +9,6 @@
namespace Lib\log;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
......
......@@ -73,6 +73,22 @@ class Port
}
public function isPortBan()
{
if (isset($_SESSION['port_id_status'])) {
$portIdStatus = $_SESSION['port_id_status'];
if (isset($portIdStatus[$this->portId])) {
if ($portIdStatus[$this->portId] === 8) {
return true;
}
}
}
return false;
}
/**
* 更新端口状态
* @param int $orderId
......@@ -98,7 +114,7 @@ class Port
$portModel = new DeviceModel();
$portModel->update([
'state' => $this->state,
'state' => $this->state,
'updated_at' => date('Y-m-d H:i:s')
], 'id = ' . $this->portId);
......
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