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
f3957f24
Commit
f3957f24
authored
Sep 11, 2018
by
banice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:逻辑号错误的问题,更换口子后的第二次开始充电脱落则将order改为waiting
parent
dde7700a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
164 additions
and
42 deletions
+164
-42
.idea/php.xml
+6
-6
.idea/workspace.xml
+0
-0
.staging
+2
-2
application/controller/accept/AccessController.php
+13
-7
application/controller/business/charger/StartController.php
+27
-9
application/controller/business/port/StateController.php
+17
-4
application/controller/business/power/PowerController.php
+8
-3
application/controller/setting/DeviceMacController.php
+53
-0
application/route/Api.php
+3
-0
application/start_businessworker.php
+4
-4
lib/Aes.php
+8
-6
lib/cdz/order/save/OrderSaveRedis.php
+14
-0
lib/cdz/order/state/ChargerState.php
+1
-0
lib/cdz/order/state/WaitingState.php
+7
-0
lib/log/Log.php
+1
-1
No files found.
.idea/php.xml
View file @
f3957f24
...
@@ -2,16 +2,16 @@
...
@@ -2,16 +2,16 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"PhpIncludePathManager"
>
<component
name=
"PhpIncludePathManager"
>
<include_path>
<include_path>
<path
value=
"$PROJECT_DIR$/vendor/psr/log"
/>
<path
value=
"$PROJECT_DIR$/vendor/psr/http-message"
/>
<path
value=
"$PROJECT_DIR$/vendor/psr/http-message"
/>
<path
value=
"$PROJECT_DIR$/vendor/guzzlehttp/psr7"
/>
<path
value=
"$PROJECT_DIR$/vendor/guzzlehttp/guzzle"
/>
<path
value=
"$PROJECT_DIR$/vendor/composer"
/>
<path
value=
"$PROJECT_DIR$/vendor/vlucas/phpdotenv"
/>
<path
value=
"$PROJECT_DIR$/vendor/vlucas/phpdotenv"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/workerman"
/>
<path
value=
"$PROJECT_DIR$/vendor/monolog/monolog"
/>
<path
value=
"$PROJECT_DIR$/vendor/composer"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/mysql"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/mysql"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/workerman"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/gateway-worker"
/>
<path
value=
"$PROJECT_DIR$/vendor/workerman/gateway-worker"
/>
<path
value=
"$PROJECT_DIR$/vendor/
psr/log
"
/>
<path
value=
"$PROJECT_DIR$/vendor/
guzzlehttp/psr7
"
/>
<path
value=
"$PROJECT_DIR$/vendor/
monolog/monolog
"
/>
<path
value=
"$PROJECT_DIR$/vendor/
guzzlehttp/guzzle
"
/>
<path
value=
"$PROJECT_DIR$/vendor/guzzlehttp/promises"
/>
<path
value=
"$PROJECT_DIR$/vendor/guzzlehttp/promises"
/>
</include_path>
</include_path>
</component>
</component>
...
...
.idea/workspace.xml
View file @
f3957f24
This diff is collapsed.
Click to expand it.
.staging
View file @
f3957f24
...
@@ -22,13 +22,13 @@ RABBIT_VHOST=cdz_gateway
...
@@ -22,13 +22,13 @@ RABBIT_VHOST=cdz_gateway
REDIS_PORT=6379
REDIS_PORT=6379
LOG_LEVEL=debug
LOG_LEVEL=debug
MESSAGE_API_URL=https://cdzback2.staging.senthink.com
MESSAGE_API_URL=https://cdzback2.staging.senthink.com
MESSAGE_START=W-MxqrGTUD9K3FiP5WsZv
OO
am5LZdeCmFq7TqrZwoM4
MESSAGE_START=W-MxqrGTUD9K3FiP5WsZv
oo
am5LZdeCmFq7TqrZwoM4
MESSAGE_FAIL=b9Q6ZeQ6qDpuxymHcvlh0tX1GFV1Pzc_o0DOLIsnRNg
MESSAGE_FAIL=b9Q6ZeQ6qDpuxymHcvlh0tX1GFV1Pzc_o0DOLIsnRNg
MESSAGE_POWER_EXCEED=euUQrXFejUeyyxJbfaZQaRQfnXSqi05XMFLNfIsC0vA
MESSAGE_POWER_EXCEED=euUQrXFejUeyyxJbfaZQaRQfnXSqi05XMFLNfIsC0vA
MESSAGE_FINISH_USER=mHD4sJPOYpYLcqWhQnRpJ-PQ99i_69tEZCK_w0NCI_c
MESSAGE_FINISH_USER=mHD4sJPOYpYLcqWhQnRpJ-PQ99i_69tEZCK_w0NCI_c
MESSAGE_PORT_SHED=C0LvfETe-1rCR_IhOydDGPTUwwYkrWZxgfwMsETrhw8
MESSAGE_PORT_SHED=C0LvfETe-1rCR_IhOydDGPTUwwYkrWZxgfwMsETrhw8
MESSAGE_CHARGER_TIMEOUT=mHD4sJPOYpYLcqWhQnRpJ-PQ99i_69tEZCK_w0NCI_c
MESSAGE_CHARGER_TIMEOUT=mHD4sJPOYpYLcqWhQnRpJ-PQ99i_69tEZCK_w0NCI_c
MESSAGE_RELOAD=sCtztz8xYzsgR1IpZ5GohMuG9DScY5
00
cI4VVEEwtg8
MESSAGE_RELOAD=sCtztz8xYzsgR1IpZ5GohMuG9DScY5
OO
cI4VVEEwtg8
MESSAGE_SHED_TIMEOUT=euUQrXFejUeyyxJbfaZQaRQfnXSqi05XMFLNfIsC0vA
MESSAGE_SHED_TIMEOUT=euUQrXFejUeyyxJbfaZQaRQfnXSqi05XMFLNfIsC0vA
MESSAGE_CHARGER_SHED=MZH_wTlwMq1_GguqIRnldSbHEuyFZcqmC3Wtk7ylMD0
MESSAGE_CHARGER_SHED=MZH_wTlwMq1_GguqIRnldSbHEuyFZcqmC3Wtk7ylMD0
LOW_POWER_LIMIT=30
LOW_POWER_LIMIT=30
...
...
application/controller/accept/AccessController.php
View file @
f3957f24
...
@@ -81,6 +81,8 @@ class AccessController extends Controller
...
@@ -81,6 +81,8 @@ class AccessController extends Controller
$_SESSION
[
'gateway_name'
]
=
$gatewayModelResult
[
'name'
];
$_SESSION
[
'gateway_name'
]
=
$gatewayModelResult
[
'name'
];
$_SESSION
[
'gateway_id'
]
=
$gatewayModelResult
[
'id'
];
//日志记录
//日志记录
$this
->
logRecord
->
setGatewayId
(
$gatewayId
);
$this
->
logRecord
->
setGatewayId
(
$gatewayId
);
...
@@ -171,16 +173,16 @@ class AccessController extends Controller
...
@@ -171,16 +173,16 @@ class AccessController extends Controller
$portMacState
=
[];
$portMacState
=
[];
if
(
strlen
(
$this
->
message
)
<
(
12
*
2
+
9
*
2
*
$count
))
{
return
;
}
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$mac
=
substr
(
$this
->
message
,
$this
->
plc
,
8
*
2
);
$mac
=
substr
(
$this
->
message
,
$this
->
plc
,
8
*
2
);
$state
=
substr
(
$this
->
message
,
$this
->
plc
+
(
$count
*
16
-
16
*
$i
+
$i
*
2
),
2
);
$state
=
substr
(
$this
->
message
,
$this
->
plc
+
(
$count
*
16
-
16
*
$i
+
$i
*
2
),
2
);
$this
->
plc
+=
16
;
$this
->
plc
+=
16
;
$portMacState
[
$mac
]
=
hexdec
(
$state
);
$portMacState
[
$mac
]
=
hexdec
(
$state
);
// $portMacState[$mac] = StateCode::PORT_OFFLINE;
}
}
if
(
isset
(
$_SESSION
[
'port_mac_id'
])
==
false
)
{
if
(
isset
(
$_SESSION
[
'port_mac_id'
])
==
false
)
{
...
@@ -219,7 +221,7 @@ class AccessController extends Controller
...
@@ -219,7 +221,7 @@ class AccessController extends Controller
$port
->
setStationId
(
$_SESSION
[
'station_id'
]);
$port
->
setStationId
(
$_SESSION
[
'station_id'
]);
$port
->
updatePortState
();
$port
->
updatePortState
();
$portsLogicId
[
$logicStartTmp
]
=
$portId
;
$portsLogicId
[
$logicStartTmp
++
]
=
$portId
;
}
}
\Events
::
exec
();
\Events
::
exec
();
...
@@ -261,8 +263,6 @@ class AccessController extends Controller
...
@@ -261,8 +263,6 @@ class AccessController extends Controller
$order
->
setOnlineTime
(
time
());
$order
->
setOnlineTime
(
time
());
if
(
$offlineReason
==
1
)
{
if
(
$offlineReason
==
1
)
{
$orderState
=
new
OfflinePowerState
(
$order
);
}
else
{
}
else
{
$orderState
=
new
OfflineNetState
(
$order
);
$orderState
=
new
OfflineNetState
(
$order
);
...
@@ -277,6 +277,12 @@ class AccessController extends Controller
...
@@ -277,6 +277,12 @@ class AccessController extends Controller
array_push
(
$responseOrder
,
$logicNum
.
$orderId
.
$time
);
array_push
(
$responseOrder
,
$logicNum
.
$orderId
.
$time
);
}
}
$port
->
setPortId
(
$portId
);
$port
->
setGatewayId
(
$_SESSION
[
'gateway_id'
]);
$port
->
setStationId
(
$_SESSION
[
'station_id'
]);
$port
->
setState
(
StateCode
::
PORT_CHARGER
);
$port
->
updatePortState
();
unset
(
$order
);
unset
(
$order
);
...
...
application/controller/business/charger/StartController.php
View file @
f3957f24
...
@@ -11,6 +11,7 @@ namespace Application\controller\business\charger;
...
@@ -11,6 +11,7 @@ namespace Application\controller\business\charger;
use
Application\controller\Controller
;
use
Application\controller\Controller
;
use
Lib\cdz\order\Order
;
use
Lib\cdz\order\Order
;
use
Lib\cdz\order\state\ChargerState
;
use
Lib\cdz\order\state\WaitingState
;
use
Lib\cdz\order\state\WaitingState
;
use
Lib\Gateway
;
use
Lib\Gateway
;
use
Lib\log\Log
;
use
Lib\log\Log
;
...
@@ -54,16 +55,23 @@ class StartController extends Controller
...
@@ -54,16 +55,23 @@ class StartController extends Controller
$order
=
new
Order
(
$orderId
);
$order
=
new
Order
(
$orderId
);
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
==
false
)
{
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
==
false
)
{
$this
->
response
->
send
(
'
0
4'
,
sprintf
(
'%012x'
,
$orderId
));
$this
->
response
->
send
(
'
1
4'
,
sprintf
(
'%012x'
,
$orderId
));
return
;
return
;
}
else
{
$orderLogicId
=
$order
->
getPortLogicId
();
//logicId 与订单中的实际不相同则已更换口子
if
(
$orderLogicId
!=
hexdec
(
$logic
))
{
$this
->
response
->
send
(
'14'
,
sprintf
(
'%012x'
,
$orderId
));
return
;
}
}
}
$order
->
setStartCapacity
(
$capacity
);
$order
->
setStartCapacity
(
$capacity
);
if
(
Gateway
::
isUidOnline
(
$order
->
getUserId
())
===
1
)
{
if
(
Gateway
::
isUidOnline
(
$order
->
getUserId
())
===
1
)
{
Gateway
::
sendToUid
(
$order
->
getUserId
(),
json_encode
([
'code'
=>
10000
]));
Gateway
::
sendToUid
(
$order
->
getUserId
(),
json_encode
([
'code'
=>
10000
]));
}
}
if
(
isset
(
$_SESSION
[
'agent_id'
]))
{
if
(
isset
(
$_SESSION
[
'agent_id'
]))
{
Log
::
debug
(
'agent_id'
.
$_SESSION
[
'agent_id'
]);
Log
::
debug
(
'agent_id'
.
$_SESSION
[
'agent_id'
]);
Log
::
debug
(
Gateway
::
isUidOnline
(
$_SESSION
[
'agent_id'
]));
Log
::
debug
(
Gateway
::
isUidOnline
(
$_SESSION
[
'agent_id'
]));
...
@@ -78,24 +86,34 @@ class StartController extends Controller
...
@@ -78,24 +86,34 @@ class StartController extends Controller
Log
::
debug
(
'agent is offline'
);
Log
::
debug
(
'agent is offline'
);
}
}
}
}
$lastState
=
$order
->
getStateCode
();
$waitingState
=
new
WaitingState
(
$order
);
$portId
=
$waitingState
->
getOrder
()
->
getPortId
();
// switch ($lastState) {
// case StateCode::WAITING:
$orderState
=
new
WaitingState
(
$order
);
// break;
// case StateCode::PORT_CHARGER;
// $orderState = new ChargerState($order);
// break;
//
// }
$portId
=
$orderState
->
getOrder
()
->
getPortId
();
$this
->
logRecord
->
setPortId
(
$portId
);
$this
->
logRecord
->
setPortId
(
$portId
);
switch
(
$state
)
{
switch
(
$state
)
{
case
StateCode
::
PORT_CHARGER
:
case
StateCode
::
PORT_CHARGER
:
$
waiting
State
->
toChargerState
();
$
order
State
->
toChargerState
();
break
;
break
;
case
StateCode
::
PORT_EXCEPTION
:
case
StateCode
::
PORT_EXCEPTION
:
$
waiting
State
->
toExceptionState
();
$
order
State
->
toExceptionState
();
break
;
break
;
case
StateCode
::
PORT_SHED
:
case
StateCode
::
PORT_SHED
:
$
waiting
State
->
toShedState
();
$
order
State
->
toShedState
();
break
;
break
;
case
StateCode
::
FINISH_EXCEED
:
case
StateCode
::
FINISH_EXCEED
:
$
waiting
State
->
toPowerExceedState
();
$
order
State
->
toPowerExceedState
();
break
;
break
;
default
:
default
:
...
...
application/controller/business/port/StateController.php
View file @
f3957f24
...
@@ -10,6 +10,7 @@ namespace Application\controller\business\port;
...
@@ -10,6 +10,7 @@ namespace Application\controller\business\port;
use
Application\controller\Controller
;
use
Application\controller\Controller
;
use
Application\model\DeviceModel
;
use
Lib\cdz\order\Order
;
use
Lib\cdz\order\Order
;
use
Lib\cdz\order\state\ChargerState
;
use
Lib\cdz\order\state\ChargerState
;
use
Lib\cdz\order\state\ExceptionState
;
use
Lib\cdz\order\state\ExceptionState
;
...
@@ -44,12 +45,24 @@ class StateController extends Controller
...
@@ -44,12 +45,24 @@ class StateController extends Controller
$mac
=
$this
->
request
->
get
(
'mac'
);
$mac
=
$this
->
request
->
get
(
'mac'
);
$state
=
hexdec
(
$this
->
request
->
get
(
'state'
));
$state
=
hexdec
(
$this
->
request
->
get
(
'state'
));
$portsMacId
=
$_SESSION
[
'port_mac_id'
];
if
(
isset
(
$_SESSION
[
'port_mac_id'
])
!==
true
)
{
$deviceModel
=
new
DeviceModel
();
$portId
=
$deviceModel
->
getColumn
(
'id'
,
'mac = '
.
$mac
);
if
(
isset
(
$portsMacId
[
$mac
])
===
false
)
{
if
(
isset
(
$portId
)
===
false
||
$portId
==
''
)
{
return
;
return
;
}
}
else
{
$portsMacId
=
$_SESSION
[
'port_mac_id'
];
if
(
isset
(
$portsMacId
[
$mac
])
===
false
)
{
return
;
}
$portId
=
$portsMacId
[
$mac
];
}
}
$portId
=
$portsMacId
[
$mac
];
$port
=
new
Port
(
$portId
);
$port
=
new
Port
(
$portId
);
...
...
application/controller/business/power/PowerController.php
View file @
f3957f24
...
@@ -72,9 +72,14 @@ class PowerController extends Controller
...
@@ -72,9 +72,14 @@ class PowerController extends Controller
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
!=
false
)
{
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
!=
false
)
{
if
(
$order
->
getStartCapacity
()
===
-
1
)
{
if
(
$order
->
getStartCapacity
()
===
-
1
)
{
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'start_capacity'
=>
$capacity
],
'id = '
.
$orderId
);
$startCapacity
=
$orderModel
->
getColumn
(
'start_capacity'
,
'id = '
.
$orderId
);
$saveOrderRedis
=
new
OrderSaveRedis
(
$order
);
if
(
$startCapacity
==
-
1
)
{
$saveOrderRedis
->
save
([
'startCapacity'
]);
$orderModel
->
update
([
'start_capacity'
=>
$capacity
],
'id = '
.
$orderId
);
$saveOrderRedis
=
new
OrderSaveRedis
(
$order
);
$saveOrderRedis
->
save
([
'startCapacity'
]);
}
}
else
{
}
else
{
$orderModel
=
new
OrderModel
();
$orderModel
=
new
OrderModel
();
...
...
application/controller/setting/DeviceMacController.php
0 → 100644
View file @
f3957f24
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/9/9
* Time: 下午5:01
*/
namespace
Application\controller\setting
;
use
Application\controller\Controller
;
use
Application\model\DeviceModel
;
use
Application\model\GatewayModel
;
use
Lib\Gateway
;
class
DeviceMacController
extends
Controller
{
protected
$parameterMap
=
[
'0E'
=>
[
]
];
public
function
getAll
()
{
if
(
isset
(
$_SESSION
[
'gateway_id'
])
===
true
)
{
$gatewayId
=
$_SESSION
[
'gateway_id'
];
$deviceModel
=
new
DeviceModel
();
$devicesMac
=
$deviceModel
->
getAllColumns
([
'device_mac'
],
'gateway_id = '
.
$gatewayId
);
$count
=
count
(
$devicesMac
);
$tmp
=
[];
foreach
(
$devicesMac
as
$deviceMac
)
{
array_push
(
$tmp
,
$deviceMac
[
'device_mac'
]);
}
$devicesMacStr
=
implode
(
''
,
$tmp
);
$this
->
response
->
send
(
'0e'
,
sprintf
(
'%02x'
,
$count
)
.
$devicesMacStr
);
}
}
}
\ No newline at end of file
application/route/Api.php
View file @
f3957f24
...
@@ -42,6 +42,9 @@ class Api
...
@@ -42,6 +42,9 @@ class Api
$this
->
add
(
'34'
,
'card\charger\StartController@start'
);
$this
->
add
(
'34'
,
'card\charger\StartController@start'
);
$this
->
add
(
'35'
,
'card\charger\OverController@over'
);
$this
->
add
(
'35'
,
'card\charger\OverController@over'
);
$this
->
add
(
'0E'
,
'setting\DeviceMacController@getAll'
);
}
}
...
...
application/start_businessworker.php
View file @
f3957f24
...
@@ -15,14 +15,14 @@ $worker->count = 1;
...
@@ -15,14 +15,14 @@ $worker->count = 1;
$worker
->
registerAddress
=
getenv
(
'REGISTER_IP'
)
.
':'
.
getenv
(
'REGISTER_PORT'
);
$worker
->
registerAddress
=
getenv
(
'REGISTER_IP'
)
.
':'
.
getenv
(
'REGISTER_PORT'
);
$logs
=
fopen
(
'./storage/logs/business.log'
,
'w'
);
//
$logs = fopen('./storage/logs/business.log','w');
fclose
(
$logs
);
//
fclose($logs);
\GatewayWorker\BusinessWorker
::
$stdoutFile
=
'./storage/stdout.log'
;
//
\GatewayWorker\BusinessWorker::$stdoutFile = './storage/stdout.log';
\GatewayWorker\BusinessWorker
::
$logFile
=
'./storage/logs/business.log'
;
//
\GatewayWorker\BusinessWorker::$logFile = './storage/logs/business.log';
if
(
!
defined
(
'GLOBAL_START'
))
{
if
(
!
defined
(
'GLOBAL_START'
))
{
...
...
lib/Aes.php
View file @
f3957f24
...
@@ -2,20 +2,21 @@
...
@@ -2,20 +2,21 @@
namespace
Lib
;
namespace
Lib
;
class
Aes
{
class
Aes
{
public
static
function
encrypt
(
$data
,
$key
)
public
static
function
encrypt
(
$data
,
$key
)
{
{
return
openssl_encrypt
(
hex2bin
(
$data
),
'aes-128-ecb'
,
hex2bin
(
$key
),
1
);
return
openssl_encrypt
(
hex2bin
(
$data
),
'aes-128-ecb'
,
hex2bin
(
$key
),
1
);
}
}
public
static
function
decrypt
(
$data
,
$key
)
public
static
function
decrypt
(
$data
,
$key
)
{
{
return
openssl_decrypt
(
hex2bin
(
$data
),
'aes-128-ecb'
,
hex2bin
(
$key
),
1
);
return
openssl_decrypt
(
hex2bin
(
$data
),
'aes-128-ecb'
,
hex2bin
(
$key
),
1
);
}
}
}
}
\ No newline at end of file
lib/cdz/order/save/OrderSaveRedis.php
View file @
f3957f24
...
@@ -54,6 +54,9 @@ class OrderSaveRedis
...
@@ -54,6 +54,9 @@ class OrderSaveRedis
}
}
/**
*
*/
public
function
saveAll
()
public
function
saveAll
()
{
{
$update
=
[];
$update
=
[];
...
@@ -82,5 +85,15 @@ class OrderSaveRedis
...
@@ -82,5 +85,15 @@ class OrderSaveRedis
}
}
/**
* @param array $keys
*/
public
function
deleteHashKey
(
array
$keys
)
{
call_user_func_array
([
$this
->
redis
,
'hDel'
],
$keys
);
}
}
}
\ No newline at end of file
lib/cdz/order/state/ChargerState.php
View file @
f3957f24
...
@@ -210,6 +210,7 @@ class ChargerState extends State
...
@@ -210,6 +210,7 @@ class ChargerState extends State
$chargerFullMessage
->
setEndTime
(
$this
->
nowDate
);
$chargerFullMessage
->
setEndTime
(
$this
->
nowDate
);
$chargerFullMessage
->
setStartTime
(
$this
->
order
->
getStartTime
());
$chargerFullMessage
->
setStartTime
(
$this
->
order
->
getStartTime
());
$chargerFullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$chargerFullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$chargerFullMessage
->
setUserId
(
$this
->
order
->
getUserId
());
$chargerFullMessage
->
setRemark
(
$chargerFullMessage
->
getRemark
()
.
'\n'
.
sprintf
(
'%012x'
,
$this
->
order
->
getId
()));
$chargerFullMessage
->
setRemark
(
$chargerFullMessage
->
getRemark
()
.
'\n'
.
sprintf
(
'%012x'
,
$this
->
order
->
getId
()));
$sendMessage
=
new
SendMessage
();
$sendMessage
=
new
SendMessage
();
if
(
$sendMessage
->
request
(
$chargerFullMessage
)
===
false
)
{
if
(
$sendMessage
->
request
(
$chargerFullMessage
)
===
false
)
{
...
...
lib/cdz/order/state/WaitingState.php
View file @
f3957f24
...
@@ -223,6 +223,13 @@ class WaitingState extends State
...
@@ -223,6 +223,13 @@ class WaitingState extends State
public
function
toShedState
()
public
function
toShedState
()
{
{
$this
->
order
->
setStateCode
(
-
1
);
$orderSave
=
new
OrderSaveRedis
(
$this
->
order
);
$orderSave
->
save
([
'stateCode'
]);
$orderSave
->
deleteHashKey
([
'startTime'
,
'startCapacity'
]);
Log
::
error
(
'waiting state can not change to shed state'
);
Log
::
error
(
'waiting state can not change to shed state'
);
}
}
...
...
lib/log/Log.php
View file @
f3957f24
...
@@ -65,7 +65,7 @@ class Log
...
@@ -65,7 +65,7 @@ class Log
$gatewayMac
=
isset
(
$_SESSION
[
'gateway_mac'
])
?
$_SESSION
[
'gateway_mac'
]
:
'null mac'
;
$gatewayMac
=
isset
(
$_SESSION
[
'gateway_mac'
])
?
$_SESSION
[
'gateway_mac'
]
:
'null mac'
;
$handle
=
new
RotatingFileHandler
(
self
::
LOG_NAME
);
$handle
=
new
RotatingFileHandler
(
self
::
LOG_NAME
,
30
);
$output
=
"[%datetime%] [%
$gatewayMac
%].%level_name%: %message% %context% %extra%
\n
"
;
$output
=
"[%datetime%] [%
$gatewayMac
%].%level_name%: %message% %context% %extra%
\n
"
;
...
...
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