Commit 19488bd7 by BANice

测试前

parent 3e0246fa
......@@ -128,11 +128,10 @@ class PortController extends Controller
}
foreach ($offlinePortId as $portId)
{
foreach ($offlinePortId as $portId) {
$exceptionModel = new ExceptionModel();
$exceptionModel->insertRow(['message' => '口子离线','port_id' => $portId,'type' => 1,'created_at' => date('Y-m-d H:i:s'),'station_id' => $_SESSION['station_id']]);
$exceptionModel->insertRow(['message' => '口子离线', 'port_id' => $portId, 'type' => 1, 'created_at' => date('Y-m-d H:i:s'), 'station_id' => $_SESSION['station_id']]);
unset($exceptionModel);
......@@ -201,7 +200,7 @@ class PortController extends Controller
$userId = $port->getPortUsingId(\Events::getRedis(), $portId);
$orderId = $port->getPortUsingOrderId(\Events::getRedis(),$portId);
$orderId = $port->getPortUsingOrderId(\Events::getRedis(), $portId);
//服务器下发充电命令给下位机并将口子状态设置为-1,如果口子未插上下位机返回14,这种情况下口子依然被视为等待充电不改变状态,保持-1,但需要推送消息
......@@ -232,11 +231,18 @@ class PortController extends Controller
$exceptionModel = new ExceptionModel();
//fixme 为满足将订单充电的异常写入exception表中
if($state === StateCode::PORT_EXCEPTION || $state === StateCode::PORT_SHED) {
if ($state === StateCode::PORT_EXCEPTION || $state === StateCode::PORT_SHED) {
$message = [StateCode::PORT_EXCEPTION => '功率超限',StateCode::PORT_SHED => '插口脱落'];
$message = [StateCode::PORT_EXCEPTION => '功率超限', StateCode::PORT_SHED => '插口脱落'];
try {
$exceptionModel->insertRow(['type' => 2, 'message' => '订单号:' . $orderId . "($message[$state])", 'created_at' => date('Y-m-d H:i:s'), 'station_id' => $_SESSION['station_id'], 'gateway_id' => $_SESSION['gateway_id']]);
} catch (\Exception $exception) {
Log::error($exception->getMessage());
}
$exceptionModel->insertRow(['type' => 2, 'message' => '订单号:'.$orderId."($message[$state])", 'created_at' => date('Y-m-d H:i:s')]);
}
if ($state !== StateCode::PORT_CHARGER) {
......@@ -256,16 +262,14 @@ class PortController extends Controller
switch ($state) {
case StateCode::PORT_CHARGER:
if($lastState ==14 )
{
if ($lastState == 14) {
$orderModel = new OrderModel();
$result = $orderModel->getColumns(['port_name','station_name','created_at','charger_time','order_amount'],'id = '.$orderId);
$result = $orderModel->getColumns(['port_name', 'station_name', 'created_at', 'charger_time', 'order_amount'], 'id = ' . $orderId);
if(count($result) !== 0)
{
if (count($result) !== 0) {
try {
......@@ -282,19 +286,17 @@ class PortController extends Controller
$push = new Push();
$push->push($chargerStartMessage, $userId);
}catch (\Exception $exception)
{
} catch (\Exception $exception) {
Log::error($exception->getMessage());
}
}else{
} else {
Log::error('订单插头断开后开始充电未找到订单',['order_id' => $orderId]);
Log::error('订单插头断开后开始充电未找到订单', ['order_id' => $orderId]);
}
}
break;
......@@ -355,7 +357,7 @@ class PortController extends Controller
$exceptionModel = new ExceptionModel();
$exceptionModel->insertRow(['type' => 1,'message' => '口子离线','port_id' => $portId,'created_at' => date('Y-m-d H:i:s'),'station_id' => $_SESSION['station_id']]);
$exceptionModel->insertRow(['type' => 1, 'message' => '口子离线', 'port_id' => $portId, 'created_at' => date('Y-m-d H:i:s'), 'station_id' => $_SESSION['station_id']]);
$port->offline([$portId]);
......
......@@ -216,6 +216,7 @@ class Events
$gatewayId = $_SESSION['gateway_id'];
$insert = ['message' => '网关离线', 'gateway_id' => $gatewayId, 'type' => 1,'created_at' => date('Y-m-d H:i:s')];
if(isset($_SESSION['station_id']))
......
......@@ -21,7 +21,9 @@ class Api
public static function boot()
{
static::add('00','HeartController@heart',[new AuthMiddleware(),new HasMacMiddleware()]);
// static::add('00','HeartController@heart',[new AuthMiddleware(),new HasMacMiddleware()]);
static::add('00','HeartController@heart');
static::add('01','CertifyController@certify');
......
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