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
eccade2a
Commit
eccade2a
authored
Jan 04, 2019
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现集中店功能,添加 store_type 和 child_store_id字段
parent
2f737d48
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
base/CommonStruct.h
+3
-1
bin/config.ini
+2
-2
src/JsonModule.cpp
+32
-0
No files found.
base/CommonStruct.h
View file @
eccade2a
#ifndef COMMON_STRUCT_H
#
ifndef
COMMON_STRUCT_H
#define COMMON_STRUCT_H
#include <iostream>
...
...
@@ -98,6 +98,8 @@ struct store
std
::
string
pos_id
;
//订单推送 POS 编号
std
::
string
vem_id
;
//自助终端编号
std
::
string
vem_shelf
;
//自助终端货架号
std
::
string
store_type
;
//门店类型: “”:非集中店 “1”:普通门店 “2”:集中店
std
::
string
child_store_id
;
//子门店号
};
//配送信息
...
...
bin/config.ini
View file @
eccade2a
...
...
@@ -3,8 +3,8 @@ port=24446
[ODS]
ip
=
103.13.247.72
pushPort
=
3000
1
recvPort
=
300
02
pushPort
=
3000
9
recvPort
=
300
10
socketTimeout
=
120
[POS]
...
...
src/JsonModule.cpp
View file @
eccade2a
...
...
@@ -461,6 +461,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
GetJsonStringSafe
(
shopInfo_obj
,
"operator"
);
order
.
storeInfo
.
pos_id
=
GetJsonStringSafe
(
shopInfo_obj
,
"posId"
);
order
.
storeInfo
.
store_id
=
GetJsonStringSafe
(
shopInfo_obj
,
"storeId"
);
order
.
storeInfo
.
store_type
=
GetJsonStringSafe
(
shopInfo_obj
,
"store_type"
);
order
.
storeInfo
.
child_store_id
=
GetJsonStringSafe
(
shopInfo_obj
,
"child_store_id"
);
//自助机信息
rapidjson
::
Value
&
selfHelpMac_obj
=
shopInfo_obj
[
"selfHelpMac"
];
...
...
@@ -802,6 +804,19 @@ bool JsonModule::getOdsResponseData(int status_code, const std::string &msg, IN
writer
.
Key
(
"pk_id"
);
writer
.
Uint64
(
pk_id
);
std
::
string
child_store_id
;
if
(
document
.
HasMember
(
"shopInfo"
))
{
rapidjson
::
Value
&
shopInfo_obj
=
document
[
"shopInfo"
];
if
(
shopInfo_obj
.
IsObject
())
{
child_store_id
=
GetJsonStringSafe
(
shopInfo_obj
,
"child_store_id"
);
}
}
writer
.
Key
(
"child_store_id"
);
writer
.
String
(
child_store_id
.
c_str
());
writer
.
EndObject
();
result
=
buffer
.
GetString
();
...
...
@@ -1016,6 +1031,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer
.
Key
(
"vem_shelf"
);
writer
.
String
(
obj
.
storeInfo
.
vem_shelf
.
c_str
());
writer
.
Key
(
"store_type"
);
writer
.
String
(
obj
.
storeInfo
.
store_type
.
c_str
());
writer
.
Key
(
"child_store_id"
);
writer
.
String
(
obj
.
storeInfo
.
child_store_id
.
c_str
());
writer
.
EndObject
();
//----------------门店信息 结束-----------
...
...
@@ -1778,6 +1799,14 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con
std
::
string
channel
=
document1
[
"channel"
].
GetString
();
uint64_t
pk_id
=
GetJsonIntSafe
(
document2
,
"pk_id"
);
std
::
string
child_store_id
;
if
(
document2
.
HasMember
(
"shopInfo"
))
{
rapidjson
::
Value
&
shopInfo_obj
=
document2
[
"shopInfo"
];
if
(
shopInfo_obj
.
IsObject
())
{
child_store_id
=
GetJsonStringSafe
(
shopInfo_obj
,
"child_store_id"
);
}
}
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
...
...
@@ -1804,6 +1833,9 @@ bool JsonModule::_getOrderResponseJson(IN const std::string& posResponse, IN con
writer
.
Key
(
"pk_id"
);
writer
.
Uint64
(
pk_id
);
writer
.
Key
(
"child_store_id"
);
writer
.
String
(
child_store_id
.
c_str
());
//该状态表示商品在pos中不存在,需要返回字段给中台,由于双方命名规则不一致,所以这里拼上中台需要字段
if
(
103
==
status_code
)
{
writer
.
Key
(
"orderId"
);
...
...
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