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
4e6e37f7
You need to sign in or sign up before continuing.
Commit
4e6e37f7
authored
Jul 30, 2018
by
BANice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线上提交版
parent
741f7b68
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
2417 additions
and
452 deletions
+2417
-452
.idea/workspace.xml
+310
-244
Application/Controller/AccessController.php
+107
-7
Application/Controller/AmmeterController.php
+32
-0
Application/Controller/HeartController.php
+18
-1
Application/Controller/PortController.php
+20
-49
Application/Controller/PortStateController.php
+172
-0
Application/Controller/PowerController.php
+327
-61
Application/Controller/PowerOffController.php
+32
-0
Application/Events.php
+1
-4
Lib/api/message/ChargerFullMessage.php
+133
-3
Lib/api/message/ChargerRefundMessage.php
+1
-1
Lib/api/message/ChargerReloadMessage.php
+1
-1
Lib/api/message/ChargerShedTimeOutMessage.php
+162
-0
Lib/api/message/ChargerStartMessage.php
+21
-1
Lib/cdz_order/Order.php
+119
-4
Lib/cdz_order/order/SaveOrder.php
+12
-0
Lib/cdz_order/state/Charger.php
+258
-3
Lib/cdz_order/state/Created.php
+15
-0
Lib/cdz_order/state/Offline.php
+38
-13
Lib/cdz_order/state/Online.php
+13
-0
Lib/cdz_order/state/PortShed.php
+251
-1
Lib/cdz_order/state/Refund.php
+64
-0
Lib/cdz_order/state/State.php
+97
-11
Lib/cdz_order/state/WaitingCharger.php
+86
-4
Lib/order_exception/Exception.php
+7
-1
Lib/order_exception/OrderTrace.php
+38
-14
Lib/port/Port.php
+0
-6
Lib/send/Send.php
+3
-8
Lib/send/command/StopChargerCommand.php
+48
-1
Lib/state/StateCode.php
+9
-0
Route/Api.php
+22
-14
No files found.
.idea/workspace.xml
View file @
4e6e37f7
...
...
@@ -5,20 +5,37 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"00edf348-0453-4317-8d2b-bf5eb8ea4b7a"
name=
"Default"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/Application/Controller/AmmeterController.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Application/Controller/PortStateController.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Application/Controller/PowerOffController.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerShedTimeOutMessage.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/Refund.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Controller/AccessController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Controller/AccessController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Controller/
CertifyController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Controller/Certify
Controller.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Controller/
HeartController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Controller/Heart
Controller.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Controller/PortController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Controller/PortController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Controller/PowerController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Controller/PowerController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Application/Events.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Application/Events.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/api/message/ChargerFinishMessage.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerFinishMessage.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/api/message/ChargerFullMessage.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerFullMessage.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/api/message/ChargerRefundMessage.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerRefundMessage.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/api/message/ChargerReloadMessage.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerReloadMessage.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/api/message/ChargerStartMessage.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/api/message/ChargerStartMessage.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/Order.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/Order.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/order/SaveOrder.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/order/SaveOrder.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/Charger.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/Charger.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/Created.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/Created.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/Offline.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/Offline.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/Online.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/Online.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/PortShed.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/PortShed.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/State.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/State.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/cdz_order/state/WaitingCharger.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/cdz_order/state/WaitingCharger.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/order_exception/Exception.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/order_exception/Exception.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/order_exception/OrderTrace.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/order_exception/OrderTrace.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/port/Port.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/port/Port.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/send/Send.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/send/Send.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/send/command/StopChargerCommand.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/send/command/StopChargerCommand.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Lib/state/StateCode.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Lib/state/StateCode.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/Route/Api.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/Route/Api.php"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
...
...
@@ -35,11 +52,11 @@
</component>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
leaf-file-name=
"
PowerController.php"
pinned=
"false"
current-in-tab=
"fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/
Power
Controller.php"
>
<file
leaf-file-name=
"
AccessController.php"
pinned=
"false"
current-in-tab=
"tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/
Access
Controller.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
-1537
"
>
<caret
line=
"
151"
column=
"17"
selection-start-line=
"151"
selection-start-column=
"17"
selection-end-line=
"151"
selection-end-column=
"17
"
/>
<state
relative-caret-position=
"
516
"
>
<caret
line=
"
283"
selection-start-line=
"283"
selection-end-line=
"283
"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
...
...
@@ -47,89 +64,89 @@
</provider>
</entry>
</file>
<file
leaf-file-name=
"
Events
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Events
.php"
>
<file
leaf-file-name=
"
PublishPortShed
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Lib/rabbitmq/PublishPortShed
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
193
"
>
<caret
line=
"
154"
selection-start-line=
"154"
selection-end-line=
"154
"
/>
<state
relative-caret-position=
"
255
"
>
<caret
line=
"
22"
column=
"20"
selection-start-line=
"22"
selection-start-column=
"20"
selection-end-line=
"22"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
PortControll
er.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/PortControll
er.php"
>
<file
leaf-file-name=
"
Charg
er.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Lib/cdz_order/state/Charg
er.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
2385
"
>
<caret
line=
"1
64"
selection-start-line=
"164"
selection-end-line=
"164
"
/>
<state
relative-caret-position=
"
889
"
>
<caret
line=
"1
43"
column=
"51"
selection-start-line=
"143"
selection-start-column=
"51"
selection-end-line=
"143"
selection-end-column=
"51
"
/>
<folding>
<element
signature=
"e#1
31#158
#0#PHP"
expanded=
"true"
/>
<element
signature=
"e#1
23#156
#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
CertifyController
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/
Controller/CertifyController
.php"
>
<file
leaf-file-name=
"
Events
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/
Events
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
64
7"
>
<caret
line=
"
52"
column=
"9"
selection-start-line=
"52"
selection-start-column=
"9"
selection-end-line=
"52"
selection-end-column=
"
9"
/>
<state
relative-caret-position=
"
99
7"
>
<caret
line=
"
213"
column=
"39"
selection-start-line=
"213"
selection-start-column=
"39"
selection-end-line=
"213"
selection-end-column=
"3
9"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
Gateway
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
vendor/workerman/gateway-worker/src/Lib/Gateway
.php"
>
<file
leaf-file-name=
"
ExceptionModel
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Model/ExceptionModel
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
369
"
>
<caret
line=
"1
69"
column=
"27"
selection-start-line=
"169"
selection-start-column=
"27"
selection-end-line=
"169"
selection-end-column=
"27
"
/>
<state
relative-caret-position=
"
120
"
>
<caret
line=
"1
3"
column=
"6"
selection-start-line=
"13"
selection-start-column=
"6"
selection-end-line=
"13"
selection-end-column=
"6
"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
Access
Controller.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller
/AccessController
.php"
>
<file
leaf-file-name=
"Controller.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
395
"
>
<caret
line=
"
242"
column=
"40"
selection-start-line=
"242"
selection-start-column=
"40"
selection-end-line=
"242"
selection-end-column=
"40
"
/>
<state
relative-caret-position=
"
400
"
>
<caret
line=
"
155"
column=
"26"
selection-start-line=
"155"
selection-start-column=
"26"
selection-end-line=
"155"
selection-end-column=
"26
"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
Offline.php"
pinned=
"false"
current-in-tab=
"tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/state/Offline
.php"
>
<file
leaf-file-name=
"
DeviceLog.php"
pinned=
"false"
current-in-tab=
"fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
log/DeviceLog
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
579
"
>
<caret
line=
"
47"
column=
"12"
selection-start-line=
"47"
selection-start-column=
"12"
selection-end-line=
"47"
selection-end-column=
"12
"
/>
<state
relative-caret-position=
"
780
"
>
<caret
line=
"
57"
column=
"20"
selection-start-line=
"57"
selection-start-column=
"20"
selection-end-line=
"57"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
HeartController
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/HeartController
.php"
>
<file
leaf-file-name=
"
Api
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/
Route/Api
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
345
"
>
<caret
line=
"
29"
column=
"21"
selection-start-line=
"29"
selection-start-column=
"21"
selection-end-line=
"29"
selection-end-column=
"21
"
/>
<state
relative-caret-position=
"
467
"
>
<caret
line=
"
70"
column=
"44"
selection-start-line=
"70"
selection-start-column=
"44"
selection-end-line=
"70"
selection-end-column=
"44
"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
State
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/state/State
.php"
>
<file
leaf-file-name=
"
Port
.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
port/Port
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"1828"
>
<caret
line=
"281"
column=
"20"
selection-start-line=
"281"
selection-start-column=
"20"
selection-end-line=
"281"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#123#148#0#PHP"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"310"
>
<caret
line=
"199"
column=
"20"
selection-start-line=
"199"
selection-start-column=
"20"
selection-end-line=
"199"
selection-end-column=
"20"
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
Capacity
Controller.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/
Capacity
Controller.php"
>
<file
leaf-file-name=
"
PowerOff
Controller.php"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/
PowerOff
Controller.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"390"
>
<caret
line=
"31"
lean-forward=
"true"
selection-start-line=
"31"
selection-end-line=
"31"
/>
<state
relative-caret-position=
"330"
>
<caret
line=
"27"
selection-start-line=
"27"
selection-end-line=
"27"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
...
...
@@ -151,7 +168,17 @@
<find>
ff0000
</find>
<find>
端口离线命令
</find>
<find>
after
</find>
<find>
记录订单
</find>
<find>
var_dump
</find>
<find>
OrderTrace
</find>
<find>
3
</find>
<find>
充电时间结束
</find>
<find>
记录订单异常
</find>
<find>
var_d
</find>
<find>
offlineTime
</find>
<find>
del
</find>
<find>
'('
</find>
<find>
var_dum
</find>
</findStrings>
<replaceStrings>
<replace>
Env
</replace>
...
...
@@ -172,57 +199,57 @@
<component
name=
"IdeDocumentHistory"
>
<option
name=
"CHANGED_PATHS"
>
<list>
<option
value=
"$PROJECT_DIR$/Application/Model.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/Log.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Model/ConfigModel.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerStartMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Middleware/AuthMiddleware.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/Gateway.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/log/DeviceLog.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Model/ExceptionModel.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerRefundMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Route/Api.php"
/>
<option
value=
"$PROJECT_DIR$/vendor/workerman/workerman/Protocols/Bintohex.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Model/OrderCapacityModel.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/rabbitmq/MyRabbitMq.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/PortShedMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/rabbitmq/Publish.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/rabbitmq/PublishPortShed.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerReloadMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerExcessMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/MessageData.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/Push.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerFullMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerExceedMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/SettingController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerFailMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerExceptionMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/order_exception/OrderTrace.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/send/Send.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/tool/StringTool.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/HeartController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/redis/RedisKey.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/order_exception/OrderState.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/PortShed.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Online.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/order/SaveOrder.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Created.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/Response.php"
/>
<option
value=
"$PROJECT_DIR$/test/test.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/AccessController.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/CertifyController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerReloadMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/port/Port.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/order_exception/Exception.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/State.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/WaitingCharger.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/Order.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Charger.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/PortController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerFinishMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/order/SaveOrder.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerShedTimeOutMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/HeartController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerFullMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/state/StateCode.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Online.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Finish.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Created.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/State.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/order_exception/OrderTrace.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Refund.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerStartMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/order_exception/Exception.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/PortStateController.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/AmmeterController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/api/message/ChargerRefundMessage.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/PowerController.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/PortController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/WaitingCharger.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Events.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/CertifyController.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/PortShed.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/send/command/StopChargerCommand.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/send/Send.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Offline.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/state/Charger.php"
/>
<option
value=
"$PROJECT_DIR$/Lib/cdz_order/Order.php"
/>
<option
value=
"$PROJECT_DIR$/Route/Api.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/PowerOffController.php"
/>
<option
value=
"$PROJECT_DIR$/Application/Controller/AccessController.php"
/>
</list>
</option>
</component>
...
...
@@ -281,6 +308,30 @@
<item
name=
"Application"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Controller"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"cdz_gateway"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"cdz_gateway"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Lib"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"cdz_gateway"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"cdz_gateway"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Lib"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"cdz_order"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"cdz_gateway"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"cdz_gateway"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Lib"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"cdz_order"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"state"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"cdz_gateway"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"cdz_gateway"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"Lib"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"rabbitmq"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</expand>
<select
/>
</subPane>
...
...
@@ -348,12 +399,12 @@
<workItem
from=
"1530496499150"
duration=
"45852000"
/>
<workItem
from=
"1531129252870"
duration=
"18903000"
/>
<workItem
from=
"1531278957060"
duration=
"18725000"
/>
<workItem
from=
"1531467678517"
duration=
"
33417
000"
/>
<workItem
from=
"1531467678517"
duration=
"
142023
000"
/>
</task>
<servers
/>
</component>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"
397011
000"
/>
<option
name=
"totallyTimeSpent"
value=
"
505617
000"
/>
</component>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
...
...
@@ -366,7 +417,6 @@
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"1920"
y=
"-58"
width=
"1920"
height=
"1080"
extended-state=
"0"
/>
<editor
active=
"true"
/>
<layout>
<window_info
anchor=
"bottom"
id=
"TODO"
order=
"6"
weight=
"0.32977587"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"7"
side_tool=
"true"
/>
...
...
@@ -402,373 +452,389 @@
</breakpoint-manager>
</component>
<component
name=
"editorHistoryManager"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
send/Send
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
Request
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"1320"
>
<caret
line=
"96"
selection-start-line=
"96"
selection-end-line=
"96"
/>
<folding>
<element
signature=
"e#115#131#0#PHP"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"90"
>
<caret
line=
"11"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Lib/send/command/StopChargerCommand
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/HeartController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
990
"
>
<caret
line=
"
72"
column=
"20"
selection-start-line=
"72"
selection-start-column=
"20"
selection-end-line=
"72"
selection-end-column=
"2
0"
/>
<state
relative-caret-position=
"
615
"
>
<caret
line=
"
48"
column=
"90"
selection-start-line=
"48"
selection-start-column=
"90"
selection-end-line=
"48"
selection-end-column=
"9
0"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
Log
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/OrderState
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
30
0"
>
<caret
line=
"
27"
column=
"5"
selection-start-line=
"27"
selection-start-column=
"5"
selection-end-line=
"27"
selection-end-column=
"5
"
/>
<state
relative-caret-position=
"
66
0"
>
<caret
line=
"
49"
column=
"27"
selection-start-line=
"49"
selection-start-column=
"27"
selection-end-line=
"49"
selection-end-column=
"27
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/send/command/BalanceChargerCommand.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/api/message/ChargerFullMessage.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/api/message/PortShedMessage.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
285
"
>
<caret
line=
"
24"
selection-start-line=
"24"
selection-end-line=
"24
"
/>
<state
relative-caret-position=
"
400
"
>
<caret
line=
"
50"
column=
"20"
selection-start-line=
"50"
selection-start-column=
"20"
selection-end-line=
"50"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/api/message/Charger
Refund
Message.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/api/message/Charger
Exception
Message.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
955
"
>
<caret
line=
"
96"
column=
"39"
selection-start-line=
"96"
selection-start-column=
"39"
selection-end-line=
"96"
selection-end-column=
"39
"
/>
<state
relative-caret-position=
"
-1018
"
>
<caret
line=
"
11"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/ChargerFailMessag
e.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/OrderTrac
e.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"-304"
>
<caret
line=
"11"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6"
/>
<state
relative-caret-position=
"685"
>
<caret
line=
"121"
column=
"20"
selection-start-line=
"121"
selection-start-column=
"20"
selection-end-line=
"121"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#124#166#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/ChargerExcessMessag
e.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
state/StateCod
e.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
9
0"
>
<caret
line=
"
11"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6
"
/>
<state
relative-caret-position=
"
30
0"
>
<caret
line=
"
25"
column=
"10"
selection-start-line=
"25"
selection-start-column=
"10"
selection-end-line=
"25"
selection-end-column=
"10
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/ChargerExceptionMessage
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/Exception
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
512
"
>
<caret
line=
"
57"
column=
"41"
selection-start-line=
"57"
selection-start-column=
"41"
selection-end-line=
"57"
selection-end-column=
"41
"
/>
<state
relative-caret-position=
"
150
"
>
<caret
line=
"
15"
column=
"25"
selection-start-line=
"15"
selection-start-column=
"25"
selection-end-line=
"15"
selection-end-column=
"25
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/
Controller
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Application/
Model/OrderCapacityModel
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"12
45
"
>
<caret
line=
"
93"
column=
"18"
lean-forward=
"true"
selection-start-line=
"93"
selection-start-column=
"18"
selection-end-line=
"93"
selection-end-column=
"18
"
/>
<state
relative-caret-position=
"12
0
"
>
<caret
line=
"
13"
column=
"35"
lean-forward=
"true"
selection-start-line=
"13"
selection-start-column=
"35"
selection-end-line=
"13"
selection-end-column=
"35
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/Model.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
426
"
>
<caret
line=
"93"
column=
"
43"
selection-start-line=
"93"
selection-start-column=
"43"
selection-end-line=
"93"
selection-end-column=
"43
"
/>
<state
relative-caret-position=
"
584
"
>
<caret
line=
"93"
column=
"
30"
selection-start-line=
"93"
selection-start-column=
"30"
selection-end-line=
"93"
selection-end-column=
"30
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/Model/OrderExceptionModel.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"255"
>
<caret
line=
"22"
selection-start-line=
"22"
selection-end-line=
"22"
/>
<entry
file=
"file://$PROJECT_DIR$/vendor/workerman/mysql/README.md"
>
<provider
selected=
"true"
editor-type-id=
"split-provider[text-editor;markdown-preview-editor]"
>
<state
split_layout=
"SPLIT"
>
<first_editor
/>
<second_editor
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Lib/api/message/ChargerStartMessage
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
vendor/workerman/mysql/src/Connection
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
1535
"
>
<caret
line=
"
132"
column=
"20"
selection-start-line=
"132"
selection-start-column=
"20"
selection-end-line=
"132
"
selection-end-column=
"20"
/>
<state
relative-caret-position=
"
713
"
>
<caret
line=
"
257"
column=
"20"
selection-start-line=
"257"
selection-start-column=
"20"
selection-end-line=
"257
"
selection-end-column=
"20"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
state/StateCode
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/Push
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
21
0"
>
<caret
line=
"1
9"
column=
"10"
selection-start-line=
"19"
selection-start-column=
"10"
selection-end-line=
"19"
selection-end-column=
"10
"
/>
<state
relative-caret-position=
"
12
0"
>
<caret
line=
"1
4"
column=
"6"
selection-start-line=
"14"
selection-start-column=
"6"
selection-end-line=
"14"
selection-end-column=
"6
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Route/Api
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/SettingController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
300
"
>
<caret
line=
"
27"
column=
"52"
selection-start-line=
"27"
selection-start-column=
"52"
selection-end-line=
"27"
selection-end-column=
"5
2"
/>
<state
relative-caret-position=
"
495
"
>
<caret
line=
"
42"
selection-start-line=
"42"
selection-end-line=
"4
2"
/>
</state>
</provider>
</entry>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard/standard_1
.php"
>
<entry
file=
"
file://$PROJECT_DIR$/Application/Controller/AmmeterController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
299
"
>
<caret
line=
"
996"
column=
"9"
selection-start-line=
"996"
selection-start-column=
"9"
selection-end-line=
"996"
selection-end-column=
"9
"
/>
<state
relative-caret-position=
"
330
"
>
<caret
line=
"
27"
selection-start-line=
"27"
selection-end-line=
"27
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/bug_doc/guide/charger.png"
>
<provider
selected=
"true"
editor-type-id=
"images"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/SettingController.php"
>
<entry
file=
"file://$PROJECT_DIR$/test/test.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
49
5"
>
<caret
line=
"
42"
selection-start-line=
"42"
selection-end-line=
"42
"
/>
<state
relative-caret-position=
"
16
5"
>
<caret
line=
"
16"
selection-start-line=
"16"
selection-end-line=
"16
"
/>
</state>
</provider>
</entry>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard/_types
.php"
>
<entry
file=
"
file://$PROJECT_DIR$/Lib/api/message/ChargerRefundMessage
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"1
575
"
>
<caret
line=
"1
05"
column=
"13"
selection-start-line=
"105"
selection-start-column=
"13"
selection-end-line=
"105"
selection-end-column=
"13
"
/>
<state
relative-caret-position=
"1
773
"
>
<caret
line=
"1
74"
column=
"20"
selection-start-line=
"174"
selection-start-column=
"20"
selection-end-line=
"174"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"
file://$PROJECT_DIR$/composer.json
"
>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/redis/Redis.php
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
60
"
>
<caret
line=
"
4"
column=
"31"
selection-start-line=
"4"
selection-start-column=
"31"
selection-end-line=
"4"
selection-end-column=
"31
"
/>
<state
relative-caret-position=
"
297
"
>
<caret
line=
"
2734"
column=
"20"
selection-start-line=
"2734"
selection-start-column=
"20"
selection-end-line=
"2734"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard/standard_3
.php"
>
<entry
file=
"
file://$PROJECT_DIR$/Application/Controller/PortController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"304"
>
<caret
line=
"94"
column=
"9"
selection-start-line=
"94"
selection-start-column=
"9"
selection-end-line=
"94"
selection-end-column=
"9"
/>
<state
relative-caret-position=
"198"
>
<caret
line=
"341"
column=
"109"
selection-start-line=
"341"
selection-start-column=
"109"
selection-end-line=
"341"
selection-end-column=
"109"
/>
<folding>
<element
signature=
"e#131#158#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/Response.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"483"
>
<caret
line=
"
83"
selection-start-line=
"83"
selection-end-line=
"83
"
/>
<caret
line=
"
72"
column=
"20"
selection-start-line=
"72"
selection-start-column=
"20"
selection-end-line=
"72"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard/standard_5.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/Gateway.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/redis/RedisKey.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
304
"
>
<caret
line=
"
293"
column=
"9"
selection-start-line=
"293"
selection-start-column=
"9"
selection-end-line=
"293"
selection-end-column=
"9
"
/>
<state
relative-caret-position=
"
555
"
>
<caret
line=
"
42"
column=
"10"
selection-start-line=
"42"
selection-start-column=
"10"
selection-end-line=
"42"
selection-end-column=
"10
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Lib/api/message/ChargerReloadMessage
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/CertifyController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
9
0"
>
<caret
line=
"
11"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6
"
/>
<state
relative-caret-position=
"
66
0"
>
<caret
line=
"
52"
column=
"9"
selection-start-line=
"52"
selection-start-column=
"9"
selection-end-line=
"52"
selection-end-column=
"9
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/Created.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"180"
>
<caret
line=
"17"
selection-start-line=
"17"
selection-end-line=
"17"
/>
<state
relative-caret-position=
"84"
>
<caret
line=
"17"
column=
"15"
selection-start-line=
"17"
selection-start-column=
"15"
selection-end-line=
"17"
selection-end-column=
"15"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/Finish.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"120"
>
<caret
line=
"13"
selection-start-line=
"13"
selection-end-line=
"13"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/Online.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
9
0"
>
<caret
line=
"1
1"
column=
"6"
selection-start-line=
"11"
selection-start-column=
"6"
selection-end-line=
"11"
selection-end-column=
"6
"
/>
<state
relative-caret-position=
"
15
0"
>
<caret
line=
"1
5"
selection-start-line=
"15"
selection-end-line=
"15
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/state/PortShed
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/ChargerFinishMessage
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
135
"
>
<caret
line=
"14"
selection-start-line=
"14"
selection-end-line=
"14
"
/>
<state
relative-caret-position=
"
-556
"
>
<caret
line=
"14"
column=
"6"
selection-start-line=
"14"
selection-start-column=
"6"
selection-end-line=
"14"
selection-end-column=
"6
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
order/SaveOrder
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
state/PortShed
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
727
"
>
<caret
line=
"
64"
column=
"20"
selection-start-line=
"64"
selection-start-column=
"20"
selection-end-line=
"64"
selection-end-column=
"20
"
/>
<state
relative-caret-position=
"
280
"
>
<caret
line=
"
224"
column=
"27"
lean-forward=
"true"
selection-start-line=
"224"
selection-start-column=
"27"
selection-end-line=
"224"
selection-end-column=
"27
"
/>
<folding>
<element
signature=
"e#123#1
47
#0#PHP"
expanded=
"true"
/>
<element
signature=
"e#123#1
56
#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/standard/standard_9
.php"
>
<entry
file=
"
file://$PROJECT_DIR$/Lib/cdz_order/state/Refund
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
299
"
>
<caret
line=
"
85"
column=
"9"
selection-start-line=
"85"
selection-start-column=
"9"
selection-end-line=
"85"
selection-end-column=
"9
"
/>
<state
relative-caret-position=
"
150
"
>
<caret
line=
"
15"
selection-start-line=
"15"
selection-end-line=
"15
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
redis/RedisKey
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
api/message/ChargerStartMessage
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
465
"
>
<caret
line=
"
36"
column=
"51"
selection-start-line=
"36"
selection-start-column=
"51"
selection-end-line=
"36"
selection-end-column=
"51
"
/>
<state
relative-caret-position=
"
-171
"
>
<caret
line=
"
28"
column=
"20"
selection-start-line=
"28"
selection-start-column=
"20"
selection-end-line=
"28"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/test/test.php"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Middleware.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/WaitingCharger.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"180"
>
<caret
line=
"17"
lean-forward=
"true"
selection-start-line=
"17"
selection-end-line=
"17"
/>
<state
relative-caret-position=
"778"
>
<caret
line=
"165"
lean-forward=
"true"
selection-start-line=
"165"
selection-end-line=
"165"
/>
<folding>
<element
signature=
"e#123#156#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"
jar://$APPLICATION_HOME_DIR$/plugins/php/lib/php.jar!/stubs/redis/Redis
.php"
>
<entry
file=
"
file://$PROJECT_DIR$/Application/Controller/PowerController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"297"
>
<caret
line=
"3000"
column=
"20"
selection-start-line=
"3000"
selection-start-column=
"20"
selection-end-line=
"3000"
selection-end-column=
"20"
/>
<state
relative-caret-position=
"729"
>
<caret
line=
"684"
column=
"9"
selection-start-line=
"684"
selection-start-column=
"9"
selection-end-line=
"684"
selection-end-column=
"9"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/OrderState
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/order/SaveOrder
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"660"
>
<caret
line=
"49"
column=
"27"
selection-start-line=
"49"
selection-start-column=
"27"
selection-end-line=
"49"
selection-end-column=
"27"
/>
<state
relative-caret-position=
"480"
>
<caret
line=
"37"
column=
"20"
selection-start-line=
"37"
selection-start-column=
"20"
selection-end-line=
"37"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#123#147#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/Exception
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
send/Command
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
33
0"
>
<caret
line=
"
27"
column=
"27"
selection-start-line=
"27"
selection-start-column=
"27"
selection-end-line=
"27"
selection-end-column=
"27
"
/>
<state
relative-caret-position=
"
9
0"
>
<caret
line=
"
11"
column=
"15"
selection-start-line=
"11"
selection-start-column=
"15"
selection-end-line=
"11"
selection-end-column=
"15
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
order_exception/OrderTrace
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
send/command/StopChargerCommand
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"465"
>
<caret
line=
"36"
column=
"20"
selection-start-line=
"36"
selection-start-column=
"20"
selection-end-line=
"36"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#124#166#0#PHP"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"827"
>
<caret
line=
"170"
selection-start-line=
"170"
selection-end-line=
"170"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Lib/cdz_order/state/WaitingCharg
er.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/PortStateControll
er.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"320"
>
<caret
line=
"28"
lean-forward=
"true"
selection-start-line=
"28"
selection-end-line=
"28"
/>
<state
relative-caret-position=
"990"
>
<caret
line=
"71"
column=
"53"
lean-forward=
"true"
selection-start-line=
"71"
selection-start-column=
"53"
selection-end-line=
"71"
selection-end-column=
"53"
/>
<folding>
<element
signature=
"e#127#154#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
Order
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
state/State
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
292
"
>
<caret
line=
"
98"
column=
"20"
selection-start-line=
"98"
selection-start-column=
"20"
selection-end-line=
"98
"
selection-end-column=
"20"
/>
<state
relative-caret-position=
"
3524
"
>
<caret
line=
"
323"
column=
"20"
selection-start-line=
"323"
selection-start-column=
"20"
selection-end-line=
"323
"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#1
17#147
#0#PHP"
expanded=
"true"
/>
<element
signature=
"e#1
23#148
#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/state/Finish
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
send/Send
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
120
"
>
<caret
line=
"
13"
lean-forward=
"true"
selection-start-line=
"13"
selection-end-line=
"13
"
/>
<state
relative-caret-position=
"
491
"
>
<caret
line=
"
94"
column=
"8"
selection-start-line=
"94"
selection-start-column=
"8"
selection-end-line=
"94"
selection-end-column=
"8
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/
port/Port
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/
cdz_order/state/Offline
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"355"
>
<caret
line=
"31"
column=
"20"
selection-start-line=
"31"
selection-start-column=
"20"
selection-end-line=
"31"
selection-end-column=
"20"
/>
<state
relative-caret-position=
"431"
>
<caret
line=
"67"
selection-start-line=
"67"
selection-end-line=
"67"
/>
<folding>
<element
signature=
"e#124#148#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
state/Charg
er.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/
Ord
er.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
675
"
>
<caret
line=
"
50"
selection-start-line=
"50"
selection-end-line=
"50
"
/>
<state
relative-caret-position=
"
812
"
>
<caret
line=
"
459"
lean-forward=
"true"
selection-start-line=
"459"
selection-end-line=
"459
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Lib/api/message/ChargerFinishMessage
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/PowerOffController
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"503"
>
<caret
line=
"79"
column=
"71"
selection-start-line=
"79"
selection-start-column=
"71"
selection-end-line=
"79"
selection-end-column=
"71"
/>
<state
relative-caret-position=
"330"
>
<caret
line=
"27"
selection-start-line=
"27"
selection-end-line=
"27"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Application/Events
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Route/Api
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
193
"
>
<caret
line=
"
154"
selection-start-line=
"154"
selection-end-line=
"15
4"
/>
<state
relative-caret-position=
"
467
"
>
<caret
line=
"
70"
column=
"44"
selection-start-line=
"70"
selection-start-column=
"44"
selection-end-line=
"70"
selection-end-column=
"4
4"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
vendor/workerman/gateway-worker/src/Lib/Gateway
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Lib/log/DeviceLog
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
369
"
>
<caret
line=
"
169"
column=
"27"
selection-start-line=
"169"
selection-start-column=
"27"
selection-end-line=
"169"
selection-end-column=
"27
"
/>
<state
relative-caret-position=
"
780
"
>
<caret
line=
"
57"
column=
"20"
selection-start-line=
"57"
selection-start-column=
"20"
selection-end-line=
"57"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller
/CapacityController
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
39
0"
>
<caret
line=
"
31"
lean-forward=
"true"
selection-start-line=
"31"
selection-end-line=
"31
"
/>
<state
relative-caret-position=
"
40
0"
>
<caret
line=
"
155"
column=
"26"
selection-start-line=
"155"
selection-start-column=
"26"
selection-end-line=
"155"
selection-end-column=
"26
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/CertifyController
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Lib/port/Port
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
647
"
>
<caret
line=
"
52"
column=
"9"
selection-start-line=
"52"
selection-start-column=
"9"
selection-end-line=
"52"
selection-end-column=
"9
"
/>
<state
relative-caret-position=
"
310
"
>
<caret
line=
"
199"
column=
"20"
selection-start-line=
"199"
selection-start-column=
"20"
selection-end-line=
"199"
selection-end-column=
"20
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/
Controller/HeartController
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Application/
Model/ExceptionModel
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
345
"
>
<caret
line=
"
29"
column=
"21"
selection-start-line=
"29"
selection-start-column=
"21"
selection-end-line=
"29"
selection-end-column=
"21
"
/>
<state
relative-caret-position=
"
120
"
>
<caret
line=
"
13"
column=
"6"
selection-start-line=
"13"
selection-start-column=
"6"
selection-end-line=
"13"
selection-end-column=
"6
"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/
Controller/PortController
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Application/
Events
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"2385"
>
<caret
line=
"164"
selection-start-line=
"164"
selection-end-line=
"164"
/>
<folding>
<element
signature=
"e#131#158#0#PHP"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"997"
>
<caret
line=
"213"
column=
"39"
selection-start-line=
"213"
selection-start-column=
"39"
selection-end-line=
"213"
selection-end-column=
"39"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
Application/Controller/PowerController
.php"
>
<entry
file=
"file://$PROJECT_DIR$/
Lib/rabbitmq/PublishPortShed
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"-1537"
>
<caret
line=
"151"
column=
"17"
selection-start-line=
"151"
selection-start-column=
"17"
selection-end-line=
"151"
selection-end-column=
"17"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"255"
>
<caret
line=
"22"
column=
"20"
selection-start-line=
"22"
selection-start-column=
"20"
selection-end-line=
"22"
selection-end-column=
"20"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/
State
.php"
>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/
Charger
.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
1828
"
>
<caret
line=
"
281"
column=
"20"
selection-start-line=
"281"
selection-start-column=
"20"
selection-end-line=
"281"
selection-end-column=
"20
"
/>
<state
relative-caret-position=
"
889
"
>
<caret
line=
"
143"
column=
"51"
selection-start-line=
"143"
selection-start-column=
"51"
selection-end-line=
"143"
selection-end-column=
"51
"
/>
<folding>
<element
signature=
"e#123#1
48
#0#PHP"
expanded=
"true"
/>
<element
signature=
"e#123#1
56
#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Application/Controller/AccessController.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"395"
>
<caret
line=
"242"
column=
"40"
selection-start-line=
"242"
selection-start-column=
"40"
selection-end-line=
"242"
selection-end-column=
"40"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/Lib/cdz_order/state/Offline.php"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"579"
>
<caret
line=
"47"
column=
"12"
selection-start-line=
"47"
selection-start-column=
"12"
selection-end-line=
"47"
selection-end-column=
"12"
/>
<state
relative-caret-position=
"516"
>
<caret
line=
"283"
selection-start-line=
"283"
selection-end-line=
"283"
/>
<folding>
<element
signature=
"e#126#153#0#PHP"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
...
...
Application/Controller/AccessController.php
View file @
4e6e37f7
...
...
@@ -17,11 +17,13 @@ use Application\Model\StationModel;
use
GatewayWorker\Lib\Gateway
;
use
Lib\cdz_order\Order
;
use
Lib\cdz_order\state\Offline
;
use
Lib\cdz_order\state\Online
;
use
Lib\Log
;
use
Lib\order_exception\OrderState
;
use
Lib\port\Port
;
use
Lib\rabbitmq\PublishPortShed
;
use
Lib\redis\RedisKey
;
use
Lib\send\command\StopChargerCommand
;
use
Lib\send\Send
;
use
Lib\state\StateCode
;
class
AccessController
extends
Controller
{
...
...
@@ -55,8 +57,12 @@ class AccessController extends Controller
$gateway
=
$gatewayModel
->
getColumns
([
'id'
,
'station_id'
],
" mac_address = '
$mac
' "
);
Log
::
debug
(
'gateway_info'
,
$gateway
);
if
(
$gateway
===
false
)
{
Gateway
::
closeClient
(
$this
->
clientId
);
return
;
}
if
(
count
(
$gateway
)
!==
0
)
{
$gatewayId
=
$gateway
[
'id'
];
...
...
@@ -116,7 +122,6 @@ class AccessController extends Controller
$sessionId
.=
$hex
;
}
$this
->
response
->
send
(
'02'
,
$sessionId
);
}
else
{
...
...
@@ -142,6 +147,8 @@ class AccessController extends Controller
Log
::
debug
(
'端口同步'
);
$stopCommandArray
=
[];
$startLogicNum
=
$this
->
get
(
'start_num'
);
$startLogicNumDec
=
hexdec
(
$startLogicNum
);
...
...
@@ -220,13 +227,19 @@ class AccessController extends Controller
$responseOrder
=
[];
$orderModel
=
new
OrderModel
();
foreach
(
$portIdState
as
$id
=>
$state
)
{
$port
->
setId
(
$id
);
$orderId
=
$port
->
getPortUsingOrderId
(
$redis
,
$id
);
if
(
isset
(
$orderId
)
===
false
||
$orderId
===
false
||
$orderId
==
0
)
{
Log
::
debug
(
'缺少orderId'
);
continue
;
}
else
{
...
...
@@ -235,13 +248,69 @@ class AccessController extends Controller
$order
->
setId
(
$orderId
);
if
(
$order
->
getOrderCache
(
$redis
)
!==
false
)
{
//插口脱落重新推送定时任务
Log
::
debug
(
$offlineReason
);
//订单从离线的状态变为正在充电状态
$orderState
=
new
Offline
(
$order
,
$redis
,
$offlineReason
);
if
(
$state
===
StateCode
::
PORT_SHED
)
{
try
{
$time
=
time
();
$publish
=
new
PublishPortShed
();
$publish
->
publishOrder
([
'order_id'
=>
$order
->
getId
(),
'time'
=>
date
(
'Y-m-d H:i:s'
),
'gateway_mac'
=>
$_SESSION
[
'gateway_mac'
],
'shed_time'
=>
$time
,
]);
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$orderState
->
setShedTime
(
$time
);
$orderState
->
getSaveOrder
()
->
saveShedTime
();
}
$orderState
->
toCharger
();
$orderId
=
$order
->
getId
();
$orderStateCode
=
$orderModel
->
getColumn
(
'state'
,
'id = '
.
$orderId
);
if
(
$orderStateCode
==
3
)
{
$stopCommand
=
new
StopChargerCommand
();
$stopCommand
->
setOrderId
(
$orderId
);
$stopCommand
->
setLogicNum
(
$order
->
getPortLogicId
());
$stopCommand
->
setGatewayMac
(
$order
->
getGatewayMac
());
$stopCommand
->
setFinishType
(
43
);
$stopCommand
->
setClientUid
(
$order
->
getGatewayMac
());
array_push
(
$stopCommandArray
,
$stopCommand
);
unset
(
$stopCommand
);
}
$remainChargerTime
=
$orderState
->
getRemainChargerTime
();
if
(
$remainChargerTime
>
0
)
{
...
...
@@ -253,19 +322,41 @@ class AccessController extends Controller
sprintf
(
'%04x'
,
$remainChargerTime
),
]);
if
(
$orderStateCode
!=
3
)
{
$offlineTimeLength
=
(
int
)
$orderState
->
getOnlineTime
()
-
(
int
)
$orderState
->
getOfflineTime
();
$orderState
->
setStartTime
((
int
)
strtotime
(
$orderState
->
getStartTime
())
+
(
int
)
$offlineTimeLength
);
$orderState
->
getSaveOrder
()
->
saveStartTime
();
$userId
=
$order
->
getUserId
();
if
(
Gateway
::
isUidOnline
(
$userId
)
===
1
)
{
Gateway
::
sendToUid
(
$userId
,
json_encode
([
'code'
=>
10000
]));
}
}
}
else
{
Log
::
debug
(
'剩余充电时间小于0'
);
}
unset
(
$order
);
}
else
{
Log
::
debug
(
'同步订单找不到redis'
);
}
Log
::
debug
(
'using order'
,
$responseOrder
);
}
unset
(
$order
);
}
$orderCount
=
sprintf
(
'%02x'
,
count
(
$responseOrder
));
...
...
@@ -277,9 +368,18 @@ class AccessController extends Controller
}
$this
->
response
->
send
(
'03'
,
$startLogicNum
.
$count
.
$totalCount
.
$orderCount
.
$responseOrderMessage
);
foreach
(
$stopCommandArray
as
$stopCommand
)
{
$send
=
new
Send
(
$stopCommand
);
$messageData
=
$send
->
makeMessage
();
Gateway
::
sendToCurrentClient
(
$messageData
);
unset
(
$send
);
}
}
...
...
Application/Controller/AmmeterController.php
0 → 100644
View file @
4e6e37f7
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/7/24
* Time: 下午2:41
*/
namespace
Application\Controller
;
use
Application\Controller
;
class
AmmeterController
extends
Controller
{
protected
$parameterMap
=
[
'06'
=>
[
'capacity'
=>
6
]
];
public
function
record
()
{
}
}
\ No newline at end of file
Application/Controller/HeartController.php
View file @
4e6e37f7
...
...
@@ -10,6 +10,7 @@ namespace Application\Controller;
use
Application\Controller
;
use
GatewayWorker\Lib\Gateway
;
use
Lib\Log
;
class
HeartController
extends
Controller
...
...
@@ -27,9 +28,25 @@ class HeartController extends Controller
$time
=
sprintf
(
'%08x'
,
time
());
if
(
isset
(
$_SESSION
[
'gateway_mac'
])
===
false
)
{
Log
::
error
(
'心跳包未找到gateway_mac,断开连接'
);
try
{
Gateway
::
closeCurrentClient
();
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
}
Log
::
debug
(
"[heart]"
,
[
'gateway_id'
=>
$_SESSION
[
'gateway_id'
]
,
'gateway_id'
=>
isset
(
$_SESSION
[
'gateway_id'
])
?
$_SESSION
[
'gateway_id'
]
:
''
,
'data'
=>
$this
->
message
,
'length'
=>
hexdec
(
substr
(
$this
->
message
,
4
*
2
,
4
)),
...
...
Application/Controller/PortController.php
View file @
4e6e37f7
...
...
@@ -15,7 +15,6 @@ use Application\Model\OrderExceptionModel;
use
Application\Model\OrderModel
;
use
Application\Model\PortModel
;
use
Application\Model\StationModel
;
use
function
GuzzleHttp
\Psr7\str
;
use
Lib\api\message\ChargerReloadMessage
;
use
Lib\api\message\ChargerStartMessage
;
use
Lib\api\message\PortShedMessage
;
...
...
@@ -25,7 +24,6 @@ use Lib\cdz_order\state\Charger;
use
Lib\cdz_order\state\WaitingCharger
;
use
Lib\Gateway
;
use
Lib\Log
;
use
Lib\order_exception\OrderState
;
use
Lib\port\Port
;
use
Lib\rabbitmq\PublishPortShed
;
use
Lib\state\StateCode
;
...
...
@@ -147,13 +145,13 @@ class PortController extends Controller
foreach
(
$offlinePortId
as
$portId
)
{
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
$order
=
new
Order
();
$order
->
setId
(
$orderId
);
$charger
=
new
Charger
(
$order
,
\Events
::
getRedis
());
$charger
=
new
Charger
(
$order
,
\Events
::
getRedis
());
$charger
->
toOffline
();
...
...
@@ -179,8 +177,6 @@ class PortController extends Controller
$nowTime
=
date
(
'Y-m-d H:i:s'
);
Log
::
debug
(
'口子状态改变'
,
$this
->
getRequest
()
->
getParameters
());
$portMac
=
$this
->
get
(
'mac'
);
$state
=
$this
->
get
(
'state'
);
...
...
@@ -197,8 +193,6 @@ class PortController extends Controller
$lastState
=
$port
->
getState
(
$portId
);
Log
::
debug
(
'口子状态改变-->原状态为->'
.
$lastState
.
'更新->'
.
$state
);
if
(
$state
===
StateCode
::
PORT_EXCEPTION
)
{
//口子当前状态为异常,下位机会发送充电结束命令状态为中为异常,所以此处不处理,或者只记录
...
...
@@ -224,7 +218,7 @@ class PortController extends Controller
$order
->
setId
(
$orderId
);
$waiting
=
new
WaitingCharger
(
$order
,
\Events
::
getRedis
());
$waiting
=
new
WaitingCharger
(
$order
,
\Events
::
getRedis
());
$waiting
->
toCharger
();
...
...
@@ -240,25 +234,6 @@ class PortController extends Controller
$update
=
[
'shed_time'
=>
$nowTime
];
// $orderLastState = OrderState::getState($orderId);
//
// if ($orderLastState == StateCode::PORT_SHED) {
//
// if (isset($lastShedTime)) {
// $gapTime = strtotime($nowTime) - strtotime($lastShedTime);
//
// if (($gapTime / 60) > 12) {
//
// //fixme debug
//
// //口子距离上一次插口脱落时间超过了十分中,下发结束充电命令
// //发送结束充电,结束状态为远程超时结束
//
// Log::debug('todo 插口脱落超时10分钟');
//
// }
// }
// }
$orderModel
->
update
(
$update
,
'id = '
.
$orderId
);
...
...
@@ -309,19 +284,6 @@ class PortController extends Controller
}
if
(
$state
!==
StateCode
::
PORT_CHARGER
)
{
$orderModel
=
new
OrderModel
();
if
(
isset
(
$orderId
)
===
false
)
{
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
}
$orderModel
->
update
([
'is_exception'
=>
1
],
'id = '
.
$orderId
);
}
}
$redis
=
\Events
::
getRedis
();
...
...
@@ -365,9 +327,8 @@ class PortController extends Controller
$order
->
setId
(
$orderId
);
if
(
$order
->
getOrderCache
(
$redis
)
!==
false
)
{
$waiting
=
new
WaitingCharger
(
$order
,
$redis
);
if
(
$order
->
getOrderCache
(
$redis
)
!==
false
)
{
$waiting
=
new
WaitingCharger
(
$order
,
$redis
);
$waiting
->
toCharger
();
...
...
@@ -378,7 +339,7 @@ class PortController extends Controller
$chargerStartMessage
->
setAmount
(
number_format
(
$result
[
'order_amount'
]
/
100
,
2
));
$chargerStartMessage
->
setAddress
(
$result
[
'station_name'
]
.
'
('
.
$result
[
'port_name'
]
.
')'
);
$chargerStartMessage
->
setAddress
(
$result
[
'station_name'
]
.
'
-'
.
$result
[
'port_name'
]
);
$push
=
new
Push
();
...
...
@@ -437,6 +398,15 @@ class PortController extends Controller
}
//订单状态修改
$order
=
new
Order
();
$order
->
setId
(
$orderId
);
$charger
=
new
Charger
(
$order
,
$redis
);
$charger
->
toPortShed
();
//发送延迟任务
try
{
...
...
@@ -444,10 +414,6 @@ class PortController extends Controller
$publishPortShedJob
=
new
PublishPortShed
();
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$publishPortShedJob
->
publishOrder
(
[
'order_id'
=>
$orderId
,
...
...
@@ -456,6 +422,11 @@ class PortController extends Controller
]
);
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
}
break
;
...
...
Application/Controller/PortStateController.php
0 → 100644
View file @
4e6e37f7
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/7/18
* Time: 上午10:16
*/
namespace
Application\Controller
;
use
Application\Controller
;
use
Application\Model\OrderModel
;
use
Lib\cdz_order\Order
;
use
Lib\cdz_order\state\Charger
;
use
Lib\cdz_order\state\PortShed
;
use
Lib\cdz_order\state\State
;
use
Lib\cdz_order\state\WaitingCharger
;
use
Lib\Log
;
use
Lib\port\Port
;
use
Lib\state\StateCode
;
class
PortStateController
extends
Controller
{
protected
$parameterMap
=
[
'0B'
=>
[
'logic'
=>
1
,
'mac'
=>
8
,
'state'
=>
1
,
],
];
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
change
()
{
Log
::
debug
(
'口子状态改变'
);
$portMac
=
$this
->
get
(
'mac'
);
$state
=
$this
->
get
(
'state'
);
$state
=
hexdec
(
$state
);
$portMacId
=
$_SESSION
[
'port_mac_id'
];
if
(
!
isset
(
$portMacId
[
$portMac
]))
{
Log
::
error
(
'口子状态改变,session中缺少口子的mac地址与id的映射'
);
return
;
}
$portId
=
$portMacId
[
$portMac
];
$port
=
new
Port
();
$port
->
setId
(
$portId
);
$redis
=
\Events
::
getRedis
();
$usingOrderId
=
$port
->
getPortUsingOrderId
(
$redis
,
$portId
);
$portState
=
$port
->
getState
(
$portId
);
if
(
!
(
$portState
==
-
1
&&
$state
==
StateCode
::
PORT_SHED
))
{
$port
->
setPortState
([
$portId
=>
$state
]);
}
if
(
$usingOrderId
===
0
)
{
$port
->
setPortState
([
$portId
=>
$state
]);
return
;
}
$order
=
new
Order
();
$order
->
setId
(
$usingOrderId
);
if
(
$order
->
getOrderCache
(
$redis
)
===
false
)
{
Log
::
error
(
'using order -> '
.
$usingOrderId
.
'<-redis中缺失订单信息'
);
return
;
}
$orderStateCode
=
$order
->
getStateCode
();
$orderState
=
''
;
Log
::
debug
(
'port state ->'
.
$orderStateCode
);
//订单原本的状态对象生成
switch
(
$orderStateCode
)
{
case
StateCode
::
PORT_CHARGER
:
$orderState
=
new
Charger
(
$order
,
$redis
);
Log
::
debug
(
'创建充电状态'
);
break
;
case
StateCode
::
PORT_SHED
:
$orderState
=
new
PortShed
(
$order
,
$redis
);
Log
::
debug
(
'订单脱落状态'
);
break
;
case
StateCode
::
WAITING
:
$orderState
=
new
WaitingCharger
(
$order
,
$redis
);
break
;
default
:
break
;
}
if
(
!
(
$orderState
instanceof
State
))
{
Log
::
error
(
'口子状态改变缺少该state 类'
.
"(
$state
)"
);
return
;
}
//根据现有的状态修改状态
Log
::
debug
(
'state->'
.
$state
);
switch
(
$state
)
{
case
StateCode
::
PORT_CHARGER
:
$orderState
->
toCharger
();
if
(
$orderState
instanceof
WaitingCharger
)
{
$orderModel
=
new
OrderModel
();
$date
=
date
(
'Y-m-d H:i:s'
);
$orderModel
->
update
([
'is_charger'
=>
$state
,
'start_time'
=>
$date
,
'updated_at'
=>
$date
],
'id = '
.
$usingOrderId
);
}
break
;
case
StateCode
::
PORT_SHED
:
$orderState
->
toPortShed
();
break
;
default
:
break
;
}
}
}
\ No newline at end of file
Application/Controller/PowerController.php
View file @
4e6e37f7
...
...
@@ -18,9 +18,12 @@ use Lib\api\message\ChargerExceptionMessage;
use
Lib\api\message\ChargerFinishMessage
;
use
Lib\api\message\ChargerRefundMessage
;
use
Lib\api\message\ChargerStartMessage
;
use
Lib\api\message\PortShedMessage
;
use
Lib\api\message\Push
;
use
Lib\cdz_order\Order
;
use
Lib\cdz_order\state\Charger
;
use
Lib\cdz_order\state\PortShed
;
use
Lib\cdz_order\state\State
;
use
Lib\cdz_order\state\WaitingCharger
;
use
Lib\Gateway
;
use
Lib\Log
;
...
...
@@ -64,6 +67,7 @@ class PowerController extends Controller
'state'
=>
1
,
'orderId'
=>
6
,
'capacity'
=>
4
,
'finish_type'
=>
1
,
],
'07'
=>
[
...
...
@@ -98,86 +102,156 @@ class PowerController extends Controller
$orderId
=
$this
->
get
(
'orderId'
);
if
(
$type
==
1
)
{
$id
=
hexdec
(
$orderId
);
$logic
=
$this
->
get
(
'logic'
);
$logic
=
hexdec
(
$this
->
get
(
'logic'
)
);
$power
=
$this
->
get
(
'capacity'
);
$power
=
hexdec
(
$this
->
get
(
'capacity'
)
);
$state
=
hexdec
(
$this
->
get
(
'state'
));
$orderModel
=
new
OrderModel
();
$order
=
new
Order
();
$id
=
hexdec
(
$orderId
);
$order
->
setId
(
$id
);
//订单对应的逻辑地址与redis中的不同,则该开始充电消息作废
if
(
$order
->
getOrderCache
(
\Events
::
getRedis
())
!==
false
)
{
$currentLogicNum
=
$order
->
getPortLogicId
();
$_SESSION
[
'order_state'
]
=
$state
;
if
(
$currentLogicNum
!=
$logic
)
{
$this
->
response
->
send
(
'14'
,
$orderId
);
$orderCollection
=
$orderModel
->
getColumns
([
'wx_user_id'
,
'port_name'
,
'order_amount'
,
'port_id'
],
'id = '
.
$id
);
return
;
}
$_SESSION
[
'current_order_id'
][
strval
(
$orderCollection
[
'port_id'
])]
=
$id
;
}
if
(
$logic
!=
$order
->
getPortLogicId
()
||
$_SESSION
[
'gateway_id'
]
!=
$order
->
getGatewayId
())
{
$this
->
response
->
send
(
'14'
,
$orderId
);
return
;
}
if
(
$type
==
1
)
{
Log
::
debug
(
'start_power'
,
[
$orderId
,
$power
]);
$orderModel
=
new
OrderModel
();
$portId
=
$order
->
getPortId
();
$_SESSION
[
'current_order_id'
][
strval
(
$portId
)]
=
$id
;
$update
=
[
'is_charger'
=>
$state
,
'start_capacity'
=>
$power
];
$userId
=
$order
Collection
[
'wx_user_id'
]
;
$userId
=
$order
->
getUserId
()
;
$portName
=
$orderCollection
[
'port_name'
];
$
stationName
=
$_SESSION
[
'station_name'
]
;
$
portName
=
$order
->
getPortName
()
;
$
order
=
new
Order
()
;
$
stationName
=
$_SESSION
[
'station_name'
]
;
$order
->
setId
(
$id
);
$redis
=
\Events
::
getRedis
();
$orderAmount
=
$order
->
getPayAmount
();
if
(
$order
->
getOrderCache
(
$redis
)
!==
false
)
{
$waiting
=
new
WaitingCharger
(
$order
,
$redis
);
if
(
$state
===
StateCode
::
PORT_CHARGER
)
{
$timeNow
=
date
(
'Y-m-d H:i:s'
);
$update
[
'start_time'
]
=
$timeNow
;
}
else
{
$
orderAmount
=
$orderCollection
[
'order_amount'
]
;
$
this
->
response
->
send
(
'14'
,
$orderId
)
;
$pushMessage
=
new
ChargerStartMessage
(
);
Log
::
error
(
'开始充电缺失订单'
);
$pushMessage
->
setAmount
(
number_format
(
$orderAmount
/
100
,
2
))
;
return
;
$pushMessage
->
setAddress
(
$stationName
.
'-'
.
$portName
.
'号'
);
}
if
(
$order
->
getOrderCache
(
$redis
)
!==
false
)
if
(
$state
!==
14
)
//未插上不更新数据库,依然为等待充电
{
$waiting
=
new
WaitingCharger
(
$order
,
$redis
);
$row
=
$orderModel
->
update
(
$update
,
'id = '
.
$id
);
$waiting
->
toCharger
();
$port
=
new
Port
();
$port
->
setPortState
([
$portId
=>
(
$state
)]);
}
if
(
$state
===
StateCode
::
PORT_CHARGER
)
{
$waiting
->
toCharger
();
$timeNow
=
date
(
'Y-m-d H:i:s'
);
$update
[
'start_time'
]
=
$timeNow
;
$update
[
'updated_at'
]
=
$timeNow
;
// $pushMessage = new ChargerStartMessage();
//
// $pushMessage->setAmount(number_format($orderAmount / 100, 2));
//
// $pushMessage->setAddress($stationName . '-' . $portName . '号');
//
// $pushMessage->setRemark($pushMessage->getRemark() . '(' . $orderId . ')');
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$orderId
);
$orderTrace
->
writeRawTrace
(
'1112'
,
'订单开始充电'
);
}
else
if
(
$state
===
StateCode
::
PORT_EXCEPTION
)
{
Log
::
debug
(
'waiting to exception'
);
$pushMessage
=
new
ChargerExceptionMessage
();
$pushMessage
->
setAddress
(
$stationName
.
"(
$portName
)"
);
$orderAmount
=
number_format
(
$orderCollection
[
'order_amount'
]
/
100
,
2
);
$pushMessage
->
setAmount
(
$orderAmount
);
$pushMessage
->
setAmount
(
number_format
(
$orderAmount
/
100
,
2
));
$pushMessage
->
setOrderId
(
$orderId
);
}
else
if
(
$state
===
StateCode
::
PORT_ONLINE
)
{
$port
=
new
Port
();
$port
->
setPortState
([
$portId
=>
(
$state
)]);
$this
->
response
->
send
(
'14'
,
$orderId
);
return
;
}
else
if
(
$state
===
StateCode
::
PORT_SHED
)
{
$port
=
new
Port
();
$port
->
setPortState
([
$portId
=>
-
1
]);
$this
->
response
->
send
(
'14'
,
$orderId
);
return
;
}
try
{
$push
=
new
Push
();
if
(
isset
(
$pushMessage
))
{
$push
=
new
Push
();
$push
->
push
(
$pushMessage
,
$userId
);
}
...
...
@@ -190,35 +264,195 @@ class PowerController extends Controller
Gateway
::
sendToUid
(
$userId
,
json_encode
([
'code'
=>
10000
]));
}
else
{
Log
::
debug
(
$userId
.
'用户webSocket不在线'
);
}
if
(
$state
!==
14
)
//未插上不更新数据库,依然为等待充电
}
$this
->
response
->
send
(
'14'
,
$orderId
);
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
finish
()
{
$row
=
$orderModel
->
update
(
$update
,
'id = '
.
$id
);
$portId
=
$orderModel
->
getPortId
(
$id
);
$orderIdHex
=
$this
->
get
(
'orderId'
);
$orderId
=
hexdec
(
$orderIdHex
);
$logic
=
hexdec
(
$this
->
get
(
'logic'
));
$state
=
hexdec
(
$this
->
get
(
'state'
));
$capacity
=
hexdec
(
$this
->
get
(
'capacity'
));
$order
=
new
Order
();
$order
->
setId
(
$orderId
);
$redis
=
\Events
::
getRedis
();
Log
::
debug
(
'finish'
,
$this
->
getRequest
()
->
getParameters
());
if
(
$order
->
getOrderCache
(
$redis
)
===
false
)
{
$this
->
response
->
send
(
'15'
,
$orderIdHex
);
return
;
}
if
(
$logic
!=
$order
->
getPortLogicId
()
||
$_SESSION
[
'gateway_id'
]
!=
$order
->
getGatewayId
())
{
$port
=
new
Port
();
$port
->
setPortState
([
$portId
=>
(
$state
)]);
$port
->
setLogic
(
$logic
);
$portId
=
$port
->
getIdByLogic
();
$port
->
setId
(
$portId
);
$port
->
freePort
();
$this
->
response
->
send
(
'15'
,
$orderIdHex
);
return
;
}
//记录订单的轨迹
$orderTrace
=
new
OrderTrace
(
$state
);
$orderStateCode
=
$order
->
getStateCode
();
$orderTrace
->
setOrderId
(
$orderId
)
;
$orderState
=
''
;
$orderTrace
->
writeTrace
();
switch
(
$orderStateCode
)
{
case
StateCode
::
WAITING
:
$orderState
=
new
WaitingCharger
(
$order
,
$redis
);
Log
::
debug
(
'等待充电状态订单'
);
break
;
case
StateCode
::
PORT_CHARGER
:
$orderState
=
new
Charger
(
$order
,
$redis
);
Log
::
debug
(
'正在充电订单'
);
break
;
case
StateCode
::
PORT_SHED
:
$orderState
=
new
PortShed
(
$order
,
$redis
);
Log
::
debug
(
'口子脱落订单'
);
break
;
default
:
break
;
}
$this
->
response
->
send
(
'14'
,
$orderId
);
$order
->
setEndCapacity
(
$capacity
);
$orderState
->
setEndTime
(
date
(
'Y-m-d H:i:s'
));
$orderState
->
setFinishState
(
$state
);
switch
(
$state
)
{
case
StateCode
::
FINISH_TIME_END
:
$orderState
->
toFinish
();
break
;
case
StateCode
::
FINISH_REMOTE
:
break
;
case
StateCode
::
FINISH_FULL
:
$orderState
->
toFull
();
break
;
case
StateCode
::
FINISH_EXCEED
:
$orderState
->
toFinishPowerExceed
();
break
;
case
StateCode
::
FINISH_USER
:
$orderState
->
toFinishByUser
();
break
;
case
StateCode
::
FINISH_SHED_TIMEOUT
:
$orderState
->
toFinishShed
();
break
;
case
StateCode
::
FINISH_REFUND
:
$orderState
->
toFinish
();
break
;
default
:
break
;
}
$port
=
new
Port
();
if
(
$logic
==
$order
->
getPortLogicId
())
{
$port
->
setId
(
$order
->
getPortId
());
$port
->
freePort
();
$orderState
->
destroy
();
}
$userId
=
$order
->
getUserId
();
if
(
Gateway
::
isUidOnline
(
$userId
)
===
1
)
{
Gateway
::
sendToUid
(
$userId
,
json_encode
([
'code'
=>
10000
]));
}
$this
->
response
->
send
(
'15'
,
$orderIdHex
);
}
/**
* 硬件充电结束
...
...
@@ -258,6 +492,8 @@ class PowerController extends Controller
$portId
=
$port
->
getIdByLogic
();
Log
::
debug
(
'port_id ->'
.
$portId
);
try
{
//记录订单轨迹
...
...
@@ -274,7 +510,7 @@ class PowerController extends Controller
// 发送微信消息给用户。
// 充电结束时删除端口正在使用的hash表中的元素,删除充电用户正在充电订单中的本次订单
$orderInfo
=
$orderModel
->
getColumns
([
'port_id'
,
'wx_user_id'
,
'is_charger'
,
'port_name'
,
'station_name'
,
'out_trade_no'
,
'order_amount'
,
'
wx_user_id'
,
'
start_time'
,
'charger_time'
],
'id = '
.
$id
);
$orderInfo
=
$orderModel
->
getColumns
([
'port_id'
,
'wx_user_id'
,
'is_charger'
,
'port_name'
,
'station_name'
,
'out_trade_no'
,
'order_amount'
,
'start_time'
,
'charger_time'
],
'id = '
.
$id
);
if
((
int
)
$portId
!==
(
int
)
$orderInfo
[
'port_id'
])
{
//fixme 使用logicNum查找到portId比对订单中的口子id是否相同,如果不相同则不处理(为转换口子之前的口子,释放口子即可)
...
...
@@ -301,11 +537,6 @@ class PowerController extends Controller
$userId
=
$orderInfo
[
'wx_user_id'
];
if
(
Gateway
::
isUidOnline
(
$userId
)
===
1
)
{
Gateway
::
sendToUid
(
$userId
,
json_encode
([
'code'
=>
10000
]));
}
$port
->
setId
(
$portId
);
$port
->
freePort
();
...
...
@@ -314,7 +545,7 @@ class PowerController extends Controller
$order
->
setId
(
$id
);
$chargerState
=
new
Charger
(
$order
,
\Events
::
getRedis
());
$chargerState
=
new
Charger
(
$order
,
\Events
::
getRedis
());
$chargerState
->
setFinishState
(
$state
);
...
...
@@ -448,7 +679,10 @@ class PowerController extends Controller
}
unset
(
$_SESSION
[
'current_order_id'
]);
if
(
Gateway
::
isUidOnline
(
$userId
)
===
1
)
{
Gateway
::
sendToUid
(
$userId
,
json_encode
([
'code'
=>
10000
]));
}
$this
->
response
->
send
(
'15'
,
$orderId
);
...
...
@@ -474,7 +708,27 @@ class PowerController extends Controller
//todo 依据状态修改订单中的状态,本地缓存该笔订单的状态,状态不发生改变则不更新数据库
$logic
=
$this
->
get
(
'logic'
);
$startTime
=
$this
->
get
(
'startTime'
);
$port
=
new
Port
();
if
(
isset
(
$_SESSION
[
'logic_port_id'
][
$logic
]))
{
$portId
=
$_SESSION
[
'logic_port_id'
][
$logic
];
}
else
{
$portId
=
$port
->
getIdByLogic
();
}
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
return
;
if
(
$orderId
!==
false
)
{
$startTime
=
hexdec
(
$this
->
get
(
'startTime'
));
$intervalTime
=
hexdec
(
$this
->
get
(
'intervalTime'
));
$count
=
$this
->
get
(
'count'
);
...
...
@@ -489,9 +743,28 @@ class PowerController extends Controller
$capacity
=
str_split
(
$capacity
,
8
);
Log
::
debug
(
'功率数据'
,
$powerData
);
$orderCapacity
=
new
OrderCapacityModel
();
try
{
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$orderCapacity
->
insertRow
([
'order_id'
=>
$orderId
,
'port_id'
=>
$portId
,
'capacity'
=>
hexdec
(
$capacity
[
$i
]),
'power'
=>
hexdec
(
$powerData
[
$i
]),
'created_at'
=>
strtotime
(
'Y-m-d H:i:s'
,
$startTime
+=
$intervalTime
),
]);
}
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
Log
::
debug
(
$this
->
message
);
}
}
...
...
@@ -503,7 +776,6 @@ class PowerController extends Controller
public
function
onePower
()
{
Log
::
debug
(
'上报功率(one)'
,
$this
->
getRequest
()
->
getParameters
());
$logicNum
=
$this
->
get
(
'logic'
);
...
...
@@ -515,7 +787,6 @@ class PowerController extends Controller
$port
->
setLogic
(
$logicNum
);
if
(
isset
(
$_SESSION
[
'logic_port_id'
][
$logicNum
]))
{
$portId
=
$_SESSION
[
'logic_port_id'
][
$logicNum
];
...
...
@@ -526,20 +797,11 @@ class PowerController extends Controller
}
if
(
isset
(
$_SESSION
[
'current_order_id'
][
$portId
]))
{
$orderId
=
$_SESSION
[
'current_order_id'
][
$portId
];
}
else
{
Log
::
info
(
'gatway session 缺少当前订单id'
);
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
Log
::
info
(
'从redis中获取当前订单 ->'
.
$orderId
);
if
(
$orderId
!==
false
)
{
}
$orderId
=
$port
->
getPortUsingOrderId
(
\Events
::
getRedis
(),
$portId
);
try
{
$orderCapacityModel
=
new
OrderCapacityModel
();
...
...
@@ -556,6 +818,10 @@ class PowerController extends Controller
}
}
else
{
Log
::
info
(
'gatway session 缺少当前订单id'
);
}
}
}
...
...
Application/Controller/PowerOffController.php
0 → 100644
View file @
4e6e37f7
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/7/27
* Time: 下午4:32
*/
namespace
Application\Controller
;
use
Application\Controller
;
use
Lib\Log
;
class
PowerOffController
extends
Controller
{
protected
$parameterMap
=
[
'0F'
=>
[]
];
public
function
powerOff
()
{
Log
::
debug
(
'断电提醒'
);
}
}
\ No newline at end of file
Application/Events.php
View file @
4e6e37f7
...
...
@@ -151,20 +151,17 @@ class Events
$redis
=
Events
::
getRedis
();
Log
::
debug
(
'disconnect'
);
if
(
isset
(
$_SESSION
[
'gateway_id'
])
===
true
)
{
Log
::
info
(
'gateway_id('
.
$_SESSION
[
'gateway_id'
]
.
')'
.
'disconnect'
);
$redis
->
zAdd
(
\Lib\redis\RedisKey
::
GATEWAY_STATE
,
0
,
$_SESSION
[
'gateway_id'
]);
}
else
{
Log
::
info
(
isset
(
$_SESSION
[
'gateway_mac'
])
?
$_SESSION
[
'gateway_mac'
]
:
''
);
Log
::
info
(
'gatway disconnect
'
);
Log
::
error
(
'网关离线缺少gatewayId
'
);
}
...
...
Lib/api/message/ChargerFullMessage.php
View file @
4e6e37f7
...
...
@@ -11,18 +11,148 @@ namespace Lib\api\message;
class
ChargerFullMessage
extends
MessageData
{
protected
$templateId
=
'rdzTNQ7t4uRXkP0SkuwW10WH77A_CIgYFiJykXJ0utU'
;
protected
$templateId
=
'rdzTNQ7t4uRXkP0SkuwW10WH77A_CIgYFiJykXJ0utU'
;
private
$first
=
''
;
/**
* @var string
*/
private
$first
=
'尊敬的用户,您的爱车已充满电,本次充电已结束 '
;
/**
* @var string
*/
private
$startTime
=
''
;
/**
* @var string
*/
private
$remark
=
'温馨提示:您的爱车已停止充电,如有疑问您可以在公众号后台留言或直接拨打客服热线进行咨询。
感谢您的使用'
;
private
$endTime
=
''
;
private
$purchaseTime
=
''
;
public
function
getPushDataJson
()
:
string
{
return
''
;
return
json_encode
([
'first'
=>
[
'value'
=>
$this
->
first
,
'color'
=>
'#333'
,
],
'keyword1'
=>
[
'value'
=>
$this
->
startTime
,
'color'
=>
'#333'
,
],
'keyword2'
=>
[
'value'
=>
$this
->
purchaseTime
,
'color'
=>
'#333'
,
],
'keyword3'
=>
[
'value'
=>
$this
->
endTime
,
'color'
=>
'#333'
,
],
'remark'
=>
[
'value'
=>
$this
->
remark
,
'color'
=>
'#333'
,
],
]);
}
/**
* @return string
*/
public
function
getTemplateId
()
:
string
{
return
$this
->
templateId
;
}
/**
* @return string
*/
public
function
getFirst
()
:
string
{
return
$this
->
first
;
}
/**
* @param string $first
*/
public
function
setFirst
(
string
$first
)
:
void
{
$this
->
first
=
$first
;
}
/**
* @return string
*/
public
function
getStartTime
()
:
string
{
return
$this
->
startTime
;
}
/**
* @param string $startTime
*/
public
function
setStartTime
(
string
$startTime
)
:
void
{
$this
->
startTime
=
$startTime
;
}
/**
* @return string
*/
public
function
getRemark
()
:
string
{
return
$this
->
remark
;
}
/**
* @param string $remark
*/
public
function
setRemark
(
string
$remark
)
:
void
{
$this
->
remark
=
$remark
;
}
/**
* @return string
*/
public
function
getEndTime
()
:
string
{
return
$this
->
endTime
;
}
/**
* @param string $endTime
*/
public
function
setEndTime
(
string
$endTime
)
:
void
{
$this
->
endTime
=
$endTime
;
}
/**
* @return string
*/
public
function
getPurchaseTime
()
:
string
{
return
$this
->
purchaseTime
;
}
/**
* @param string $purchaseTime
*/
public
function
setPurchaseTime
(
string
$purchaseTime
)
:
void
{
$this
->
purchaseTime
=
$purchaseTime
;
}
...
...
Lib/api/message/ChargerRefundMessage.php
View file @
4e6e37f7
...
...
@@ -34,7 +34,7 @@ class ChargerRefundMessage extends MessageData
private
$remark
=
'温馨提示:超时关闭此次交易,支付金额会在1个工作日内退回您的余额或零钱,请注意查看,若未收到请联系我们的客服为您处理。
若为充电口异常,请您及时更换至其它充电口充电
private
$remark
=
'温馨提示:超时关闭此次交易,支付金额会在1个工作日内退回您的余额或零钱,请注意查看,若未收到请联系我们的客服为您处理。
'
;
/**
...
...
Lib/api/message/ChargerReloadMessage.php
View file @
4e6e37f7
...
...
@@ -13,7 +13,7 @@ class ChargerReloadMessage extends MessageData
{
protected
$templateId
=
't_PyOGCKN_fmD0blw0EuIQs-8sS3qOTmpQay12haPZY'
;
private
$first
=
'
充电继续通知:
'
;
private
$first
=
'
尊敬的用户,检测到插头插入,您的爱车已开始继续充电
'
;
private
$stationName
=
''
;
...
...
Lib/api/message/ChargerShedTimeOutMessage.php
0 → 100644
View file @
4e6e37f7
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/7/19
* Time: 下午3:23
*/
namespace
Lib\api\message
;
class
ChargerShedTimeOutMessage
extends
MessageData
{
protected
$templateId
=
'rdzTNQ7t4uRXkP0SkuwW10WH77A_CIgYFiJykXJ0utU'
;
private
$first
=
'尊敬的用户,您的爱车插头脱落,等待10分钟未检测到插头重新插入,本次充电已结束 '
;
/**
* @var string
*/
private
$startTime
=
''
;
/**
* @var string
*/
private
$purchaseTime
=
''
;
/**
* @var string
*/
private
$endTime
=
''
;
/**
* @var string
*/
private
$remark
=
'温馨提示:您的爱车已停止充电,如有疑问您可以在公众号后台留言或直接拨打客服热线进行咨询。
感谢您的使用'
;
public
function
getPushDataJson
()
:
string
{
return
json_encode
([
'first'
=>
[
'value'
=>
$this
->
first
,
'color'
=>
'#333'
,
],
'keyword1'
=>
[
'value'
=>
$this
->
startTime
,
'color'
=>
'#333'
,
],
'keyword2'
=>
[
'value'
=>
$this
->
purchaseTime
,
'color'
=>
'#333'
,
],
'keyword3'
=>
[
'value'
=>
$this
->
endTime
,
'color'
=>
'#333'
,
],
'remark'
=>
[
'value'
=>
$this
->
remark
,
'color'
=>
'#333'
,
],
]);
}
/**
* @return string
*/
public
function
getTemplateId
()
:
string
{
return
$this
->
templateId
;
}
/**
* @return string
*/
public
function
getFirst
()
:
string
{
return
$this
->
first
;
}
/**
* @param string $first
*/
public
function
setFirst
(
string
$first
)
:
void
{
$this
->
first
=
$first
;
}
/**
* @return string
*/
public
function
getStartTime
()
:
string
{
return
$this
->
startTime
;
}
/**
* @param string $startTime
*/
public
function
setStartTime
(
string
$startTime
)
:
void
{
$this
->
startTime
=
$startTime
;
}
/**
* @return string
*/
public
function
getPurchaseTime
()
:
string
{
return
$this
->
purchaseTime
;
}
/**
* @param string $purchaseTime
*/
public
function
setPurchaseTime
(
string
$purchaseTime
)
:
void
{
$this
->
purchaseTime
=
$purchaseTime
;
}
/**
* @return string
*/
public
function
getEndTime
()
:
string
{
return
$this
->
endTime
;
}
/**
* @param string $endTime
*/
public
function
setEndTime
(
string
$endTime
)
:
void
{
$this
->
endTime
=
$endTime
;
}
/**
* @return string
*/
public
function
getRemark
()
:
string
{
return
$this
->
remark
;
}
/**
* @param string $remark
*/
public
function
setRemark
(
string
$remark
)
:
void
{
$this
->
remark
=
$remark
;
}
}
\ No newline at end of file
Lib/api/message/ChargerStartMessage.php
View file @
4e6e37f7
...
...
@@ -24,6 +24,8 @@ class ChargerStartMessage extends MessageData
private
$amount
;
private
$remark
=
'感谢你的使用'
;
public
function
__construct
()
{
...
...
@@ -58,7 +60,7 @@ class ChargerStartMessage extends MessageData
'color'
=>
'#333'
],
'remark'
=>
[
'value'
=>
'感谢你的使用'
,
'value'
=>
$this
->
remark
,
'color'
=>
'#333'
],
]);
...
...
@@ -135,5 +137,22 @@ class ChargerStartMessage extends MessageData
$this
->
amount
=
$amount
;
}
/**
* @return string
*/
public
function
getRemark
()
:
string
{
return
$this
->
remark
;
}
/**
* @param string $remark
*/
public
function
setRemark
(
string
$remark
)
:
void
{
$this
->
remark
=
$remark
;
}
}
\ No newline at end of file
Lib/cdz_order/Order.php
View file @
4e6e37f7
...
...
@@ -10,7 +10,6 @@ namespace Lib\cdz_order;
use
Lib\cdz_order\state\State
;
use
Lib\Log
;
class
Order
{
...
...
@@ -93,17 +92,40 @@ class Order
/**
* @var int
*/
private
$startCapacity
;
/**
* @var int
*/
private
$endCapacity
;
/**
* @var string
*/
private
$outTradeNo
;
/**
* @var int
*/
private
$isRefund
=
0
;
/**
* @param \Redis $redis
* @return array|bool
*/
public
function
getOrderCache
(
\Redis
$redis
)
{
if
(
isset
(
$this
->
orderCache
)
===
false
)
{
if
(
isset
(
$this
->
orderCache
)
==
false
||
(
is_array
(
$this
->
orderCache
)
&&
count
(
$this
->
orderCache
)
===
0
))
{
$keyName
=
State
::
ORDER_HASH_PREFIX
.
$this
->
id
;
if
(
$redis
->
exists
(
$keyName
)
==
=
false
)
{
if
(
$redis
->
exists
(
$keyName
)
==
false
)
{
return
false
;
...
...
@@ -111,6 +133,8 @@ class Order
$this
->
orderCache
=
$redis
->
hGetAll
(
$keyName
);
var_dump
(
$this
->
orderCache
);
foreach
(
$this
->
orderCache
as
$key
=>
$value
)
{
$this
->
$key
=
$value
;
...
...
@@ -124,6 +148,32 @@ class Order
/**
* @param \Redis $redis
* @return array|bool
*/
public
function
refreshOrderCache
(
\Redis
$redis
)
{
$keyName
=
State
::
ORDER_HASH_PREFIX
.
$this
->
id
;
if
(
$redis
->
exists
(
$keyName
)
==
false
)
{
return
false
;
}
$this
->
orderCache
=
$redis
->
hGetAll
(
$keyName
);
foreach
(
$this
->
orderCache
as
$key
=>
$value
)
{
$this
->
$key
=
$value
;
}
return
$this
->
orderCache
;
}
/**
* @param \Redis $redis
* @param $orderCache
*/
public
function
setOrderCache
(
\Redis
$redis
,
$orderCache
)
:
void
...
...
@@ -301,7 +351,7 @@ class Order
*/
public
function
getPortLogicId
()
:
int
{
return
$this
->
portLogicId
;
return
isset
(
$this
->
portLogicId
)
?
(
int
)
$this
->
portLogicId
:
0
;
}
/**
...
...
@@ -344,5 +394,69 @@ class Order
$this
->
stationName
=
$stationName
;
}
/**
* @return int
*/
public
function
getStartCapacity
()
:
int
{
return
$this
->
startCapacity
;
}
/**
* @param int $startCapacity
*/
public
function
setStartCapacity
(
int
$startCapacity
)
:
void
{
$this
->
startCapacity
=
$startCapacity
;
}
/**
* @return int
*/
public
function
getEndCapacity
()
:
int
{
return
$this
->
endCapacity
;
}
/**
* @param int $endCapacity
*/
public
function
setEndCapacity
(
int
$endCapacity
)
:
void
{
$this
->
endCapacity
=
$endCapacity
;
}
/**
* @return string
*/
public
function
getOutTradeNo
()
:
string
{
return
$this
->
outTradeNo
;
}
/**
* @param string $outTradeNo
*/
public
function
setOutTradeNo
(
string
$outTradeNo
)
:
void
{
$this
->
outTradeNo
=
$outTradeNo
;
}
/**
* @return int
*/
public
function
getisRefund
()
:
int
{
return
$this
->
isRefund
;
}
/**
* @param int $isRefund
*/
public
function
setIsRefund
(
int
$isRefund
)
:
void
{
$this
->
isRefund
=
$isRefund
;
}
}
\ No newline at end of file
Lib/cdz_order/order/SaveOrder.php
View file @
4e6e37f7
...
...
@@ -69,6 +69,18 @@ class SaveOrder
}
public
function
saveEndCapacity
()
{
$this
->
redis
->
hSet
(
$this
->
state
->
getKeyName
(),
'endCapacity'
,
$this
->
state
->
getOrder
()
->
getEndCapacity
());
}
public
function
saveStartCapacity
()
{
$this
->
redis
->
hSet
(
$this
->
state
->
getKeyName
(),
'startCapacity'
,
$this
->
state
->
getOrder
()
->
getStartCapacity
());
}
public
function
pipe
()
{
$this
->
state
->
getRedis
()
->
multi
(
2
);
...
...
Lib/cdz_order/state/Charger.php
View file @
4e6e37f7
...
...
@@ -9,10 +9,28 @@
namespace
Lib\cdz_order\state
;
use
Application\Model\OrderModel
;
use
Lib\api\message\ChargerExceedMessage
;
use
Lib\api\message\ChargerExceptionMessage
;
use
Lib\api\message\ChargerFinishMessage
;
use
Lib\api\message\ChargerFullMessage
;
use
Lib\api\message\PortShedMessage
;
use
Lib\api\message\Push
;
use
Lib\cdz_order\Order
;
use
Lib\Log
;
use
Lib\order_exception\OrderTrace
;
use
Lib\port\Port
;
use
Lib\rabbitmq\PublishPortShed
;
use
Lib\state\StateCode
;
class
Charger
extends
State
{
/**
* @var int
*/
protected
$selfStateCode
=
12
;
public
function
__construct
(
Order
$order
,
\Redis
$redis
)
{
parent
::
__construct
(
$order
,
$redis
);
}
public
function
toCharger
()
...
...
@@ -20,34 +38,271 @@ class Charger extends State
// TODO: Implement toCharger() method.
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$fullMessage
=
new
ChargerFullMessage
();
$fullMessage
->
setEndTime
(
$this
->
endTime
);
$fullMessage
->
setFirst
(
'尊敬的用户,本次充电已结束 (手动关闭)'
);
$fullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$fullMessage
->
setStartTime
(
$this
->
startTime
);
$push
=
new
Push
();
$push
->
push
(
$fullMessage
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1241
,
'正在充电 --> 用户主动结束'
);
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toPortShed
()
{
// TODO: Implement toPortShed() method.
$this
->
shedTime
=
time
();
$this
->
order
->
setStateCode
(
StateCode
::
PORT_SHED
);
$this
->
saveOrder
->
pipe
();
$this
->
saveOrder
->
saveStateCode
();
$this
->
saveOrder
->
saveShedTime
();
$port
=
new
Port
();
$port
->
setPortState
([
$this
->
order
->
getPortId
()
=>
14
]);
$this
->
saveOrder
->
exec
();
$shedMessage
=
new
PortShedMessage
();
$shedMessage
->
setStationName
(
$this
->
order
->
getStationName
());
$shedMessage
->
setPortName
(
$this
->
order
->
getPortName
());
$shedMessage
->
setWaitingTime
(
10
);
$shedMessage
->
setRemark
(
'超时将关闭此次交易哦,请尽快重连插头'
);
$shedMessage
->
setTime
(
date
(
'Y-m-d H:i:s'
));
$push
=
new
Push
();
try
{
$push
->
push
(
$shedMessage
,
$this
->
order
->
getUserId
());
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
try
{
$publishPortShedJob
=
new
PublishPortShed
();
$publishPortShedJob
->
publishOrder
(
[
'order_id'
=>
$this
->
order
->
getId
(),
'time'
=>
date
(
'Y-m-d H:i:s'
),
'gateway_mac'
=>
$_SESSION
[
'gateway_mac'
],
'shed_time'
=>
$this
->
shedTime
,
]
);
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$orderTrace
=
new
OrderTrace
();
$this
->
order
->
setCurrentState
(
new
PortShed
(
$this
->
order
,
$this
->
redis
));
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
write
(
$this
,
$this
->
order
->
getCurrentState
());
}
public
function
toPowerExceed
()
{
// TODO: Implement toPowerExceed() method.
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinishPowerExceed
()
{
$exceedMessage
=
new
ChargerExceedMessage
();
$exceedMessage
->
setStartTime
(
$this
->
startTime
);
$exceedMessage
->
setEndTime
(
$this
->
endTime
);
$exceedMessage
->
setChargerTime
(
$this
->
order
->
getPurchaseTime
());
$push
=
new
Push
();
$push
->
push
(
$exceedMessage
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1234
,
'正在充电 --> 功率超限'
);
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFull
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$fullMessage
=
new
ChargerFullMessage
();
$fullMessage
->
setStartTime
(
$this
->
startTime
);
$fullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$fullMessage
->
setEndTime
(
$this
->
endTime
);
$push
=
new
Push
();
$push
->
push
(
$fullMessage
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1233
,
'正在充电 --> 充满自停'
);
// TODO: Implement toFull() method.
}
/**
* 充电结束记录充电结束状态和结束充电时间
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinish
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$finishMessage
=
new
ChargerFinishMessage
();
$finishMessage
->
setEndTime
(
$this
->
endTime
);
$finishMessage
->
setUserId
(
$this
->
order
->
getUserId
());
$finishMessage
->
setChargerTime
(
$this
->
order
->
getPurchaseTime
());
$finishMessage
->
setChargerPlc
(
$this
->
order
->
getStationName
()
.
'-'
.
$this
->
order
->
getPortName
()
.
'号'
);
$finishMessage
->
setOrderAmount
(
$this
->
order
->
getPayAmount
());
$push
=
new
Push
();
try
{
$push
->
push
(
$finishMessage
,
$this
->
order
->
getUserId
());
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
'is_exception'
=>
0
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1230
,
'正在充电 --> 充电时间结束'
);
}
public
function
toOffline
()
{
$this
->
redis
->
hSet
(
$this
->
keyName
,
'offlineTime'
,
time
());
$this
->
redis
->
hSet
(
$this
->
keyName
,
'offlineTime'
,
time
());
// TODO: Implement toOffline() method.
}
...
...
Lib/cdz_order/state/Created.php
View file @
4e6e37f7
...
...
@@ -13,8 +13,23 @@ use Lib\cdz_order\Order;
class
Created
extends
State
{
/**
* @var int
*/
protected
$selfStateCode
=
1
;
public
function
__construct
(
Order
$order
,
\Redis
$redis
)
{
parent
::
__construct
(
$order
,
$redis
);
}
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
public
function
toCharger
()
{
...
...
Lib/cdz_order/state/Offline.php
View file @
4e6e37f7
...
...
@@ -10,11 +10,19 @@ namespace Lib\cdz_order\state;
use
Lib\cdz_order\Order
;
use
Lib\Gateway
;
use
Lib\Log
;
use
Lib\order_exception\OrderTrace
;
class
Offline
extends
State
{
public
function
__construct
(
Order
$order
,
\Redis
$redis
,
int
$offlineReason
)
/**
* @var int
*/
protected
$selfStateCode
=
10
;
public
function
__construct
(
Order
$order
,
\Redis
$redis
,
int
$offlineReason
=
0
)
{
parent
::
__construct
(
$order
,
$redis
);
...
...
@@ -22,6 +30,17 @@ class Offline extends State
}
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
/**
*记录了离线原因和上线时间
* 通过上线时间和离线时间根据离线原因计算剩余充电时间
...
...
@@ -30,41 +49,47 @@ class Offline extends State
{
$purchaseTime
=
$this
->
order
->
getPurchaseTime
();
$startTime
=
strtotime
(
$this
->
startTime
);
$this
->
onlineTime
=
time
();
if
(
$this
->
order
->
getStateCode
()
==
-
1
)
{
if
(
$this
->
order
->
getStateCode
()
==
-
1
)
{
$this
->
remainChargerTime
=
$this
->
order
->
getPurchaseTime
();
}
else
{
}
else
{
Log
::
debug
(
'off reason'
.
$this
->
offlineReason
);
$startTime
=
$this
->
getStartTime
();
$offlineTime
=
$this
->
getOfflineTime
();
if
(
$this
->
offlineReason
==
0
)
{
if
(
$this
->
offlineReason
==
1
)
{
$remainTime
=
$purchaseTime
*
60
-
(
$this
->
onlineTime
-
$startTime
);
$this
->
remainChargerTime
=
(
int
)(
$remainTime
/
60
);
$remainTime
=
$purchaseTime
*
60
-
(
$offlineTime
-
$startTime
);
Log
::
debug
(
'断网离线'
);
$this
->
remainChargerTime
=
(
int
)
ceil
(
$remainTime
/
60
);
}
else
{
$remainTime
=
$purchaseTime
*
60
-
(
$this
->
onlineTime
-
$startTime
);
$remainTime
=
$purchaseTime
*
60
-
((
int
)
$this
->
offlineTime
-
(
int
)
$startTime
);
$this
->
remainChargerTime
=
(
int
)(
$remainTime
/
60
);
$this
->
remainChargerTime
=
(
int
)
ceil
(
$remainTime
/
60
);
}
}
$this
->
saveOrder
->
savePortOnlineTime
();
$this
->
order
->
setCurrentState
(
new
Charger
(
$this
->
order
,
$this
->
redis
));
$orderTrace
=
new
OrderTrace
();
$this
->
order
->
setCurrentState
(
new
Charger
(
$this
->
order
,
\Events
::
getRedis
()));
$orderTrace
->
write
(
$this
,
$this
->
order
->
getCurrentState
());
}
...
...
Lib/cdz_order/state/Online.php
View file @
4e6e37f7
...
...
@@ -12,6 +12,19 @@ namespace Lib\cdz_order\state;
class
Online
extends
State
{
protected
$selfStateCode
=
11
;
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
public
function
toCharger
()
{
// TODO: Implement toCharger() method.
...
...
Lib/cdz_order/state/PortShed.php
View file @
4e6e37f7
...
...
@@ -9,8 +9,257 @@
namespace
Lib\cdz_order\state
;
class
PortShed
use
Application\Model\OrderModel
;
use
Lib\api\message\ChargerFinishMessage
;
use
Lib\api\message\ChargerFullMessage
;
use
Lib\api\message\ChargerReloadMessage
;
use
Lib\api\message\ChargerShedTimeOutMessage
;
use
Lib\api\message\PortShedMessage
;
use
Lib\api\message\Push
;
use
Lib\Log
;
use
Lib\order_exception\OrderTrace
;
use
Lib\port\Port
;
class
PortShed
extends
State
{
/**
*
* @var int
*/
protected
$selfStateCode
=
14
;
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinishByUser
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$fullMessage
=
new
ChargerFullMessage
();
$fullMessage
->
setEndTime
(
$this
->
endTime
);
$fullMessage
->
setFirst
(
'尊敬的用户,本次充电已结束 (手动关闭)'
);
$fullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$fullMessage
->
setStartTime
(
$this
->
startTime
);
$push
=
new
Push
();
$push
->
push
(
$fullMessage
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1441
,
'口子脱落 --> 用户主动结束'
);
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinishShed
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$shedTimeOutMessgae
=
new
ChargerShedTimeOutMessage
();
$shedTimeOutMessgae
->
setEndTime
(
$this
->
endTime
);
$shedTimeOutMessgae
->
setStartTime
(
$this
->
startTime
);
$shedTimeOutMessgae
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$push
=
new
Push
();
$push
->
push
(
$shedTimeOutMessgae
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1442
,
'口子脱落 --> 口子脱落超时结束'
);
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toCharger
()
{
$reloadMessage
=
new
ChargerReloadMessage
();
$reloadMessage
->
setPortName
(
$this
->
order
->
getPortName
());
$reloadMessage
->
setStationName
(
$this
->
order
->
getStationName
());
$push
=
new
Push
();
try
{
$push
->
push
(
$reloadMessage
,
$this
->
order
->
getUserId
());
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$this
->
order
->
setStateCode
(
12
);
$this
->
saveOrder
->
saveStateCode
();
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_charger'
=>
12
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$this
->
order
->
setCurrentState
(
new
Charger
(
$this
->
order
,
$this
->
redis
));
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
write
(
$this
,
$this
->
order
->
getCurrentState
());
$port
=
new
Port
();
$port
->
setPortState
([
$this
->
order
->
getPortId
()
=>
12
]);
}
public
function
toPortShed
()
{
Log
::
error
(
'order shed state can not change to shed'
);
// TODO: Implement toPortShed() method.
}
public
function
toPowerExceed
()
{
Log
::
error
(
'order shed state can not change to exceed'
);
// TODO: Implement toPowerExceed() method.
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFull
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$fullMessage
=
new
ChargerFullMessage
();
$fullMessage
->
setStartTime
(
$this
->
startTime
);
$fullMessage
->
setPurchaseTime
(
$this
->
order
->
getPurchaseTime
());
$fullMessage
->
setEndTime
(
$this
->
endTime
);
$push
=
new
Push
();
$push
->
push
(
$fullMessage
,
$this
->
order
->
getUserId
());
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
writeRawTrace
(
1433
,
'口子脱落 --> 充满自停'
);
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toFinish
()
{
$this
->
redis
->
hMSet
(
$this
->
keyName
,
[
'finishState'
=>
$this
->
finishState
,
'endTime'
=>
$this
->
endTime
]);
$finishMessage
=
new
ChargerFinishMessage
();
$finishMessage
->
setEndTime
(
$this
->
endTime
);
$finishMessage
->
setUserId
(
$this
->
order
->
getUserId
());
$finishMessage
->
setChargerTime
(
$this
->
order
->
getPurchaseTime
());
$finishMessage
->
setChargerPlc
(
$this
->
order
->
getStationName
()
.
'-'
.
$this
->
order
->
getPortName
());
$finishMessage
->
setOrderAmount
(
$this
->
order
->
getPayAmount
());
$push
=
new
Push
();
try
{
$push
->
push
(
$finishMessage
,
$this
->
order
->
getUserId
());
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'is_stop'
=>
$this
->
finishState
,
'updated_at'
=>
$this
->
endTime
,
'end_capacity'
=>
$this
->
order
->
getEndCapacity
(),
'end_time'
=>
$this
->
endTime
,
'state'
=>
1
,
],
'id = '
.
$this
->
order
->
getId
());
// TODO: Implement toFinish() method.
}
public
function
toOffline
()
{
$this
->
redis
->
hSet
(
$this
->
keyName
,
'offlineTime'
,
time
());
// TODO: Implement toOffline() method.
}
public
function
toOnline
()
{
// TODO: Implement toOnline() method.
}
}
\ No newline at end of file
Lib/cdz_order/state/Refund.php
0 → 100644
View file @
4e6e37f7
<?php
/**
* Created by PhpStorm.
* User: banice
* Date: 2018/7/20
* Time: 下午4:19
*/
namespace
Lib\cdz_order\state
;
class
Refund
extends
State
{
protected
$selfStateCode
=
3
;
public
function
toCharger
()
{
// TODO: Implement toCharger() method.
}
public
function
toPortShed
()
{
// TODO: Implement toPortShed() method.
}
public
function
toPowerExceed
()
{
// TODO: Implement toPowerExceed() method.
}
public
function
toFull
()
{
// TODO: Implement toFull() method.
}
public
function
toFinish
()
{
// TODO: Implement toFinish() method.
}
public
function
toOffline
()
{
// TODO: Implement toOffline() method.
}
public
function
toOnline
()
{
// TODO: Implement toOnline() method.
}
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
}
\ No newline at end of file
Lib/cdz_order/state/State.php
View file @
4e6e37f7
...
...
@@ -12,6 +12,8 @@ namespace Lib\cdz_order\state;
use
Lib\api\message\Push
;
use
Lib\cdz_order\Order
;
use
Lib\cdz_order\order\SaveOrder
;
use
Lib\order_exception\Exception
;
use
Lib\order_exception\OrderTrace
;
abstract
class
State
{
...
...
@@ -31,6 +33,12 @@ abstract class State
'stateCode'
,
];
/**
* @var int
*/
protected
$selfStateCode
;
/**
* 订单状态hash前缀
*/
...
...
@@ -50,7 +58,7 @@ abstract class State
/**
* @var string
*/
protected
$keyName
=
''
;
protected
$keyName
=
''
;
/**
...
...
@@ -100,15 +108,17 @@ abstract class State
* @var int
*/
protected
$finishState
;
/**
* State constructor.
* @param Order $order
*/
public
function
__construct
(
Order
$order
,
\Redis
$redis
)
{
public
function
__construct
(
Order
$order
,
\Redis
$redis
)
{
$this
->
order
=
$order
;
$this
->
keyName
=
self
::
ORDER_HASH_PREFIX
.
$order
->
getId
();
$this
->
keyName
=
self
::
ORDER_HASH_PREFIX
.
$order
->
getId
();
$this
->
redis
=
$redis
;
...
...
@@ -116,16 +126,18 @@ abstract class State
$orderCache
=
$order
->
getOrderCache
(
$redis
);
if
(
is_array
(
$orderCache
))
{
if
(
is_array
(
$orderCache
))
{
foreach
(
$orderCache
as
$key
=>
$value
)
{
if
(
isset
(
$value
)
===
true
)
{
if
(
property_exists
(
$this
,
$key
)
===
true
)
foreach
(
$orderCache
as
$key
=>
$value
)
{
if
(
isset
(
$value
)
===
true
)
{
if
(
property_exists
(
$this
,
$key
)
===
true
)
{
if
(
$key
==
'startTime'
)
{
$this
->
$key
=
$value
;
$value
=
date
(
'Y-m-d H:i:s'
,
$value
);
}
$this
->
$key
=
$value
;
}
}
}
...
...
@@ -148,6 +160,20 @@ abstract class State
abstract
public
function
toOnline
();
abstract
public
function
toFinishByUser
();
abstract
public
function
toFinishShed
();
/**
*删除订单redis副本
*/
public
function
destroy
()
{
$this
->
redis
->
del
(
$this
->
keyName
);
}
/**
* @return Order
*/
...
...
@@ -340,10 +366,70 @@ abstract class State
$this
->
finishState
=
$finishState
;
}
protected
function
orderTrace
(
int
$state
,
string
$desc
=
''
)
{
$desc
=
isset
(
Exception
::
STATE_MESSAGE
[
$state
])
?
Exception
::
STATE_MESSAGE
[
$state
]
:
$desc
;
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
}
/**
* @return int
*/
public
function
getSelfStateCode
()
:
int
{
return
$this
->
selfStateCode
;
}
/**
* @param int $selfStateCode
*/
public
function
setSelfStateCode
(
int
$selfStateCode
)
:
void
{
$this
->
selfStateCode
=
$selfStateCode
;
}
}
Lib/cdz_order/state/WaitingCharger.php
View file @
4e6e37f7
...
...
@@ -9,18 +9,42 @@
namespace
Lib\cdz_order\state
;
use
Application\Model\OrderModel
;
use
Lib\api\message\ChargerRefundMessage
;
use
Lib\api\message\ChargerStartMessage
;
use
Lib\api\message\Push
;
use
Lib\cdz_order\Order
;
use
Lib\Log
;
use
Lib\order_exception\OrderTrace
;
use
Lib\port\Port
;
class
WaitingCharger
extends
State
{
/**
* @var int
*/
protected
$selfStateCode
=
-
1
;
public
function
__construct
(
Order
$order
,
\Redis
$redis
)
{
parent
::
__construct
(
$order
,
$redis
);
}
public
function
toFinishByUser
()
{
// TODO: Implement toFinishByUser() method.
}
public
function
toFinishShed
()
{
// TODO: Implement toFinishShed() method.
}
/**
* 订单从等待充电转为开始充电状态
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
toCharger
()
:
void
public
function
toCharger
()
:
void
{
$this
->
setStartTime
(
time
());
...
...
@@ -29,13 +53,44 @@ class WaitingCharger extends State
$this
->
saveOrder
->
pipe
();
$this
->
saveOrder
->
saveStateCode
();
$this
->
saveOrder
->
saveStartTime
();
$this
->
saveOrder
->
saveStateCode
();
$this
->
saveOrder
->
exec
();
$this
->
order
->
setCurrentState
(
new
Charger
(
$this
->
order
,
$this
->
redis
));
$orderModel
=
new
OrderModel
();
$orderModel
->
update
([
'start_time'
=>
date
(
'Y-m-d H:i:s'
)],
'id = '
.
$this
->
order
->
getId
());
$charger
=
new
Charger
(
$this
->
order
,
$this
->
redis
);
$this
->
order
->
setCurrentState
(
$charger
);
$port
=
new
Port
();
$portId
=
$this
->
order
->
getPortId
();
$port
->
setPortState
([
$portId
=>
12
]);
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
write
(
$this
,
$charger
);
$pushMessage
=
new
ChargerStartMessage
();
$pushMessage
->
setAmount
(
number_format
(
$this
->
order
->
getPayAmount
()
/
100
,
2
));
$pushMessage
->
setAddress
(
$this
->
order
->
getStationName
()
.
'-'
.
$this
->
order
->
getPortName
()
.
'号'
);
$pushMessage
->
setRemark
(
$pushMessage
->
getRemark
()
.
'('
.
strtoupper
(
sprintf
(
'%012x'
,
$this
->
order
->
getId
()))
.
')'
);
$push
=
new
Push
();
$push
->
push
(
$pushMessage
,
$this
->
order
->
getUserId
());
}
...
...
@@ -45,7 +100,6 @@ class WaitingCharger extends State
*/
public
function
toPortShed
()
{
throw
new
\Exception
(
' waiting state can not change to port shed'
);
// TODO: Implement toPortShed() method.
}
...
...
@@ -71,9 +125,33 @@ class WaitingCharger extends State
// TODO: Implement toFull() method.
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
* 3分钟退款
*/
public
function
toFinish
()
{
$refundMessage
=
new
ChargerRefundMessage
();
$refundMessage
->
setOutTradeNo
(
$this
->
order
->
getOutTradeNo
());
$refundMessage
->
setOrderInfo
(
$this
->
order
->
getStationName
()
.
'-'
.
$this
->
order
->
getPortName
());
$refundMessage
->
setOrderFee
(
number_format
(
$this
->
order
->
getPayAmount
()
/
100
,
2
));
$refundMessage
->
setRemark
(
$refundMessage
->
getRemark
()
.
' ('
.
$this
->
order
->
getOutTradeNo
()
.
')'
);
$push
=
new
Push
();
$push
->
push
(
$refundMessage
,
$this
->
order
->
getUserId
());
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
write
(
$this
,
new
Refund
(
$this
->
order
,
$this
->
redis
));
// TODO: Implement toFinish() method.
}
...
...
@@ -86,7 +164,11 @@ class WaitingCharger extends State
$this
->
saveOrder
->
savePortOfflineTime
();
$this
->
order
->
setCurrentState
(
new
Offline
(
$this
->
order
,
$this
->
redis
));
$orderTrace
=
new
OrderTrace
();
$orderTrace
->
setOrderId
(
$this
->
order
->
getId
());
$orderTrace
->
write
(
$this
,
$this
->
order
->
getCurrentState
());
}
...
...
Lib/order_exception/Exception.php
View file @
4e6e37f7
...
...
@@ -13,7 +13,7 @@ class Exception
{
const
STATE_MESSAGE
=
[
'12'
=>
'开始充电'
,
'12'
=>
'开始充电
(充电中)
'
,
'10'
=>
'口子离线'
,
'11'
=>
'口子上线'
,
'13'
=>
'开始充电失败(异常)'
,
...
...
@@ -26,6 +26,12 @@ class Exception
'98'
=>
'更换充电口'
,
'97'
=>
'下发结束充电命令'
,
'96'
=>
'订单更换口子成功'
,
'41'
=>
'用户主动结束'
,
'42'
=>
'插口脱落超时结束'
,
'-1'
=>
'等待充电'
,
'3'
=>
'超时退款'
,
'1'
=>
'创建订单'
,
'43'
=>
'脱落超时结束'
,
];
...
...
Lib/order_exception/OrderTrace.php
View file @
4e6e37f7
...
...
@@ -10,6 +10,7 @@ namespace Lib\order_exception;
use
Application\Model\OrderExceptionModel
;
use
Lib\cdz_order\state\State
;
use
Lib\Log
;
class
OrderTrace
...
...
@@ -17,7 +18,7 @@ class OrderTrace
/**
* @var string
*/
private
$orderId
=
''
;
private
$orderId
=
''
;
/**
* @var string
...
...
@@ -34,7 +35,8 @@ class OrderTrace
* OrderTrace constructor.
* @param string $state
*/
public
function
__construct
(
$state
=
''
)
{
public
function
__construct
(
$state
=
''
)
{
$this
->
orderExceptionModel
=
new
OrderExceptionModel
();
...
...
@@ -68,13 +70,12 @@ class OrderTrace
public
function
writeTrace
()
{
if
(
!
isset
(
Exception
::
STATE_MESSAGE
[
$this
->
state
]))
{
Log
::
error
(
'记录订单异常无次state'
.
"(
$this->state
)"
);
if
(
!
isset
(
Exception
::
STATE_MESSAGE
[
$this
->
state
]))
{
Log
::
error
(
'记录订单异常无次state'
.
"(
$this->state
)"
);
return
;
return
;
}
try
{
try
{
$this
->
orderExceptionModel
->
insertRow
([
'state'
=>
$this
->
state
,
...
...
@@ -82,8 +83,7 @@ class OrderTrace
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'order_id'
=>
$this
->
orderId
,
]);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
...
...
@@ -96,23 +96,47 @@ class OrderTrace
* @param int $state
* @param string $message
*/
public
function
writeRawTrace
(
int
$state
,
string
$message
)
public
function
writeRawTrace
(
int
$state
,
string
$message
)
{
try
{
try
{
$this
->
orderExceptionModel
->
insertRow
([
'state'
=>
$state
,
'desc'
=>
$message
,
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'order_id'
=>
$this
->
orderId
'order_id'
=>
$this
->
orderId
,
]);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
Log
::
error
(
$exception
->
getMessage
());
}
}
/**
* 根据状态模式写入订单轨迹
* @param int $lastState
* @param int $currentState
*/
public
function
write
(
State
$lastState
,
State
$currentState
)
{
$lastState
=
$lastState
->
getSelfStateCode
();
$currentState
=
$currentState
->
getSelfStateCode
();
$this
->
orderExceptionModel
->
insertRow
([
'state'
=>
(
int
)(
$lastState
.
$currentState
),
'desc'
=>
Exception
::
STATE_MESSAGE
[
$lastState
]
.
'-->'
.
Exception
::
STATE_MESSAGE
[
$currentState
],
'created_at'
=>
date
(
'Y-m-d H:i:s'
),
'order_id'
=>
$this
->
orderId
,
]);
}
}
...
...
Lib/port/Port.php
View file @
4e6e37f7
...
...
@@ -345,10 +345,6 @@ class Port
$result
=
$redis
->
hGet
(
RedisKey
::
PORT_USING_ORDER_ID
,
$portId
);
var_dump
(
'using order'
);
var_dump
(
$result
);
return
is_string
(
$result
)
?
$result
:
0
;
}
...
...
@@ -359,8 +355,6 @@ class Port
$result
=
$redis
->
hMGet
(
RedisKey
::
PORT_USING_ORDER_ID
,
$portsId
);
var_dump
(
$result
);
return
$result
;
}
...
...
Lib/send/Send.php
View file @
4e6e37f7
...
...
@@ -79,8 +79,6 @@ class Send
}
/**
* 发送至下位机
* @return bool
...
...
@@ -93,15 +91,12 @@ class Send
$message
=
$this
->
makeMessage
();
Log
::
debug
(
'send messag
'
.
$message
);
Log
::
debug
(
'send messag
e'
.
$message
);
if
(
strlen
(
$message
)
%
2
===
1
)
{
Log
::
error
(
'length wrong- '
.
$message
);
if
(
strlen
(
$message
)
%
2
===
1
)
{
Log
::
error
(
'length wrong- '
.
$message
);
}
//debug
if
(
Gateway
::
isUidOnline
(
$clientUid
)
===
1
)
{
...
...
Lib/send/command/StopChargerCommand.php
View file @
4e6e37f7
...
...
@@ -32,8 +32,16 @@ class StopChargerCommand extends Command
private
$gatewayMac
;
/**
* @var string
*/
protected
$headerCtrl
=
'05'
;
/**
* @var int
*/
protected
$finishType
=
0
;
public
function
getMessageBody
()
:
string
{
...
...
@@ -43,13 +51,18 @@ class StopChargerCommand extends Command
$orderId
=
sprintf
(
'%012x'
,
$this
->
orderId
);
return
$this
->
messageBody
=
$logicNum
.
$orderId
;
$finishType
=
sprintf
(
'%02x'
,
$this
->
finishType
);
return
$this
->
messageBody
=
$logicNum
.
$orderId
.
$finishType
;
}
public
function
getClientId
()
:
string
{
return
$this
->
clientId
;
// TODO: Implement getClientId() method.
}
...
...
@@ -123,5 +136,38 @@ class StopChargerCommand extends Command
$this
->
headerCtrl
=
$headerCtrl
;
}
/**
* @return int
*/
public
function
getFinishType
()
:
int
{
return
$this
->
finishType
;
}
/**
* @param int $finishType
*/
public
function
setFinishType
(
int
$finishType
)
:
void
{
$this
->
finishType
=
$finishType
;
}
/**
* @param string $clientId
*/
public
function
setClientId
(
string
$clientId
)
:
void
{
$this
->
clientId
=
$clientId
;
}
/**
* @param string $clientUid
*/
public
function
setClientUid
(
string
$clientUid
)
:
void
{
$this
->
clientUid
=
$clientUid
;
}
}
\ No newline at end of file
Lib/state/StateCode.php
View file @
4e6e37f7
...
...
@@ -13,6 +13,8 @@ class StateCode
{
const
WAITING
=
-
1
;
const
PORT_OFFLINE
=
10
;
const
PORT_ONLINE
=
11
;
...
...
@@ -43,6 +45,13 @@ class StateCode
const
FINISH_CHARGER
=
36
;
const
FINISH_USER
=
41
;
const
FINISH_SHED_TIMEOUT
=
42
;
const
FINISH_REFUND
=
43
;
...
...
Route/Api.php
View file @
4e6e37f7
...
...
@@ -23,42 +23,50 @@ class Api
// static::add('00','HeartController@heart',[new AuthMiddleware(),new HasMacMiddleware()]);
static
::
add
(
'00'
,
'HeartController@heart'
);
static
::
add
(
'00'
,
'HeartController@heart'
);
static
::
add
(
'01'
,
'CertifyController@certify'
);
static
::
add
(
'01'
,
'CertifyController@certify'
);
static
::
add
(
'02'
,
'AccessController@access'
);
static
::
add
(
'02'
,
'AccessController@access'
);
static
::
add
(
'03'
,
'AccessController@syncPort'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'03'
,
'AccessController@syncPort'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'04'
,
'PowerController@charger'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'04'
,
'PowerController@charger'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
5'
,
'PowerController@stop'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
6'
,
'AmmeterController@recordd'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'08'
,
'PortController@online'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
//debug
// static::add('05','PowerController@stop',[new AuthMiddleware(),new HasMacMiddleware()]);
static
::
add
(
'0
9'
,
'PortController@offline'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
5'
,
'PowerController@finish'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
7'
,
'PowerController@power'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
8'
,
'PortController@online'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'
17'
,
'PowerController@onePower'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'
09'
,
'PortController@offline'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
B'
,
'PortController@portState'
,[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0
7'
,
'PowerController@power'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'
0A'
,
'SettingController@setting'
);
static
::
add
(
'
17'
,
'PowerController@onePower'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]
);
//static::add('0B','PortController@portState',[new AuthMiddleware(),new HasMacMiddleware()]);
static
::
add
(
'0B'
,
'PortStateController@change'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
static
::
add
(
'0A'
,
'SettingController@setting'
);
static
::
add
(
'0F'
,
'PowerOffController@powerOff'
,
[
new
AuthMiddleware
(),
new
HasMacMiddleware
()]);
}
public
static
function
add
(
string
$command
,
string
$controllerAction
,
array
$middleware
=
[])
public
static
function
add
(
string
$command
,
string
$controllerAction
,
array
$middleware
=
[])
{
$route
=
new
Route
();
$route
->
setCommand
(
$command
);
$controllerAction
=
explode
(
'@'
,
$controllerAction
);
$controllerAction
=
explode
(
'@'
,
$controllerAction
);
$route
->
setController
(
$controllerAction
[
0
]);
...
...
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