Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
familyMart_takeaway
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
guanghui.cui
familyMart_takeaway
Commits
f10cf669
Commit
f10cf669
authored
Mar 27, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加异常处理
parent
f7536466
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletions
+5
-1
src/JsonModule.cpp
+0
-0
src/JsonModule.h
+2
-0
src/main.cpp
+3
-1
No files found.
src/JsonModule.cpp
View file @
f10cf669
This diff is collapsed.
Click to expand it.
src/JsonModule.h
View file @
f10cf669
...
@@ -13,6 +13,8 @@ class JsonModule
...
@@ -13,6 +13,8 @@ class JsonModule
public
:
public
:
JsonModule
();
JsonModule
();
~
JsonModule
();
~
JsonModule
();
void
jsonTest
();
bool
getPushOrders
(
IN
const
char
*
json
,
OUT
orderObj
&
order
);
bool
getPushOrders
(
IN
const
char
*
json
,
OUT
orderObj
&
order
);
...
...
src/main.cpp
View file @
f10cf669
...
@@ -134,6 +134,7 @@ void* listen_pos_func(void* arg)
...
@@ -134,6 +134,7 @@ void* listen_pos_func(void* arg)
// 将POS请求数据转换为中台可接受数据格式
// 将POS请求数据转换为中台可接受数据格式
if
(
jsonTool
.
convertDataPos2Ods
(
posRequestData
,
requestOdsData
)
)
if
(
jsonTool
.
convertDataPos2Ods
(
posRequestData
,
requestOdsData
)
)
{
{
LOG
(
INFO
)
<<
"convert pos data to ods:"
<<
requestOdsData
.
data
();
// 同步阻塞发送到ODS并等待返回
// 同步阻塞发送到ODS并等待返回
TCPClient
ods
;
TCPClient
ods
;
if
(
ods
.
doConnect
(
ods_recv_port
,
ods_ip
.
c_str
())
)
if
(
ods
.
doConnect
(
ods_recv_port
,
ods_ip
.
c_str
())
)
...
@@ -143,6 +144,7 @@ void* listen_pos_func(void* arg)
...
@@ -143,6 +144,7 @@ void* listen_pos_func(void* arg)
std
::
string
tmp
;
std
::
string
tmp
;
if
(
ods
.
receive
(
tmp
)
)
if
(
ods
.
receive
(
tmp
)
)
{
{
LOG
(
INFO
)
<<
"receive ods back:"
<<
tmp
.
data
();
jsonTool
.
getPosResponseData
(
tmp
,
posRequestData
,
responseData
);
jsonTool
.
getPosResponseData
(
tmp
,
posRequestData
,
responseData
);
}
else
}
else
{
{
...
@@ -165,7 +167,7 @@ void* listen_pos_func(void* arg)
...
@@ -165,7 +167,7 @@ void* listen_pos_func(void* arg)
}
}
// TODO待加入重试机制
// TODO待加入重试机制
LOG
(
INFO
)
<<
"ODS response data:"
<<
responseData
.
data
();
LOG
(
INFO
)
<<
"ODS response data
send to pos
:"
<<
responseData
.
data
();
pos
.
write
(
responseData
.
c_str
());
pos
.
write
(
responseData
.
c_str
());
pos
.
close
();
pos
.
close
();
if
(
reqType
==
REQUEST_TYPE_INIT
){
if
(
reqType
==
REQUEST_TYPE_INIT
){
...
...
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