Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdz_gateway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨苏杭
cdz_gateway
Commits
19488bd7
Commit
19488bd7
authored
Jun 29, 2018
by
BANice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试前
parent
3e0246fa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
19 deletions
+24
-19
.idea/workspace.xml
+0
-0
Application/Controller/PortController.php
+20
-18
Application/Events.php
+1
-0
Route/Api.php
+3
-1
No files found.
.idea/workspace.xml
View file @
19488bd7
This diff is collapsed.
Click to expand it.
Application/Controller/PortController.php
View file @
19488bd7
...
...
@@ -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
]);
...
...
Application/Events.php
View file @
19488bd7
...
...
@@ -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'
]))
...
...
Route/Api.php
View file @
19488bd7
...
...
@@ -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'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment