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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
132 deletions
+40
-132
.idea/workspace.xml
+0
-0
.staging
+2
-2
application/controller/accept/AccessController.php
+0
-90
lib/cdz/order/state/ChargerState.php
+6
-2
lib/cdz/order/state/OfflineNetState.php
+0
-8
lib/cdz/order/state/ShedState.php
+29
-26
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
REGISTER_IP=100.1
09.192.7
REGISTER_IP=100.1
19.192.19
REGISTER_PORT=1239
GATEWAY_PORT=8282
GATEWAY_IP=1
27.0.0.1
GATEWAY_IP=1
00.119.192.36
GATEWAY_COUNT=4
GATEWAY_START_PORT=1230
START_FILE=business
...
...
application/controller/accept/AccessController.php
View file @
fc3261c9
...
...
@@ -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
...
...
lib/cdz/order/state/ChargerState.php
View file @
fc3261c9
...
...
@@ -49,6 +49,7 @@ class ChargerState extends State
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
...
...
@@ -129,6 +130,7 @@ class ChargerState extends State
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
...
...
@@ -196,6 +198,7 @@ class ChargerState extends State
'end_time'
=>
$this
->
nowDate
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
...
...
@@ -258,8 +261,9 @@ class ChargerState extends State
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'updated_at'
=>
$this
->
nowDate
,
'shed_time'
=>
$this
->
nowDate
,
'updated_at'
=>
$this
->
nowDate
,
'shed_time'
=>
$this
->
nowDate
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderExceptionModel
=
new
OrderExceptionModel
();
...
...
lib/cdz/order/state/OfflineNetState.php
View file @
fc3261c9
...
...
@@ -39,18 +39,10 @@ class OfflineNetState extends State
$stateCode
=
$this
->
order
->
getStateCode
();
if
(
$startTime
===
''
)
{
Log
::
debug
(
'time equal purchase time'
);
$this
->
remainChargerTime
=
(
int
)(
$this
->
order
->
getPurchaseTime
());
}
else
{
$purchaseTime
=
$this
->
order
->
getPurchaseTime
();
$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
);
...
...
lib/cdz/order/state/ShedState.php
View file @
fc3261c9
...
...
@@ -36,11 +36,12 @@ class ShedState extends State
{
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
order
->
getEndCode
(),
'is_stop'
=>
$this
->
order
->
getEndCode
(),
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
...
...
@@ -70,9 +71,9 @@ class ShedState extends State
$orderException
=
new
OrderExceptionModel
();
$orderException
->
insertRow
([
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_USER
,
'desc'
=>
'用户主动结束充电'
,
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_USER
,
'desc'
=>
'用户主动结束充电'
,
'created_at'
=>
$this
->
nowDate
,
]);
...
...
@@ -123,10 +124,10 @@ class ShedState extends State
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
->
insertRow
(
[
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
PORT_CHARGER
,
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
PORT_CHARGER
,
'created_at'
=>
$this
->
nowDate
,
'desc'
=>
'订单口子脱落重新插上'
,
'desc'
=>
'订单口子脱落重新插上'
,
]
);
...
...
@@ -168,22 +169,24 @@ class ShedState extends State
{
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
->
insertRow
([
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_SHED_TIMEOUT
,
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_SHED_TIMEOUT
,
'created_at'
=>
$this
->
nowDate
,
'desc'
=>
'订单口子脱落超时结束'
,
'desc'
=>
'订单口子脱落超时结束'
,
]);
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'state'
=>
1
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'state'
=>
1
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
(
$this
->
order
->
getPortId
());
$port
->
setState
(
StateCode
::
PORT_ONLINE
);
$port
->
setStationId
(
$this
->
order
->
getStationId
());
...
...
@@ -205,9 +208,9 @@ class ShedState extends State
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'is_stop'
=>
StateCode
::
FINISH_SHED_TIMEOUT
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'state'
=>
1
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
...
...
@@ -224,19 +227,19 @@ class ShedState extends State
{
$orderExceptionModel
=
new
OrderExceptionModel
();
$orderExceptionModel
->
insertRow
([
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_TIME_END
,
'order_id'
=>
$this
->
order
->
getId
(),
'state'
=>
StateCode
::
PORT_SHED
.
StateCode
::
FINISH_TIME_END
,
'created_at'
=>
$this
->
nowDate
,
'desc'
=>
'订单充电时间结束'
,
'desc'
=>
'订单充电时间结束'
,
]);
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
StateCode
::
FINISH_TIME_END
,
'is_stop'
=>
StateCode
::
FINISH_TIME_END
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'state'
=>
1
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
'state'
=>
1
,
'updated_at'
=>
$this
->
nowDate
,
'end_time'
=>
$this
->
nowDate
,
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
(
$this
->
order
->
getPortId
());
...
...
lib/cdz/order/state/WaitingState.php
View file @
fc3261c9
...
...
@@ -59,6 +59,7 @@ class WaitingState extends State
'is_stop'
=>
StateCode
::
FINISH_REFUND
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
date
(
'Y-m-d H:i:s'
),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$port
=
new
Port
();
...
...
@@ -175,6 +176,7 @@ class WaitingState extends State
$orderModel
->
update
([
'is_charger'
=>
StateCode
::
PORT_EXCEPTION
,
'start_capacity'
=>
$this
->
order
->
getStartCapacity
(),
'is_exception'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
//添加订单异常
...
...
@@ -208,10 +210,7 @@ class WaitingState extends State
$port
->
updatePortState
(
$this
->
order
->
getId
());
$broadcastToAgent
=
new
BroadcastToAgent
();
$broadcastToAgent
->
broadcast
([
'data'
=>
$this
->
order
->
getOrderCache
(
\Events
::
getRedis
()),
'notice_exception_code'
=>
StateCode
::
PORT_EXCEPTION
,
]);
$broadcastToAgent
->
broadcast
(
$this
->
order
->
getOrderCache
(
\Events
::
getRedis
())
+
[
'notice_exception_code'
=>
StateCode
::
PORT_EXCEPTION
]);
// 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