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
99496e54
Commit
99496e54
authored
Mar 14, 2019
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
混合支付
parent
28ae9723
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
37 deletions
+60
-37
base/CommonStruct.h
+3
-0
bin/config.ini
+3
-3
src/JsonModule.cpp
+53
-33
src/main.cpp
+1
-1
No files found.
base/CommonStruct.h
View file @
99496e54
...
@@ -222,6 +222,9 @@ struct orderObj
...
@@ -222,6 +222,9 @@ struct orderObj
int
bonus_basic
=
0
;
//基本积分
int
bonus_basic
=
0
;
//基本积分
int
bonus_extra
=
0
;
//额外积分
int
bonus_extra
=
0
;
//额外积分
int
bonus_total
=
0
;
// 获得总积分
int
bonus_total
=
0
;
// 获得总积分
int
totalCouponDiscount
=
0
;
//使用优惠券发生的折扣
int
totalExcessiveCharge
=
0
;
//使用优惠券发生的溢收
int
zhxPoint
=
0
;
//甄会选积分
store
storeInfo
;
//门店信息
store
storeInfo
;
//门店信息
delivery
deliveryInfo
;
//配送信息
delivery
deliveryInfo
;
//配送信息
...
...
bin/config.ini
View file @
99496e54
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
port
=
24446
port
=
24446
[ODS]
[ODS]
ip
=
1
03.13.247.72
ip
=
1
27.0.0.1
pushPort
=
3000
9
pushPort
=
3000
1
recvPort
=
300
10
recvPort
=
300
02
socketTimeout
=
120
socketTimeout
=
120
[POS]
[POS]
...
...
src/JsonModule.cpp
View file @
99496e54
...
@@ -246,6 +246,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -246,6 +246,8 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
order
.
wmDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmDiscount"
);
order
.
wmDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmDiscount"
);
order
.
wmPtSharedDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmPtSharedDiscount"
);
order
.
wmPtSharedDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmPtSharedDiscount"
);
order
.
wmSjSharedDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmSjSharedDiscount"
);
order
.
wmSjSharedDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"wmSjSharedDiscount"
);
order
.
totalCouponDiscount
=
GetJsonIntSafe
(
orderContent_obj
,
"totalCouponDiscount"
);
order
.
totalExcessiveCharge
=
GetJsonIntSafe
(
orderContent_obj
,
"totalExcessiveCharge"
);
//订单信息
//订单信息
...
@@ -333,11 +335,17 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -333,11 +335,17 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
paymentDetail
detail
;
paymentDetail
detail
;
detail
.
amount
=
GetJsonIntSafe
(
payInfos_obj
,
"amount"
);
detail
.
amount
=
GetJsonIntSafe
(
payInfos_obj
,
"amount"
);
//非自配送,第一种支付方式减去配送费
//非自配送
且不是咖啡小程序订单
,第一种支付方式减去配送费
if
(
"2"
!=
delivery_type
&&
0
==
i
){
if
(
"2"
!=
delivery_type
&&
0
==
i
&&
order
.
channel
!=
"213"
){
detail
.
amount
=
GetJsonIntSafe
(
payInfos_obj
,
"amount"
)
-
GetJsonIntSafe
(
orderContent_obj
,
"deliveryFee"
);
detail
.
amount
=
GetJsonIntSafe
(
payInfos_obj
,
"amount"
)
-
GetJsonIntSafe
(
orderContent_obj
,
"deliveryFee"
);
}
}
//咖啡小程序订单,需要单独处理.支付类型为"10101"的金额,减去配送费
std
::
string
payType
=
GetJsonStringSafe
(
payInfos_obj
,
"payType"
);
if
(
order
.
channel
==
"213"
&&
payType
==
"10101"
)
{
detail
.
amount
=
GetJsonIntSafe
(
payInfos_obj
,
"amount"
)
-
GetJsonIntSafe
(
orderContent_obj
,
"deliveryFee"
);
}
//支付类型需要拼接 channel+payType
//支付类型需要拼接 channel+payType
std
::
string
_strType
=
order
.
channel
+
GetJsonStringSafe
(
payInfos_obj
,
"payType"
);
std
::
string
_strType
=
order
.
channel
+
GetJsonStringSafe
(
payInfos_obj
,
"payType"
);
detail
.
type
=
atoi
(
_strType
.
data
());
detail
.
type
=
atoi
(
_strType
.
data
());
...
@@ -402,6 +410,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -402,6 +410,7 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
order
.
bonus_total
=
GetJsonIntSafe
(
points_obj
,
"totalPoint"
);
order
.
bonus_total
=
GetJsonIntSafe
(
points_obj
,
"totalPoint"
);
order
.
bonus_extra
=
GetJsonIntSafe
(
points_obj
,
"extraPoint"
);
order
.
bonus_extra
=
GetJsonIntSafe
(
points_obj
,
"extraPoint"
);
order
.
bonus_basic
=
GetJsonIntSafe
(
points_obj
,
"basicPoint"
);
order
.
bonus_basic
=
GetJsonIntSafe
(
points_obj
,
"basicPoint"
);
order
.
zhxPoint
=
GetJsonIntSafe
(
points_obj
,
"zhxPoint"
);
//积分信息详情
//积分信息详情
if
(
points_obj
.
HasMember
(
"pointDetails"
))
if
(
points_obj
.
HasMember
(
"pointDetails"
))
{
{
...
@@ -453,6 +462,39 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -453,6 +462,39 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
GetJsonStringSafe
(
orderContent_obj
,
"sessionId"
);
GetJsonStringSafe
(
orderContent_obj
,
"sessionId"
);
order
.
reduced_price
=
GetJsonIntSafe
(
orderContent_obj
,
"totalDiscount"
);
order
.
reduced_price
=
GetJsonIntSafe
(
orderContent_obj
,
"totalDiscount"
);
//订单优惠券信息
if
(
orderContent_obj
.
HasMember
(
"orderCoupons"
))
{
rapidjson
::
Value
&
coupons_array
=
orderContent_obj
[
"orderCoupons"
];
if
(
!
coupons_array
.
IsNull
())
{
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
);
}
}
}
}
}
}
//第三方商户信息
//第三方商户信息
if
(
document
.
HasMember
(
"sellerInfo"
))
if
(
document
.
HasMember
(
"sellerInfo"
))
...
@@ -486,37 +528,6 @@ bool JsonModule::getPushOrders(IN const char* json,OUT orderObj &order)
...
@@ -486,37 +528,6 @@ 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
;
return
true
;
}
}
...
@@ -1067,6 +1078,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
...
@@ -1067,6 +1078,12 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer
.
Key
(
"order_drift"
);
writer
.
Key
(
"order_drift"
);
writer
.
String
(
obj
.
order_drift
.
c_str
());
writer
.
String
(
obj
.
order_drift
.
c_str
());
writer
.
Key
(
"totalCouponDiscount"
);
writer
.
Int
(
obj
.
totalCouponDiscount
);
writer
.
Key
(
"totalExcessiveCharge"
);
writer
.
Int
(
obj
.
totalExcessiveCharge
);
//----------------门店信息----------------
//----------------门店信息----------------
writer
.
Key
(
"store"
);
writer
.
Key
(
"store"
);
writer
.
StartObject
();
writer
.
StartObject
();
...
@@ -1275,6 +1292,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
...
@@ -1275,6 +1292,9 @@ std::string JsonModule::_convertToNewOrderJson(orderObj &obj)
writer
.
Key
(
"bonusTotal"
);
writer
.
Key
(
"bonusTotal"
);
writer
.
Int
(
obj
.
bonus_total
);
writer
.
Int
(
obj
.
bonus_total
);
writer
.
Key
(
"zhxPoint"
);
writer
.
Int
(
obj
.
zhxPoint
);
writer
.
Key
(
"bonus"
);
writer
.
Key
(
"bonus"
);
writer
.
StartArray
();
writer
.
StartArray
();
for
(
unsigned
int
i
=
0
;
i
<
obj
.
vecBonus
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
obj
.
vecBonus
.
size
();
i
++
)
...
...
src/main.cpp
View file @
99496e54
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
INITIALIZE_EASYLOGGINGPP
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.
8
" //版本号
#define VERSION "1.0.
9
" //版本号
std
::
string
g_init_data
;
std
::
string
g_init_data
;
std
::
string
g_init_data_ods_back
;
std
::
string
g_init_data_ods_back
;
...
...
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