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
df0cc34f
Commit
df0cc34f
authored
Jun 05, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修改了支付方式类型。 2. 实现了充值、支付服务端响应超时后自动冲正。
parent
ffe2d553
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
45 deletions
+71
-45
FMVip_LXJ/fmnetwork.cpp
+1
-1
FMVip_LXJ/fmnetwork.h
+1
-1
FMVip_LXJ/global.h
+4
-4
FMVip_LXJ/task/taskfinal.cpp
+21
-8
FMVip_LXJ/task/taskfund.cpp
+9
-1
FMVip_LXJ/task/taskothers.cpp
+21
-21
FMVip_LXJ/task/taskothers.h
+6
-6
FMVip_LXJ/task/taskpay.cpp
+8
-3
No files found.
FMVip_LXJ/fmnetwork.cpp
View file @
df0cc34f
#include "fmnetwork.h"
#
include
"fmnetwork.h"
#include "global.h"
#include <QNetworkAccessManager>
#include <QNetworkReply>
...
...
FMVip_LXJ/fmnetwork.h
View file @
df0cc34f
#ifndef FMNETWORK_H
#
ifndef
FMNETWORK_H
#define FMNETWORK_H
#include <QObject>
...
...
FMVip_LXJ/global.h
View file @
df0cc34f
...
...
@@ -25,11 +25,12 @@ const static QStringList FM_Server_Type = QString(
"member_check_request,"
"order_request,"
"integral_request,"
"order_correct_request,"
// 冲正
"order_correct_request,"
"order_recharge_request,"
"order_cardlock_request,"
"order_cardactive_request,"
"order_coupon_request"
).
split
(
","
);
"order_coupon_request,"
"order_refund_request"
).
split
(
","
);
// 请求类型的枚举值
enum
FM_TYPE
{
...
...
@@ -42,8 +43,7 @@ enum FM_TYPE {
FM_Card_Lock
,
FM_Card_Active
,
FM_Coupon
,
FM_Order_Revoke
FM_Reversal
// 充值、支付冲正
};
enum
Member_Type
{
...
...
FMVip_LXJ/task/taskfinal.cpp
View file @
df0cc34f
...
...
@@ -28,21 +28,21 @@ void TaskFinal::packageServerReq()
{
QJsonObject
pay_ob
=
pay_v
.
toObject
();
QString
type
=
pay_ob
[
PosProps
.
Pay_id
].
toString
();
if
(
type
==
"
01
"
)
{
if
(
type
==
"
20005
"
)
{
cashAmount
=
pay_ob
[
PosProps
.
Paid_total_amount
].
toInt
();
}
else
if
(
type
==
"2
4
"
)
{
}
else
if
(
type
==
"2
0001
"
)
{
codeAmount
=
pay_ob
[
PosProps
.
Paid_total_amount
].
toInt
();
}
else
if
(
type
==
"2
5
"
)
{
}
else
if
(
type
==
"2
0002
"
)
{
scoreAmount
=
pay_ob
[
PosProps
.
Paid_total_amount
].
toInt
();
}
else
if
(
type
==
"
77
"
)
{
// 代金券
}
else
if
(
type
==
"
20003
"
)
{
// 代金券
coupons
.
append
(
pay_ob
[
PosProps
.
Coupon_code
].
toString
());
}
else
if
(
type
==
"
72"
||
type
==
"73
"
||
type
==
"12"
)
{
}
else
if
(
type
==
"
10001"
||
type
==
"10004
"
||
type
==
"12"
)
{
thirdAmount
=
pay_ob
[
PosProps
.
Paid_total_amount
].
toInt
();
trans
[
ServerProps
(
PosProps
.
Pay_transId
)]
=
pay_ob
[
PosProps
.
Pay_transId
];
if
(
type
==
"
72
"
)
{
// 支付宝
if
(
type
==
"
10001
"
)
{
// 支付宝
trans
[
ServerProps
(
PosProps
.
Pay_type
)]
=
1
;
}
else
if
(
type
==
"
73
"
)
{
// 微信
}
else
if
(
type
==
"
10004
"
)
{
// 微信
trans
[
ServerProps
(
PosProps
.
Pay_type
)]
=
2
;
}
else
if
(
type
==
"12"
)
{
// 非码支付
trans
[
ServerProps
(
PosProps
.
Pay_type
)]
=
5
;
...
...
@@ -63,9 +63,11 @@ void TaskFinal::packageServerReq()
{
auto
po
=
pValue
.
toObject
();
QJsonObject
spo
;
for
(
auto
prop
:
{
PosProps
.
ConsumeNum
,
PosProps
.
Pr
ice
,
PosProps
.
Pr
oductId
})
{
for
(
auto
prop
:
{
PosProps
.
ConsumeNum
,
PosProps
.
ProductId
})
{
spo
[
ServerProps
(
prop
)]
=
po
[
prop
];
}
double
price
=
po
[
PosProps
.
Price
].
toDouble
()
/
po
[
PosProps
.
ConsumeNum
].
toDouble
();
spo
[
ServerProps
(
PosProps
.
Price
)]
=
price
;
propducts
.
append
(
spo
);
}
trans
[
ServerProps
(
PosProps
.
Products
)]
=
propducts
;
...
...
@@ -111,6 +113,17 @@ void TaskFinal::packagePOSRsp()
posRspJsonObj
[
prop
]
=
getServerJsonValue
(
prop
);
}
posRspJsonObj
[
PosProps
.
Prompt
]
=
1
;
if
(
posRspJsonObj
[
PosProps
.
StatusCode
].
toInt
()
!=
FM_API_SUCCESS
)
{
posRspJsonObj
[
PosProps
.
StatusCode
]
=
FM_API_SUCCESS
;
QString
fmId
=
posReqJsonObj
[
PosProps
.
Fm_id
].
toString
();
if
(
fmId
==
""
)
{
fmId
=
posReqJsonObj
[
PosProps
.
TransId
].
toString
();
}
posRspJsonObj
[
PosProps
.
Fm_id
]
=
fmId
;
FMMsgWnd
::
FailureWnd
(
QString
(
"非码订单结算时遇到问题,请将此订单退款并重新下单。
\n
%1"
)
.
arg
(
posRspJsonObj
[
PosProps
.
Msg
].
toString
()));
}
}
QString
TaskFinal
::
backup
()
...
...
FMVip_LXJ/task/taskfund.cpp
View file @
df0cc34f
#include "taskfund.h"
#
include
"taskfund.h"
#include "fmvipfund.h"
#include "tasklogin.h"
#include "taskothers.h"
#include <QDateTime>
TaskFund
::
TaskFund
(
QJsonObject
&
jsonObj
,
Session
*
session
,
QObject
*
parent
)
...
...
@@ -56,7 +57,14 @@ void TaskFund::packagePOSRsp()
void
TaskFund
::
onFund
()
{
sendToServer
(
false
);
if
(
error
()
!=
FM_API_SUCCESS
)
{
// 如果超时错误,则发起冲正
if
(
error
()
==
FM_API_TIMEOUT
)
{
posReqJsonObj
[
PosProps
.
TransId
]
=
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)];
FMTask
*
reversalTask
=
new
TaskRefundOrder
(
posReqJsonObj
,
this
);
reversalTask
->
doTask
();
}
QString
msg
=
"充值失败:
\n
"
+
errorString
();
FMMsgWnd
::
FailureWnd
(
msg
);
}
else
if
(
getServerJsonValue
(
PosProps
.
StatusCode
).
toInt
()
!=
FM_API_SUCCESS
)
{
...
...
FMVip_LXJ/task/taskothers.cpp
View file @
df0cc34f
...
...
@@ -21,9 +21,12 @@ void TaskCoupon::packageServerReq()
{
auto
po
=
pValue
.
toObject
();
QJsonObject
spo
;
for
(
auto
prop
:
{
PosProps
.
ConsumeNum
,
PosProps
.
Price
,
PosProps
.
ProductId
})
{
for
(
auto
prop
:
{
PosProps
.
ConsumeNum
,
PosProps
.
ProductId
})
{
spo
[
ServerProps
(
prop
)]
=
po
[
prop
];
}
double
price
=
po
[
PosProps
.
Price
].
toDouble
()
/
po
[
PosProps
.
ConsumeNum
].
toDouble
();
spo
[
ServerProps
(
PosProps
.
Price
)]
=
price
;
propducts
.
append
(
spo
);
}
transaction
[
ServerProps
(
PosProps
.
Products
)]
=
propducts
;
...
...
@@ -46,7 +49,7 @@ void TaskCoupon::packagePOSRsp()
QString
desc
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_name
)].
toString
();
double
limitAmount
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_limitAmount
)].
toInt
()
/
100.0
;
bool
isCompatible
=
(
couponOb
[
ServerProps
(
PosProps
.
Coupon_compatible
)].
toInt
()
==
qrand
()
%
2
+
1
);
bool
isCompatible
=
(
couponOb
[
ServerProps
(
PosProps
.
Coupon_compatible
)].
toInt
()
==
1
);
Coupon
c
(
desc
,
code
,
amount
,
limitAmount
,
isCompatible
);
QVariant
v
;
...
...
@@ -56,20 +59,22 @@ void TaskCoupon::packagePOSRsp()
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
}
/// 退款
TaskRefundPay
::
TaskRefundPay
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Order_Revoke
,
0
,
parent
)
/// 退单
TaskRefundOrder
::
TaskRefundOrder
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Order_Refund
,
0
,
parent
)
{
}
void
TaskRefund
Pay
::
packageServerReq
()
void
TaskRefund
Order
::
packageServerReq
()
{
serverReqJsonObj
[
ServerProps
(
PosProps
.
Fm_id
)]
=
getPosJsonValue
(
PosProps
.
Fm_id
);
QString
transId
=
getPosJsonValue
(
PosProps
.
TransId
).
toString
(
""
);
QString
fmId
=
getPosJsonValue
(
PosProps
.
Fm_id
).
toString
(
""
);
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
transId
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
Fm_id
)]
=
fmId
;
}
void
TaskRefund
Pay
::
packagePOSRsp
()
void
TaskRefund
Order
::
packagePOSRsp
()
{
for
(
auto
prop
:
{
PosProps
.
StatusCode
,
PosProps
.
Msg
})
{
posRspJsonObj
[
prop
]
=
getServerJsonValue
(
ServerProps
(
prop
));
...
...
@@ -77,23 +82,18 @@ void TaskRefundPay::packagePOSRsp()
posRspJsonObj
[
PosProps
.
Prompt
]
=
1
;
}
/// 退单
TaskRefundOrder
::
TaskRefundOrder
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Order_Refund
,
0
,
parent
)
/// 冲正
TaskReversal
::
TaskReversal
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Reversal
,
0
,
parent
)
{
posReqJsonObj
=
jsonObj
;
}
void
TaskRe
fundOrder
::
packageServerReq
()
void
TaskRe
versal
::
packageServerReq
()
{
serverReqJsonObj
[
ServerProps
(
PosProps
.
Fm_id
)]
=
getPosJsonValue
(
PosProps
.
Fm_i
d
);
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
getPosJsonValue
(
PosProps
.
TransI
d
);
}
void
TaskRe
fundOrder
::
packagePOSRsp
()
void
TaskRe
versal
::
packagePOSRsp
()
{
for
(
auto
prop
:
{
PosProps
.
StatusCode
,
PosProps
.
Msg
})
{
posRspJsonObj
[
prop
]
=
getServerJsonValue
(
ServerProps
(
prop
));
}
posRspJsonObj
[
PosProps
.
Prompt
]
=
1
;
}
FMVip_LXJ/task/taskothers.h
View file @
df0cc34f
...
...
@@ -13,22 +13,22 @@ public:
void
packagePOSRsp
();
};
//
支付
退款
class
TaskRefund
Pay
:
public
FMTaskNoWnd
//
整单
退款
class
TaskRefund
Order
:
public
FMTaskNoWnd
{
Q_OBJECT
public
:
explicit
TaskRefund
Pay
(
QJsonObject
&
jsonObj
,
QObject
*
parent
=
0
);
explicit
TaskRefund
Order
(
QJsonObject
&
jsonObj
,
QObject
*
parent
=
0
);
void
packageServerReq
();
void
packagePOSRsp
();
};
//
整单
退款
class
TaskRe
fundOrder
:
public
FMTaskNoWnd
//
支付
退款
class
TaskRe
versal
:
public
FMTaskNoWnd
{
Q_OBJECT
public
:
explicit
TaskRe
fundOrder
(
QJsonObject
&
jsonObj
,
QObject
*
parent
=
0
);
explicit
TaskRe
versal
(
QJsonObject
&
jsonObj
,
QObject
*
parent
=
0
);
void
packageServerReq
();
void
packagePOSRsp
();
};
...
...
FMVip_LXJ/task/taskpay.cpp
View file @
df0cc34f
...
...
@@ -84,14 +84,14 @@ void TaskPay::packagePOSRsp()
QJsonArray
pay_ids
;
QJsonObject
pay_id
;
pay_id
[
PosProps
.
Pay_id
]
=
"2
4
"
;
pay_id
[
PosProps
.
Pay_id
]
=
"2
0001
"
;
pay_id
[
PosProps
.
Pay_str
]
=
"会员储值金支付"
;
int
codeAmount
=
getServerJsonValue
(
PosProps
.
CodeAmount
).
toInt
();
pay_id
[
PosProps
.
Paid_total_amount
]
=
codeAmount
;
paidTotalAmount
+=
codeAmount
;
pay_ids
.
append
(
pay_id
);
pay_id
[
PosProps
.
Pay_id
]
=
"2
5
"
;
pay_id
[
PosProps
.
Pay_id
]
=
"2
0002
"
;
pay_id
[
PosProps
.
Pay_str
]
=
"会员积分支付"
;
int
scoreAmount
=
getServerJsonValue
(
PosProps
.
ScoreAmount
).
toInt
();
pay_id
[
PosProps
.
Paid_total_amount
]
=
scoreAmount
;
...
...
@@ -100,7 +100,7 @@ void TaskPay::packagePOSRsp()
for
(
auto
coupon
:
getServerJsonValue
(
PosProps
.
Coupons
).
toArray
())
{
QJsonObject
cp
=
coupon
.
toObject
();
pay_id
[
PosProps
.
Pay_id
]
=
"
77
"
;
pay_id
[
PosProps
.
Pay_id
]
=
"
20003
"
;
pay_id
[
PosProps
.
Pay_str
]
=
"代金券支付"
;
int
couponAmount
=
cp
[
ServerProps
(
PosProps
.
Coupon_disAmount
)].
toInt
();
pay_id
[
PosProps
.
Paid_total_amount
]
=
couponAmount
;
...
...
@@ -119,6 +119,11 @@ void TaskPay::packagePOSRsp()
void
TaskPay
::
onPay
()
{
sendToServer
();
// 如果超时错误,则发起冲正
if
(
error
()
==
FM_API_TIMEOUT
)
{
FMTask
*
reversalTask
=
new
TaskReversal
(
posReqJsonObj
,
this
);
reversalTask
->
doTask
();
}
closeWindow
();
}
...
...
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