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
0074e707
You need to sign in or sign up before continuing.
Commit
0074e707
authored
Feb 24, 2018
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 1:修复部分字段类型错误
parent
2410d3ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
src/JsonModule.cpp
+8
-8
src/main.cpp
+6
-2
No files found.
src/JsonModule.cpp
View file @
0074e707
...
@@ -81,7 +81,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -81,7 +81,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
}
}
else
else
{
{
rapidjson
::
Value
&
channel
=
document
document
[
"channel"
];
rapidjson
::
Value
&
channel
=
document
[
"channel"
];
order
.
channel
=
channel
.
GetString
();
order
.
channel
=
channel
.
GetString
();
rapidjson
::
Value
&
order_id
=
document
[
"order_id"
];
rapidjson
::
Value
&
order_id
=
document
[
"order_id"
];
...
@@ -312,18 +312,23 @@ bool JsonModule::getOdsResponseData(const std::string &posResponse, const std::s
...
@@ -312,18 +312,23 @@ bool JsonModule::getOdsResponseData(const std::string &posResponse, const std::s
bool
JsonModule
::
convertDataPos2Ods
(
const
std
::
string
&
data
,
std
::
string
&
result
)
bool
JsonModule
::
convertDataPos2Ods
(
const
std
::
string
&
data
,
std
::
string
&
result
)
{
{
return
true
;
}
bool
JsonModule
::
convertDataOds2Pos
(
const
std
::
string
&
data
,
std
::
string
&
result
)
{
bool
rlt
=
true
;
bool
rlt
=
true
;
orderObj
order
;
orderObj
order
;
rlt
=
getPushOrders
(
data
.
data
(),
order
);
rlt
=
getPushOrders
(
data
.
data
(),
order
);
if
(
ORDERSTATUS_NEW
==
order
.
status
){
if
(
ORDERSTATUS_NEW
==
order
.
status
){
result
=
_convertToNewOrderJson
(
order
);
result
=
_convertToNewOrderJson
(
order
);
}
}
else
if
(
ORDERSTATUS_CONFIRMED
==
order
_status
||
ORDERSTATUS_CANCELED
==
order_status
||
ORDERSTATUS_SHIPPING
==
order_status
||
ORDERSTATUS_COMPLETE
==
order_
status
||
ORDERSTATUS_REFUND_COMPLETE
){
else
if
(
ORDERSTATUS_CONFIRMED
==
order
.
status
||
ORDERSTATUS_CANCELED
==
order
.
status
||
ORDERSTATUS_SHIPPING
==
order
.
status
||
ORDERSTATUS_COMPLETE
==
order
.
status
||
ORDERSTATUS_REFUND_COMPLETE
){
orderStatusObj
statusObj
;
orderStatusObj
statusObj
;
_getStatusObj
(
order
,
statusObj
);
_getStatusObj
(
order
,
statusObj
);
result
=
_convertToOrderStatusJson
(
statusObj
);
result
=
_convertToOrderStatusJson
(
statusObj
);
}
}
else
if
(
ORDERSTATUS_REFUND_FULL
==
order
_status
||
ORDERSTATUS_REFUND_PART
==
order_
status
){
else
if
(
ORDERSTATUS_REFUND_FULL
==
order
.
status
||
ORDERSTATUS_REFUND_PART
==
order
.
status
){
refundObj
refund
;
refundObj
refund
;
_getRefundObj
(
order
,
refund
);
_getRefundObj
(
order
,
refund
);
result
=
_convertToRefundJson
(
refund
);
result
=
_convertToRefundJson
(
refund
);
...
@@ -331,11 +336,6 @@ bool JsonModule::convertDataPos2Ods(const std::string &data, std::string &result
...
@@ -331,11 +336,6 @@ bool JsonModule::convertDataPos2Ods(const std::string &data, std::string &result
return
rlt
;
return
rlt
;
}
}
bool
JsonModule
::
convertDataOds2Pos
(
const
std
::
string
&
data
,
std
::
string
&
result
)
{
return
true
;
}
std
::
string
JsonModule
::
_convertToNewOrderJson
(
orderObj
&
obj
)
std
::
string
JsonModule
::
_convertToNewOrderJson
(
orderObj
&
obj
)
{
{
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
StringBuffer
buffer
;
...
...
src/main.cpp
View file @
0074e707
...
@@ -190,20 +190,24 @@ int main()
...
@@ -190,20 +190,24 @@ int main()
// 注册socket信息
// 注册socket信息
while
(
true
)
while
(
true
)
{
{
g_init_data
=
"{
\"
fm_cmd
\"
: 1000,
\"
store_id
\"
:
\"
0001
\"
,
\"
pos_id
\"
:
\"
0001
\"
,
\"
operator_id
\"
:
\"
00001
\"
,
\"
business_date
\"
:
\"
20171225
\"
,
\"
is_master
\"
: false,
\"
listen_port
\"
: 3289}"
;
if
(
!
g_init_data
.
empty
())
if
(
!
g_init_data
.
empty
())
{
{
if
(
ods
.
send
(
g_init_data
)
)
if
(
ods
.
send
(
g_init_data
)
)
{
{
ods
.
receive
(
odsPushData
);
break
;
break
;
}
}
}
}
usleep
(
500
);
sleep
(
1
);
continue
;
continue
;
}
}
}
else
}
else
{
{
LOG
(
INFO
)
<<
"连接ODS失败"
;
sleep
(
2
);
continue
;
continue
;
usleep
(
800
);
}
}
}
}
...
...
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