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
48994c32
Commit
48994c32
authored
Feb 01, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送信息JSON包装
parent
1adbbddd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
159 additions
and
3 deletions
+159
-3
src/JsonModule.cpp
+159
-3
No files found.
src/JsonModule.cpp
View file @
48994c32
...
@@ -362,7 +362,25 @@ orderStatusObj JsonModule::convertToOrderStatusObj(const char* json)
...
@@ -362,7 +362,25 @@ orderStatusObj JsonModule::convertToOrderStatusObj(const char* json)
std
::
string
JsonModule
::
convertToOrderStatusJson
(
orderStatusObj
&
obj
)
std
::
string
JsonModule
::
convertToOrderStatusJson
(
orderStatusObj
&
obj
)
{
{
return
""
;
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
writer
.
StartObject
();
writer
.
Key
(
"fm_cmd"
);
writer
.
Int
(
obj
.
fm_cmd
);
writer
.
Key
(
"order_id"
);
writer
.
String
(
obj
.
order_id
.
c_str
());
writer
.
Key
(
"order_status"
);
writer
.
Int
(
obj
.
order_status
);
writer
.
Key
(
"delivery_status"
);
writer
.
Int
(
obj
.
delivery_status
);
writer
.
EndObject
();
return
buffer
.
GetString
();
}
}
refundObj
JsonModule
::
convertToRefundObj
(
const
char
*
json
)
refundObj
JsonModule
::
convertToRefundObj
(
const
char
*
json
)
...
@@ -375,7 +393,92 @@ refundObj JsonModule::convertToRefundObj(const char* json)
...
@@ -375,7 +393,92 @@ refundObj JsonModule::convertToRefundObj(const char* json)
std
::
string
JsonModule
::
convertToRefundJson
(
refundObj
&
obj
)
std
::
string
JsonModule
::
convertToRefundJson
(
refundObj
&
obj
)
{
{
return
""
;
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
writer
.
StartObject
();
writer
.
Key
(
"fm_cmd"
);
writer
.
Int
(
obj
.
fm_cmd
);
writer
.
Key
(
"channel"
);
writer
.
String
(
obj
.
channel
.
c_str
());
writer
.
Key
(
"order_id"
);
writer
.
String
(
obj
.
order_id
.
c_str
());
writer
.
Key
(
"refund_amount"
);
writer
.
Int
(
obj
.
refund_amount
);
//----------------商品信息----------------
writer
.
Key
(
"products"
);
writer
.
StartArray
();
for
(
unsigned
int
i
=
0
;
i
<
obj
.
vecProducts
.
size
();
i
++
)
{
//-----------------start 单个商品------------------
writer
.
StartObject
();
writer
.
Key
(
"source"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
source
.
c_str
());
writer
.
Key
(
"attributes"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
attributes
.
c_str
());
writer
.
Key
(
"combo_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
combo_id
.
c_str
());
writer
.
Key
(
"bom_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
bom_id
.
c_str
());
writer
.
Key
(
"bag_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
bag_id
.
c_str
());
writer
.
Key
(
"name"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
name
.
c_str
());
writer
.
Key
(
"price"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
pro
.
price
);
writer
.
Key
(
"qty"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
pro
.
qty
);
writer
.
Key
(
"sku"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
sku
.
c_str
());
//-----------------start 商品规格------------------
writer
.
Key
(
"specs"
);
writer
.
StartArray
();
for
(
unsigned
int
j
=
0
;
j
<
obj
.
vecProducts
[
i
].
vecSpec
.
size
();
j
++
)
{
writer
.
StartObject
();
writer
.
Key
(
"name"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
vecSpec
[
j
].
name
.
c_str
());
writer
.
Key
(
"price"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
vecSpec
[
j
].
price
);
writer
.
Key
(
"qty"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
vecSpec
[
j
].
qty
);
writer
.
Key
(
"sku"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
vecSpec
[
j
].
sku
.
c_str
());
writer
.
EndObject
();
}
writer
.
EndArray
();
//-----------------end 商品规格--------------------
writer
.
EndObject
();
//-----------------end 单个商品------------------
}
writer
.
EndArray
();
//----------------商品信息 结束-----------
writer
.
EndObject
();
return
buffer
.
GetString
();
}
}
stockWarnObj
JsonModule
::
convertToStockWarnObj
(
const
char
*
json
)
stockWarnObj
JsonModule
::
convertToStockWarnObj
(
const
char
*
json
)
...
@@ -386,5 +489,57 @@ stockWarnObj JsonModule::convertToStockWarnObj(const char* json)
...
@@ -386,5 +489,57 @@ stockWarnObj JsonModule::convertToStockWarnObj(const char* json)
std
::
string
JsonModule
::
convertToStockWarnJson
(
stockWarnObj
&
obj
)
std
::
string
JsonModule
::
convertToStockWarnJson
(
stockWarnObj
&
obj
)
{
{
return
""
;
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
writer
.
StartObject
();
writer
.
Key
(
"fm_cmd"
);
writer
.
Int
(
obj
.
fm_cmd
);
//----------------商品信息----------------
writer
.
Key
(
"products"
);
writer
.
StartArray
();
for
(
unsigned
int
i
=
0
;
i
<
obj
.
vecProducts
.
size
();
i
++
)
{
//-----------------start 单个商品------------------
writer
.
StartObject
();
writer
.
Key
(
"source"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
source
.
c_str
());
writer
.
Key
(
"attributes"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
attributes
.
c_str
());
writer
.
Key
(
"combo_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
combo_id
.
c_str
());
writer
.
Key
(
"bom_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
bom_id
.
c_str
());
writer
.
Key
(
"bag_id"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
bag_id
.
c_str
());
writer
.
Key
(
"name"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
name
.
c_str
());
writer
.
Key
(
"price"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
price
);
writer
.
Key
(
"stock"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
stock
);
writer
.
Key
(
"sku"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
sku
.
c_str
());
writer
.
EndObject
();
//-----------------end 单个商品------------------
}
writer
.
EndArray
();
//----------------商品信息 结束-----------
writer
.
EndObject
();
return
buffer
.
GetString
();
}
}
\ No newline at end of file
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