Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdz_gateway_v2
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_v2
Commits
840b5072
Commit
840b5072
authored
Sep 14, 2018
by
banice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
口子状态改变验证逻辑号,充电结束验证逻辑号
parent
f3957f24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
16 deletions
+22
-16
.idea/workspace.xml
+0
-0
application/controller/business/charger/OverController.php
+5
-0
application/controller/business/charger/StartController.php
+0
-2
application/controller/business/port/StateController.php
+16
-13
lib/cdz/order/state/WaitingState.php
+1
-1
No files found.
.idea/workspace.xml
View file @
840b5072
This diff is collapsed.
Click to expand it.
application/controller/business/charger/OverController.php
View file @
840b5072
...
...
@@ -67,6 +67,10 @@ 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
(
Gateway
::
isUidOnline
(
$order
->
getUserId
())
===
1
)
{
...
...
@@ -152,6 +156,7 @@ class OverController extends Controller
]);
$this
->
logRecord
->
setDesc
(
'更换口子,'
.
$portId
.
'关闭成功'
);
}
$this
->
response
->
send
(
'15'
,
sprintf
(
'%02x'
,
$logicId
)
.
sprintf
(
'%012x'
,
$orderId
));
...
...
application/controller/business/charger/StartController.php
View file @
840b5072
...
...
@@ -73,8 +73,6 @@ class StartController extends Controller
if
(
isset
(
$_SESSION
[
'agent_id'
]))
{
Log
::
debug
(
'agent_id'
.
$_SESSION
[
'agent_id'
]);
Log
::
debug
(
Gateway
::
isUidOnline
(
$_SESSION
[
'agent_id'
]));
if
(
Gateway
::
isUidOnline
(
$_SESSION
[
'agent_id'
]))
{
$clientsId
=
Gateway
::
getClientIdByUid
(
$_SESSION
[
'agent_id'
]);
$clientId
=
$clientsId
[
0
];
...
...
application/controller/business/port/StateController.php
View file @
840b5072
...
...
@@ -39,15 +39,18 @@ class StateController extends Controller
parent
::
__construct
(
$clientId
,
$message
,
$command
);
}
/**
* 改变口子的状态
*/
public
function
change
()
{
$portLogic
=
$this
->
request
->
get
(
'port_logic'
);
$portLogic
=
hexdec
(
$this
->
request
->
get
(
'port_logic'
)
);
$mac
=
$this
->
request
->
get
(
'mac'
);
$state
=
hexdec
(
$this
->
request
->
get
(
'state'
));
if
(
isset
(
$_SESSION
[
'port_mac_id'
])
!==
true
)
{
$deviceModel
=
new
DeviceModel
();
$portId
=
$deviceModel
->
getColumn
(
'id'
,
'mac = '
.
$mac
);
$portId
=
$deviceModel
->
getColumn
(
'id'
,
'
device_
mac = '
.
$mac
);
if
(
isset
(
$portId
)
===
false
||
$portId
==
''
)
{
return
;
...
...
@@ -69,15 +72,9 @@ class StateController extends Controller
$usingOrderId
=
$port
->
getPortUsingOrderId
();
if
(
$usingOrderId
==
false
||
$usingOrderId
==
''
)
{
$port
->
setState
(
$state
);
if
(
isset
(
$_SESSION
[
'gateway_id'
])
&&
isset
(
$_SESSION
[
'station_id'
]))
{
$port
->
setGatewayId
(
$_SESSION
[
'gateway_id'
]);
$port
->
setStationId
(
$_SESSION
[
'station_id'
]);
$port
->
updatePortState
();
}
else
{
Log
::
error
(
'can not find station_id or gateway_id from session (change state)'
);
}
}
else
{
...
...
@@ -87,16 +84,22 @@ class StateController extends Controller
$order
=
new
Order
((
int
)
$usingOrderId
);
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
==
false
)
{
$port
->
setState
(
$state
);
$port
->
updatePortState
();
return
;
}
// if (Gateway::isUidOnline($order->getUserId()) === 1) {
// Gateway::sendToUid($order->getUserId(), json_encode(['code' => 10000]));
// }
Log
::
debug
(
'order last state '
.
$order
->
getStateCode
());
if
(
$order
->
getPortLogicId
()
!=
$portLogic
)
{
return
;
}
if
(
Gateway
::
isUidOnline
(
$order
->
getUserId
())
===
1
)
{
Gateway
::
sendToUid
(
$order
->
getUserId
(),
json_encode
([
'code'
=>
10000
]));
}
switch
(
$order
->
getStateCode
())
{
case
StateCode
::
PORT_CHARGER
:
...
...
lib/cdz/order/state/WaitingState.php
View file @
840b5072
...
...
@@ -194,7 +194,7 @@ class WaitingState extends State
$port
->
setState
(
StateCode
::
PORT_EXCEPTION
);
$port
->
setStationId
(
$this
->
order
->
getStationId
());
$port
->
setGatewayId
(
$this
->
order
->
getGatewayId
());
$port
->
freePort
(
$this
->
order
->
getId
());
$port
->
updatePortState
(
$this
->
order
->
getId
());
$broadcastToAgent
=
new
BroadcastToAgent
();
...
...
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