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
fc3261c9
Commit
fc3261c9
authored
Nov 30, 2018
by
yangsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改13异常,agent推送data问题
parent
a4647a89
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
104 deletions
+12
-104
.idea/workspace.xml
+0
-0
.staging
+2
-2
application/controller/accept/AccessController.php
+0
-90
lib/cdz/order/state/ChargerState.php
+4
-0
lib/cdz/order/state/OfflineNetState.php
+0
-8
lib/cdz/order/state/ShedState.php
+3
-0
lib/cdz/order/state/WaitingState.php
+3
-4
No files found.
.idea/workspace.xml
View file @
fc3261c9
This diff is collapsed.
Click to expand it.
.staging
View file @
fc3261c9
REDIS_HOST=redis.staging.senthink.com
REDIS_HOST=redis.staging.senthink.com
REGISTER_IP=100.1
09.192.7
REGISTER_IP=100.1
19.192.19
REGISTER_PORT=1239
REGISTER_PORT=1239
GATEWAY_PORT=8282
GATEWAY_PORT=8282
GATEWAY_IP=1
27.0.0.1
GATEWAY_IP=1
00.119.192.36
GATEWAY_COUNT=4
GATEWAY_COUNT=4
GATEWAY_START_PORT=1230
GATEWAY_START_PORT=1230
START_FILE=business
START_FILE=business
...
...
application/controller/accept/AccessController.php
View file @
fc3261c9
...
@@ -50,96 +50,6 @@ class AccessController extends Controller
...
@@ -50,96 +50,6 @@ 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',
// '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;
//
// }
// }
/**
/**
* 请求入网
* 请求入网
* 网关下的所有端口id和mac写如session
* 网关下的所有端口id和mac写如session
...
...
lib/cdz/order/state/ChargerState.php
View file @
fc3261c9
...
@@ -49,6 +49,7 @@ class ChargerState extends State
...
@@ -49,6 +49,7 @@ class ChargerState extends State
'updated_at'
=>
$this
->
nowDate
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
$port
=
new
Port
();
...
@@ -129,6 +130,7 @@ class ChargerState extends State
...
@@ -129,6 +130,7 @@ class ChargerState extends State
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
=
new
OrderExceptionModel
();
...
@@ -196,6 +198,7 @@ class ChargerState extends State
...
@@ -196,6 +198,7 @@ class ChargerState extends State
'end_time'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'state'
=>
1
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
=
new
OrderExceptionModel
();
...
@@ -260,6 +263,7 @@ class ChargerState extends State
...
@@ -260,6 +263,7 @@ class ChargerState extends State
$orderModel
->
update
([
$orderModel
->
update
([
'updated_at'
=>
$this
->
nowDate
,
'updated_at'
=>
$this
->
nowDate
,
'shed_time'
=>
$this
->
nowDate
,
'shed_time'
=>
$this
->
nowDate
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
=
new
OrderExceptionModel
();
...
...
lib/cdz/order/state/OfflineNetState.php
View file @
fc3261c9
...
@@ -39,18 +39,10 @@ class OfflineNetState extends State
...
@@ -39,18 +39,10 @@ class OfflineNetState extends State
$stateCode
=
$this
->
order
->
getStateCode
();
$stateCode
=
$this
->
order
->
getStateCode
();
if
(
$startTime
===
''
)
{
if
(
$startTime
===
''
)
{
Log
::
debug
(
'time equal purchase time'
);
$this
->
remainChargerTime
=
(
int
)(
$this
->
order
->
getPurchaseTime
());
$this
->
remainChargerTime
=
(
int
)(
$this
->
order
->
getPurchaseTime
());
}
else
{
}
else
{
$purchaseTime
=
$this
->
order
->
getPurchaseTime
();
$purchaseTime
=
$this
->
order
->
getPurchaseTime
();
$this
->
remainChargerTime
=
$purchaseTime
*
60
-
((
int
)
$this
->
order
->
getOnlineTime
()
-
$startTime
);
$this
->
remainChargerTime
=
$purchaseTime
*
60
-
((
int
)
$this
->
order
->
getOnlineTime
()
-
$startTime
);
Log
::
debug
(
'off net'
);
Log
::
debug
(
$this
->
order
->
getOnlineTime
());
Log
::
debug
(
$startTime
.
'start_time'
);
Log
::
debug
(
'remain charger time'
.
$this
->
remainChargerTime
);
Log
::
debug
(
'remain time'
.
ceil
(
$this
->
remainChargerTime
/
60
));
$this
->
remainChargerTime
=
ceil
(
$this
->
remainChargerTime
/
60
);
$this
->
remainChargerTime
=
ceil
(
$this
->
remainChargerTime
/
60
);
...
...
lib/cdz/order/state/ShedState.php
View file @
fc3261c9
...
@@ -41,6 +41,7 @@ class ShedState extends State
...
@@ -41,6 +41,7 @@ class ShedState extends State
'updated_at'
=>
$this
->
nowDate
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
$port
=
new
Port
();
...
@@ -181,9 +182,11 @@ class ShedState extends State
...
@@ -181,9 +182,11 @@ class ShedState extends State
'end_time'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
(
$this
->
order
->
getPortId
());
$port
=
new
Port
(
$this
->
order
->
getPortId
());
$port
->
setState
(
StateCode
::
PORT_ONLINE
);
$port
->
setState
(
StateCode
::
PORT_ONLINE
);
$port
->
setStationId
(
$this
->
order
->
getStationId
());
$port
->
setStationId
(
$this
->
order
->
getStationId
());
...
...
lib/cdz/order/state/WaitingState.php
View file @
fc3261c9
...
@@ -59,6 +59,7 @@ class WaitingState extends State
...
@@ -59,6 +59,7 @@ class WaitingState extends State
'is_stop'
=>
StateCode
::
FINISH_REFUND
,
'is_stop'
=>
StateCode
::
FINISH_REFUND
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
date
(
'Y-m-d H:i:s'
),
'end_time'
=>
date
(
'Y-m-d H:i:s'
),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
$port
=
new
Port
();
...
@@ -175,6 +176,7 @@ class WaitingState extends State
...
@@ -175,6 +176,7 @@ class WaitingState extends State
$orderModel
->
update
([
$orderModel
->
update
([
'is_charger'
=>
StateCode
::
PORT_EXCEPTION
,
'is_charger'
=>
StateCode
::
PORT_EXCEPTION
,
'start_capacity'
=>
$this
->
order
->
getStartCapacity
(),
'start_capacity'
=>
$this
->
order
->
getStartCapacity
(),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
],
'id = '
.
$this
->
order
->
getId
());
//添加订单异常
//添加订单异常
...
@@ -208,10 +210,7 @@ class WaitingState extends State
...
@@ -208,10 +210,7 @@ class WaitingState extends State
$port
->
updatePortState
(
$this
->
order
->
getId
());
$port
->
updatePortState
(
$this
->
order
->
getId
());
$broadcastToAgent
=
new
BroadcastToAgent
();
$broadcastToAgent
=
new
BroadcastToAgent
();
$broadcastToAgent
->
broadcast
([
$broadcastToAgent
->
broadcast
(
$this
->
order
->
getOrderCache
(
\Events
::
getRedis
())
+
[
'notice_exception_code'
=>
StateCode
::
PORT_EXCEPTION
]);
'data'
=>
$this
->
order
->
getOrderCache
(
\Events
::
getRedis
()),
'notice_exception_code'
=>
StateCode
::
PORT_EXCEPTION
,
]);
// TODO: Implement toExceptionState() method.
// TODO: Implement toExceptionState() method.
}
}
...
...
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