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
ca75b796
Commit
ca75b796
authored
Jan 18, 2019
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加券相关字段
parent
ce85a7f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
3 deletions
+125
-3
base/CommonStruct.h
+26
-2
src/JsonModule.cpp
+99
-1
No files found.
base/CommonStruct.h
View file @
ca75b796
...
...
@@ -16,6 +16,7 @@ struct product
int
price
=
0
;
//商品价格(折后价)
int
qty
=
0
;
//商品数量
std
::
string
sku
;
//商品SKU
int
couponQty
;
//商品券数量,默认为零
};
//商品规格
...
...
@@ -172,6 +173,28 @@ struct appointment
int
is_appointment
;
//是否是点取分离
};
//订单优惠券信息
struct
orderCoupon
{
std
::
string
couponId
;
//优惠券Id
std
::
string
couponName
;
//优惠券名称
int
discount
;
//负数折扣,正数溢收
std
::
string
ebcode
;
//发券商, 发放优惠券的厂商
std
::
string
securitiesTrader
;
//优惠券厂商 非码:F 纳客宝:N
int
totalAmount
;
//优惠券总面额
std
::
string
transNum
;
//交易序号
std
::
string
type
;
//券类型, 纳客宝商品券 : P, 代金券 : C, 全家积分券 : I, 全家套餐积分券:F, 点标 : S;非码 0商品券, 1代金券, 2M选N券
int
useAmount
;
//商品券、 代金券折扣金额, 单位分,使用的折扣额
int
usedNum
;
//使用券的数量
int
price
;
//商品价格(售价)
std
::
string
sku
;
//商户商品货号
int
campaignAmt
;
//活动价
int
paid
;
//已付金额
int
remainingAmt
;
//还需要支付的金额
std
::
string
supplierNo
;
//商户号
std
::
string
activityId
;
//活动编号
};
//订单结构体
struct
orderObj
{
...
...
@@ -207,8 +230,9 @@ struct orderObj
std
::
vector
<
productAttr
>
vecProducts
;
//商品列表
payment
payInfo
;
//付款明细
std
::
vector
<
bonus
>
vecBonus
;
//消费积分
std
::
vector
<
promotions
>
vecPromotions
;
//促销列表
std
::
vector
<
ecoupon
>
vecEcoupon
;
//电子点标
std
::
vector
<
promotions
>
vecPromotions
;
//促销列表
std
::
vector
<
ecoupon
>
vecEcoupon
;
//电子点标
std
::
vector
<
orderCoupon
>
vecOrderCoupons
;
//订单优惠券信息
};
//订单状态
...
...
src/JsonModule.cpp
View file @
ca75b796
...
...
@@ -285,6 +285,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
structProduct
.
pro
.
qty
=
GetJsonIntSafe
(
product_obj
,
"qty"
);
structProduct
.
pro
.
sku
=
GetJsonStringSafe
(
product_obj
,
"sku"
);
structProduct
.
pro
.
source
=
GetJsonStringSafe
(
product_obj
,
"source"
);
structProduct
.
pro
.
couponQty
=
GetJsonIntSafe
(
product_obj
,
"couponQty"
);
//子商品信息
if
(
product_obj
.
HasMember
(
"specs"
))
...
...
@@ -475,6 +476,37 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
}
}
//订单优惠券信息
if
(
document
.
HasMember
(
"orderCoupons"
))
{
rapidjson
::
Value
&
coupons_array
=
document
[
"orderCoupons"
];
if
(
coupons_array
.
IsArray
())
{
for
(
unsigned
int
i
=
0
;
i
<
coupons_array
.
Size
();
i
++
)
{
rapidjson
::
Value
&
coupon_obj
=
coupons_array
[
i
];
orderCoupon
coupon
;
coupon
.
couponId
=
GetJsonStringSafe
(
coupon_obj
,
"couponId"
);
coupon
.
couponName
=
GetJsonStringSafe
(
coupon_obj
,
"couponName"
);
coupon
.
ebcode
=
GetJsonStringSafe
(
coupon_obj
,
"ebcode"
);
coupon
.
securitiesTrader
=
GetJsonStringSafe
(
coupon_obj
,
"securitiesTrader"
);
coupon
.
transNum
=
GetJsonStringSafe
(
coupon_obj
,
"transNum"
);
coupon
.
type
=
GetJsonStringSafe
(
coupon_obj
,
"type"
);
coupon
.
discount
=
GetJsonIntSafe
(
coupon_obj
,
"discount"
);
coupon
.
totalAmount
=
GetJsonIntSafe
(
coupon_obj
,
"totalAmount"
);
coupon
.
useAmount
=
GetJsonIntSafe
(
coupon_obj
,
"useAmount"
);
coupon
.
usedNum
=
GetJsonIntSafe
(
coupon_obj
,
"usedNum"
);
coupon
.
sku
=
GetJsonStringSafe
(
coupon_obj
,
"sku"
);
coupon
.
campaignAmt
=
GetJsonIntSafe
(
coupon_obj
,
"campaignAmt"
);
coupon
.
paid
=
GetJsonIntSafe
(
coupon_obj
,
"paid"
);
coupon
.
price
=
GetJsonIntSafe
(
coupon_obj
,
"price"
);
coupon
.
remainingAmt
=
GetJsonIntSafe
(
coupon_obj
,
"remainingAmt"
);
coupon
.
supplierNo
=
GetJsonStringSafe
(
coupon_obj
,
"supplierNo"
);
coupon
.
activityId
=
GetJsonStringSafe
(
coupon_obj
,
"activityId"
);
order
.
vecOrderCoupons
.
push_back
(
coupon
);
}
}
}
}
return
true
;
}
...
...
@@ -1144,6 +1176,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer
.
Key
(
"sku"
);
writer
.
String
(
obj
.
vecProducts
[
i
].
pro
.
sku
.
c_str
());
writer
.
Key
(
"couponQty"
);
writer
.
Int
(
obj
.
vecProducts
[
i
].
pro
.
couponQty
);
//-----------------start 商品规格------------------
writer
.
Key
(
"specs"
);
writer
.
StartArray
();
...
...
@@ -1335,6 +1370,69 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer
.
EndArray
();
//----------------电子点标 结束-----------
//----------------订单优惠券信息-----------
writer
.
Key
(
"orderCoupons"
);
writer
.
StartArray
();
for
(
unsigned
int
i
=
0
;
i
<
obj
.
vecOrderCoupons
.
size
();
i
++
)
{
writer
.
StartObject
();
writer
.
Key
(
"couponId"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
couponId
.
c_str
());
writer
.
Key
(
"couponName"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
couponName
.
c_str
());
writer
.
Key
(
"ebcode"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
ebcode
.
c_str
());
writer
.
Key
(
"securitiesTrader"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
securitiesTrader
.
c_str
());
writer
.
Key
(
"transNum"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
transNum
.
c_str
());
writer
.
Key
(
"type"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
type
.
c_str
());
writer
.
Key
(
"discount"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
discount
);
writer
.
Key
(
"totalAmount"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
totalAmount
);
writer
.
Key
(
"useAmount"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
useAmount
);
writer
.
Key
(
"usedNum"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
usedNum
);
writer
.
Key
(
"sku"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
sku
.
c_str
());
writer
.
Key
(
"price"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
price
);
writer
.
Key
(
"campaignAmt"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
campaignAmt
);
writer
.
Key
(
"paid"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
paid
);
writer
.
Key
(
"remainingAmt"
);
writer
.
Int
(
obj
.
vecOrderCoupons
[
i
].
remainingAmt
);
writer
.
Key
(
"supplierNo"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
supplierNo
.
c_str
());
writer
.
Key
(
"activityId"
);
writer
.
String
(
obj
.
vecOrderCoupons
[
i
].
activityId
.
c_str
());
writer
.
EndObject
();
}
writer
.
EndArray
();
//----------------订单优惠券信息 结束----
writer
.
EndObject
();
return
buffer
.
GetString
();
...
...
@@ -2207,7 +2305,7 @@ bool JsonModule::getSetPosPriorityBackData(IN const char* inJson,OUT std::string
std
::
string
JsonModule
::
_getPickupCodeString
(
std
::
string
&
channel
,
std
::
string
&
pickup_code
)
{
std
::
string
rlt
;
std
::
string
rlt
=
pickup_code
;
if
(
"101"
==
channel
){
rlt
=
"普通单"
+
pickup_code
+
"号"
;
}
...
...
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