Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkpay
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
sbkpay
Commits
81d773dc
Commit
81d773dc
authored
Sep 02, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.流程调整点取消交易按钮后直接发起冲正,界面显示交易取消中,冲正尝试3次失败则写数据库,交由后台进程发起冲正。
parent
dc432b83
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
20 deletions
+152
-20
sbkpay/control.cpp
+126
-11
sbkpay/control.h
+2
-0
sbkpay/hostwidget.cpp
+12
-0
sbkpay/hostwidget.h
+2
-1
sbkpay/sbkpay.pro
+1
-1
sbkpay/sbkpay.pro.user
+9
-7
No files found.
sbkpay/control.cpp
View file @
81d773dc
...
...
@@ -153,15 +153,17 @@ bool Control::SendMessageToPayMent(const QJsonObject &json, QByteArray &outdata,
if
(
!
Control
::
HttpPost
(
url
,
array
,
data
,
"application/json;charset=utf-8"
,
"application/json"
,
error
,
60
))
{
if
(
json
.
contains
(
JSON_KEY_PARTORDERID
)
&&
!
json
[
JSON_KEY_PARTORDERID
].
toString
().
isEmpty
()
)
if
(
!
_isinterrupt
)
{
QVariantHash
hash
;
hash
.
insert
(
SQL_KEY_ORDERID
,
json
[
JSON_KEY_PARTORDERID
].
toString
());
hash
.
insert
(
SQL_KET_CONTENT
,
QString
(
data
));
if
(
json
.
contains
(
JSON_KEY_REQTYPE
)
&&
json
[
JSON_KEY_REQTYPE
].
toInt
()
==
72
)
{
QVariantHash
hash
;
hash
.
insert
(
SQL_KEY_ORDERID
,
json
[
JSON_KEY_PARTORDERID
].
toString
());
hash
.
insert
(
SQL_KET_CONTENT
,
QString
(
data
));
_db
->
insert
(
DB_TABLE_NAME
,
hash
);
_db
->
insert
(
DB_TABLE_NAME
,
hash
);
}
}
return
false
;
...
...
@@ -237,6 +239,63 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
return
true
;
}
bool
Control
::
RollHttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
)
{
QString
path
;
ToolS
::
GetPath
(
path
);
QString
host
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_HOST
).
toString
();
QEventLoop
loop
;
QTimer
timer
;
QSslConfiguration
config
=
QSslConfiguration
::
defaultConfiguration
();
config
.
setPeerVerifyMode
(
QSslSocket
::
VerifyNone
);
QNetworkAccessManager
manger
;
QNetworkRequest
request
(
url
);
request
.
setSslConfiguration
(
config
);
request
.
setRawHeader
(
"Content-Type"
,
content
.
toUtf8
());
request
.
setRawHeader
(
"Accept"
,
accept
.
toUtf8
());
request
.
setRawHeader
(
"Host"
,
host
.
toUtf8
());
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
manger
,
&
QNetworkAccessManager
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
_widget
,
&
HostWidget
::
Interrupt
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
reply
,
static_cast
<
void
(
QNetworkReply
::*
)(
QNetworkReply
::
NetworkError
)
>
(
&
QNetworkReply
::
error
),
&
loop
,
&
QEventLoop
::
quit
);
timer
.
start
(
timeout
*
1000
);
loop
.
exec
();
reply
->
deleteLater
();
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
error
=
QString
::
fromLocal8Bit
(
"网络异常,获取服务端返回数据失败"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
outdata
=
reply
->
readAll
();
if
(
outdata
.
isEmpty
())
{
error
=
QString
::
fromLocal8Bit
(
"网络异常,获取服务端返回数据为空"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
QLOG_INFO
()
<<
outdata
.
data
();
return
true
;
}
bool
Control
::
GetRSA
(
QString
&
error
)
{
...
...
@@ -343,16 +402,72 @@ void Control::Request(ReqType type, QStringList list)
else
SetResPonseWithMessage
(
"23"
,
error
);
_lock
.
lock
();
if
(
_widget
!=
NULL
&&
type
==
finds
)
if
(
!
_isinterrupt
)
{
_widget
->
ShowWiteJson
(
rlt
,
rtjson
,
error
);
_lock
.
lock
();
if
(
_widget
!=
NULL
&&
type
==
finds
)
{
_widget
->
ShowWiteJson
(
rlt
,
rtjson
,
error
);
}
else
{
_widget
->
ShowWiteMGS
(
type
,
rlt
,
error
);
}
_lock
.
unlock
();
}
else
{
_widget
->
ShowWiteMGS
(
type
,
rlt
,
error
);
int
i
=
0
;
bool
tmpflag
=
false
;
QByteArray
tmparray
;
QString
path
,
tmperror
;
ToolS
::
GetPath
(
path
);
QString
url
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_URL
).
toString
();
QJsonObject
tmpjson
=
json
;
tmpjson
.
insert
(
JSON_KEY_REQTYPE
,
3
);
CretOperate
::
GetSign
(
tmpjson
);
QLOG_INFO
()
<<
"send json to payment: "
<<
tmpjson
;
QByteArray
tmpdata
=
QJsonDocument
(
tmpjson
).
toJson
(
QJsonDocument
::
Compact
);
while
(
i
<
3
)
{
if
((
tmpflag
=
RollHttpPost
(
url
,
tmparray
,
tmpdata
,
"application/json;charset=utf-8"
,
"application/json"
,
tmperror
,
15
))
==
true
)
break
;
QLOG_ERROR
()
<<
"rollback failed : "
<<
tmperror
;
++
i
;
}
if
(
tmpflag
)
SetResPonseWithMessage
(
"23"
,
QString
::
fromLocal8Bit
(
"支付取消成功"
));
else
{
QVariantHash
hash
;
hash
.
insert
(
SQL_KEY_ORDERID
,
json
[
JSON_KEY_PARTORDERID
].
toString
());
hash
.
insert
(
SQL_KET_CONTENT
,
QString
(
tmpdata
));
QLOG_ERROR
()
<<
"roll back faile , move request to database : "
<<
json
;
_db
->
insert
(
DB_TABLE_NAME
,
hash
);
SetResPonseWithMessage
(
"23"
,
QString
::
fromLocal8Bit
(
"支付取消失败"
));
}
_lock
.
lock
();
if
(
_widget
!=
NULL
&&
type
==
finds
)
{
_widget
->
ShowWiteJson
(
rlt
,
rtjson
,
error
);
}
else
{
_widget
->
ShowWiteMGS
(
type
,
rlt
,
error
);
}
_lock
.
unlock
();
}
_lock
.
unlock
();
}
void
Control
::
RequestWithType
(
ReqType
type
,
QStringList
list
)
...
...
sbkpay/control.h
View file @
81d773dc
...
...
@@ -51,6 +51,8 @@ private:
bool
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
bool
RollHttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
public
slots
:
void
RequestWithType
(
ReqType
type
,
QStringList
list
);
...
...
sbkpay/hostwidget.cpp
View file @
81d773dc
...
...
@@ -593,7 +593,19 @@ void HostWidget::on_btn_find_up_clicked()
on_btn_find_check_clicked
();
}
void
HostWidget
::
HideExit
()
{
ui
->
btn_pay_exitint
->
hide
();
}
void
HostWidget
::
on_btn_pay_exitint_clicked
()
{
if
(
_intertime
.
isActive
())
_intertime
.
stop
();
ui
->
btn_pay_exitint
->
hide
();
ui
->
btn_pay_exit
->
hide
();
_label_pay_timer
->
start
(
60
);
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"交易取消中"
));
emit
Interrupt
();
}
sbkpay/hostwidget.h
View file @
81d773dc
...
...
@@ -31,7 +31,8 @@ public:
void
ShowWiteJson
(
bool
flag
,
QJsonObject
object
,
QString
error
);
void
setRuning
(
bool
runing
);
void
setRuning
(
bool
runing
);
void
HideExit
();
signals
:
void
RequestWithType
(
ReqType
type
,
QStringList
list
);
...
...
sbkpay/sbkpay.pro
View file @
81d773dc
...
...
@@ -15,7 +15,7 @@ include("./DataProcess/DataProcess.pri")
LIBS
+=
-
L
$$
PWD
/
lib
-
llibeay32
-
lssleay32
CONFIG
+=
C
++
11
SBKDLL
CONFIG
+=
C
++
11
include
(
$$
PWD
/
qtwinmigrate
/
src
/
qtwinmigrate
.
pri
)
...
...
sbkpay/sbkpay.pro.user
View file @
81d773dc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-0
8-31T18:35:35
. -->
<!-- Written by QtCreator 3.5.1, 2017-0
9-02T12:08:46
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
@@ -61,7 +61,7 @@
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Desktop Qt 5.5.1 MSVC2010 32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
>
Desktop Qt 5.5.1 MSVC2010 32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
qt.55.win32_msvc2010_kit
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
1
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveDeployConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveRunConfiguration"
>
0
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.0"
>
...
...
@@ -226,12 +226,14 @@
</valuelist>
<value
type=
"int"
key=
"PE.EnvironmentAspect.Base"
>
2
</value>
<valuelist
type=
"QVariantList"
key=
"PE.EnvironmentAspect.Changes"
/>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.Arguments"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.Executable"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory"
>
%{buildDir}
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
自定义执行档
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
sbkpay
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
ProjectExplorer.CustomExecutableRunConfiguration
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4RunConfiguration:D:/gitcode/sbkpay/sbkpay/sbkpay.pro
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"
></value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.ProFile"
>
sbkpay.pro
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"
>
false
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"
>
false
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"
></value>
<value
type=
"uint"
key=
"RunConfiguration.QmlDebugServerPort"
>
3768
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebugger"
>
false
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebuggerAuto"
>
true
</value>
...
...
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