Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMVip_LXJ
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
zhenfei.zhang
FMVip_LXJ
Commits
6b70992e
Commit
6b70992e
authored
Sep 30, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 与服务端支付接口修改。
parent
fa96ae04
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
77 additions
and
10 deletions
+77
-10
.gitignore
+4
-0
FMVip_LXJ/FMVip_LXJ.pro
+2
-0
FMVip_LXJ/fmnetwork.cpp
+1
-1
FMVip_LXJ/fmvipdispatcher.cpp
+2
-2
FMVip_LXJ/global.h
+1
-0
FMVip_LXJ/task/tasklogin.cpp
+2
-0
FMVip_LXJ/task/taskothers.cpp
+11
-0
FMVip_LXJ/task/taskpay.cpp
+51
-6
FMVip_LXJ/windows/fmviporder.cpp
+1
-0
FMVip_LXJ/windows/fmviporder.h
+2
-1
No files found.
.gitignore
View file @
6b70992e
...
@@ -2,3 +2,6 @@ build*
...
@@ -2,3 +2,6 @@ build*
FMVipTest/
FMVipTest/
*.user*
*.user*
*.autosave
*.autosave
CardReader/
EntityCard/
fmvip_card_reader/
\ No newline at end of file
FMVip_LXJ/FMVip_LXJ.pro
View file @
6b70992e
...
@@ -13,6 +13,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
...
@@ -13,6 +13,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET
=
FMVip_LXJ
TARGET
=
FMVip_LXJ
TEMPLATE
=
app
TEMPLATE
=
app
DEFINES
+=
FMTEST
SOURCES
+=
main
.
cpp
\
SOURCES
+=
main
.
cpp
\
task
/
fmtask
.
cpp
\
task
/
fmtask
.
cpp
\
task
/
taskfactory
.
cpp
\
task
/
taskfactory
.
cpp
\
...
...
FMVip_LXJ/fmnetwork.cpp
View file @
6b70992e
...
@@ -26,7 +26,7 @@ FMNetwork::~FMNetwork()
...
@@ -26,7 +26,7 @@ FMNetwork::~FMNetwork()
QByteArray
FMNetwork
::
send
(
const
QString
*
url
,
const
QByteArray
*
data
)
QByteArray
FMNetwork
::
send
(
const
QString
*
url
,
const
QByteArray
*
data
)
{
{
qDebug
()
<<
"Send Url: "
<<
*
url
;
qDebug
()
<<
"Send Url: "
<<
*
url
;
qDebug
()
<<
"Send Data: "
<<
*
data
;
qDebug
()
<<
"Send Data: "
<<
(
*
data
).
data
()
;
_req
->
setUrl
(
*
url
);
_req
->
setUrl
(
*
url
);
...
...
FMVip_LXJ/fmvipdispatcher.cpp
View file @
6b70992e
...
@@ -58,7 +58,7 @@ BOOL FMVipDispatcher::Transfer(LPSTR data, LPSTR &rsp, UINT &rsp_len)
...
@@ -58,7 +58,7 @@ BOOL FMVipDispatcher::Transfer(LPSTR data, LPSTR &rsp, UINT &rsp_len)
void
FMVipDispatcher
::
onDoTask
()
void
FMVipDispatcher
::
onDoTask
()
{
{
qDebug
()
<<
"==============="
;
qDebug
()
<<
"==============="
;
qDebug
()
<<
"Recv POS reqData: "
<<
QString
::
fromUtf8
(
reqData
);
qDebug
()
<<
"Recv POS reqData: "
<<
reqData
.
data
(
);
fmTask
=
TaskFactory
::
Task
(
reqData
);
fmTask
=
TaskFactory
::
Task
(
reqData
);
...
@@ -115,7 +115,7 @@ void FMVipDispatcher::onDoTask()
...
@@ -115,7 +115,7 @@ void FMVipDispatcher::onDoTask()
}
}
}
}
}
}
qDebug
()
<<
"Send to pos: "
<<
QString
::
fromUtf8
(
rspData
);
qDebug
()
<<
"Send to pos: "
<<
rspData
.
data
(
);
qDebug
()
<<
"==============="
;
qDebug
()
<<
"==============="
;
condition
.
wakeAll
();
condition
.
wakeAll
();
...
...
FMVip_LXJ/global.h
View file @
6b70992e
...
@@ -124,6 +124,7 @@ struct{
...
@@ -124,6 +124,7 @@ struct{
const
QString
Transaction
=
"transactions"
;
const
QString
Transaction
=
"transactions"
;
const
QString
OrderAmount
=
"order_amount"
;
const
QString
OrderAmount
=
"order_amount"
;
const
QString
PaidAmount
=
"paid_amount"
;
const
QString
PaidAmount
=
"paid_amount"
;
const
QString
NeedAmount
=
"need_amount"
;
const
QString
StandardAmount
=
"standard_amount"
;
const
QString
StandardAmount
=
"standard_amount"
;
const
QString
UndisAmount
=
"undis_amount"
;
const
QString
UndisAmount
=
"undis_amount"
;
const
QString
Fm_id
=
"fm_id"
;
const
QString
Fm_id
=
"fm_id"
;
...
...
FMVip_LXJ/task/tasklogin.cpp
View file @
6b70992e
...
@@ -48,11 +48,13 @@ void TaskLogin::onLogin()
...
@@ -48,11 +48,13 @@ void TaskLogin::onLogin()
closeWindow
();
closeWindow
();
}
}
}
}
#ifndef FMTEST
// 认证成功但限制用支付码
// 认证成功但限制用支付码
else
if
((
session
()
->
data
(
PosProps
.
FM_Type
).
toInt
()
==
FM_Pay
)
&&
else
if
((
session
()
->
data
(
PosProps
.
FM_Type
).
toInt
()
==
FM_Pay
)
&&
(
getServerJsonValue
(
PosProps
.
CanPay
).
toInt
()
!=
1
))
{
(
getServerJsonValue
(
PosProps
.
CanPay
).
toInt
()
!=
1
))
{
FMMsgWnd
::
FailureWnd
(
ErrorNeedPayCode
);
FMMsgWnd
::
FailureWnd
(
ErrorNeedPayCode
);
}
}
#endif
// 认证成功
// 认证成功
else
{
else
{
QString
fm_unique_id
=
getServerJsonValue
(
PosProps
.
Fm_unique_id
).
toString
();
QString
fm_unique_id
=
getServerJsonValue
(
PosProps
.
Fm_unique_id
).
toString
();
...
...
FMVip_LXJ/task/taskothers.cpp
View file @
6b70992e
...
@@ -56,6 +56,17 @@ void TaskCoupon::packagePOSRsp()
...
@@ -56,6 +56,17 @@ void TaskCoupon::packagePOSRsp()
v
.
setValue
(
c
);
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
couponMap
[
code
]
=
v
;
}
}
#ifdef FMTEST
for
(
double
i
=
1.99
;
i
<=
2.01
;
i
=
i
+
0.01
)
{
QString
code
=
QString
::
number
(
i
);
Coupon
c
(
QString
::
fromUtf8
(
"测试券%1"
).
arg
(
i
),
code
,
i
,
0
,
true
);
QVariant
v
;
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
}
#endif
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
}
}
...
...
FMVip_LXJ/task/taskpay.cpp
View file @
6b70992e
...
@@ -58,16 +58,61 @@ void TaskPay::packageServerReq()
...
@@ -58,16 +58,61 @@ void TaskPay::packageServerReq()
{
{
QJsonObject
transObj
;
QJsonObject
transObj
;
transObj
[
ServerProps
(
PosProps
.
Fm_open_id
)]
=
session
()
->
data
(
PosProps
.
Fm_open_id
).
toString
();
transObj
[
ServerProps
(
PosProps
.
Fm_open_id
)]
=
session
()
->
data
(
PosProps
.
Fm_open_id
).
toString
();
transObj
[
ServerProps
(
PosProps
.
CodeAmount
)]
=
session
()
->
data
(
PosProps
.
CodeAmount
).
toInt
();
transObj
[
ServerProps
(
PosProps
.
IsUseScore
)]
=
session
()
->
data
(
ServerProps
(
PosProps
.
IsUseScore
)).
toInt
();
QJsonArray
couponArr
;
int
codeAmount
=
session
()
->
data
(
PosProps
.
CodeAmount
).
toInt
();
for
(
auto
code
:
session
()
->
data
(
PosProps
.
CouponMap
).
toMap
().
keys
())
QJsonArray
payList
;
QJsonObject
paymentCodeObj
;
paymentCodeObj
[
ServerProps
(
PosProps
.
Pay_id
)]
=
"20001"
;
paymentCodeObj
[
ServerProps
(
PosProps
.
Amount
)]
=
codeAmount
;
payList
.
append
(
paymentCodeObj
);
//! NOTE 老乡鸡暂时没有积分支付 2017-09-25 15:45
int
scoreAmount
=
session
()
->
data
(
PosProps
.
ScoreAmount
).
toInt
();
if
(
scoreAmount
>
0
)
{
QJsonObject
paymentScoreObj
;
paymentScoreObj
[
ServerProps
(
PosProps
.
Pay_id
)]
=
"20002"
;
paymentScoreObj
[
ServerProps
(
PosProps
.
Amount
)]
=
scoreAmount
;
payList
.
append
(
paymentScoreObj
);
}
//代金券/商品券支付详情
QMap
<
QString
,
QVariant
>
coupons
=
session
()
->
data
(
PosProps
.
CouponMap
).
toMap
();
// 将代金券按金额从大到小排序
QList
<
Coupon
>
couponList
;
for
(
QMap
<
QString
,
QVariant
>::
const_iterator
it
=
coupons
.
constBegin
();
it
!=
coupons
.
constEnd
();
it
++
)
{
couponList
.
append
(
it
.
value
().
value
<
Coupon
>
());
}
qSort
(
couponList
.
begin
(),
couponList
.
end
(),
[
=
](
const
Coupon
&
first
,
const
Coupon
&
second
){
return
(
first
.
disAmount
()
>
second
.
disAmount
());
});
// 计算使用的代金券金额
int
needAmount
=
session
()
->
data
(
PosProps
.
NeedAmount
).
toInt
();
int
needCouponAmount
=
needAmount
-
codeAmount
-
scoreAmount
;
int
couponAmount
=
0
;
foreach
(
Coupon
c
,
couponList
)
{
{
couponArr
.
append
(
code
);
if
(
needCouponAmount
<=
0
)
{
break
;
}
QJsonObject
coupon
;
double
couponDisAmount
=
c
.
disAmount
()
*
100
;
if
(
couponDisAmount
<=
needCouponAmount
)
{
couponDisAmount
=
couponDisAmount
;
needCouponAmount
-=
couponDisAmount
;
}
else
{
couponDisAmount
=
MAX
(
0
,
needCouponAmount
);
needCouponAmount
=
0
;
}
couponAmount
+=
couponDisAmount
;
coupon
[
ServerProps
(
PosProps
.
Amount
)]
=
couponDisAmount
;
coupon
[
ServerProps
(
PosProps
.
Pay_id
)]
=
"20003"
;
coupon
[
ServerProps
(
PosProps
.
Coupon_code
)]
=
c
.
code
();
payList
.
push_back
(
coupon
);
}
}
transObj
[
ServerProps
(
PosProps
.
Coupons
)]
=
couponArr
;
transObj
[
ServerProps
(
PosProps
.
Pay_ids
)]
=
payList
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
Transaction
)]
=
transObj
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
Transaction
)]
=
transObj
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
getPosJsonValue
(
PosProps
.
TransId
);
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
getPosJsonValue
(
PosProps
.
TransId
);
}
}
...
...
FMVip_LXJ/windows/fmviporder.cpp
View file @
6b70992e
...
@@ -41,6 +41,7 @@ bool FMVipOrder::initWnd(Session *session)
...
@@ -41,6 +41,7 @@ bool FMVipOrder::initWnd(Session *session)
int
orderAmount
=
session
->
data
(
PosProps
.
OrderAmount
).
toInt
();
int
orderAmount
=
session
->
data
(
PosProps
.
OrderAmount
).
toInt
();
int
needPay
=
orderAmount
-
session
->
data
(
PosProps
.
PaidAmount
).
toInt
();
int
needPay
=
orderAmount
-
session
->
data
(
PosProps
.
PaidAmount
).
toInt
();
session
->
addData
(
PosProps
.
NeedAmount
,
needPay
);
QString
needPay_str
=
QString
::
number
(
needPay
);
QString
needPay_str
=
QString
::
number
(
needPay
);
double
standard_amount
=
session
->
data
(
PosProps
.
StandardAmount
).
toInt
()
/
100.0
;
double
standard_amount
=
session
->
data
(
PosProps
.
StandardAmount
).
toInt
()
/
100.0
;
...
...
FMVip_LXJ/windows/fmviporder.h
View file @
6b70992e
...
@@ -91,7 +91,8 @@ private:
...
@@ -91,7 +91,8 @@ private:
QString
getPayAmountStr
(
QString
amountStr
)
QString
getPayAmountStr
(
QString
amountStr
)
{
{
double
payAmount
=
MIN
(
_needPay
,
(
amountStr
.
toDouble
()
+
_couponAmount
+
_useScore
))
*
100
;
// double payAmount = MIN(_needPay, (amountStr.toDouble() + _couponAmount + _useScore)) * 100;
double
payAmount
=
MIN
(
_needPay
,
(
amountStr
.
toDouble
()))
*
100
;
return
QString
::
number
(
payAmount
);
return
QString
::
number
(
payAmount
);
}
}
...
...
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