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
1ac81a9b
Commit
1ac81a9b
authored
Aug 25, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.移植70%
parent
c8dd9d79
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
12 deletions
+46
-12
sbkpay/DataProcess/fmnetwork.cpp
+11
-5
sbkpay/DataProcess/fmnetwork.h
+1
-1
sbkpay/DataProcess/rollback.cpp
+28
-0
sbkpay/DataProcess/rollback.h
+2
-0
sbkpay/control.cpp
+3
-5
sbkpay/sbkpay.pro.user
+1
-1
No files found.
sbkpay/DataProcess/fmnetwork.cpp
View file @
1ac81a9b
...
@@ -17,12 +17,12 @@ FMNetWork::FMNetWork(QObject *parent) : QObject(parent)
...
@@ -17,12 +17,12 @@ FMNetWork::FMNetWork(QObject *parent) : QObject(parent)
}
}
bool
FMNetWork
::
HttpPost
(
Q
ByteArray
array
,
QString
content
,
QString
accept
,
int
timeout
)
bool
FMNetWork
::
HttpPost
(
Q
String
url
,
QByteArray
outdata
,
const
ByteArray
&
indata
,
QString
content
,
QString
accept
,
int
timeout
)
{
{
QString
path
;
QString
path
;
ToolS
::
GetPath
(
path
);
ToolS
::
GetPath
(
path
);
QString
url
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_URL
).
toString
();
//
QString url = QSettings(path + "\\" + USERCONFIG_NAME, QSettings::IniFormat).value(VALUE_URL).toString();
QString
host
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_HOST
).
toString
();
QString
host
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_HOST
).
toString
();
QEventLoop
loop
;
QEventLoop
loop
;
...
@@ -43,7 +43,7 @@ bool FMNetWork::HttpPost(QByteArray array, QString content, QString accept, int
...
@@ -43,7 +43,7 @@ bool FMNetWork::HttpPost(QByteArray array, QString content, QString accept, int
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
)
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
manger
,
&
QNetworkAccessManager
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
manger
,
&
QNetworkAccessManager
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
...
@@ -60,9 +60,15 @@ bool FMNetWork::HttpPost(QByteArray array, QString content, QString accept, int
...
@@ -60,9 +60,15 @@ bool FMNetWork::HttpPost(QByteArray array, QString content, QString accept, int
return
false
;
return
false
;
}
}
array
=
reply
->
readAll
();
outdata
=
reply
->
readAll
();
QLOG_INFO
()
<<
array
;
if
(
outdata
.
isEmpty
())
{
error
=
QString
::
fromLocal8Bit
(
"返回数据为空"
);
return
false
;
}
QLOG_INFO
()
<<
outdata
;
return
true
;
return
true
;
}
}
sbkpay/DataProcess/fmnetwork.h
View file @
1ac81a9b
...
@@ -9,7 +9,7 @@ class FMNetWork : public QObject
...
@@ -9,7 +9,7 @@ class FMNetWork : public QObject
public
:
public
:
explicit
FMNetWork
(
QObject
*
parent
=
0
);
explicit
FMNetWork
(
QObject
*
parent
=
0
);
static
bool
HttpPost
(
Q
ByteArray
array
,
QString
content
,
QString
accept
,
int
timeout
=
60
);
static
bool
HttpPost
(
Q
String
url
,
QByteArray
outdata
,
const
ByteArray
&
indata
,
QString
content
,
QString
accept
,
int
timeout
=
60
);
};
};
...
...
sbkpay/DataProcess/rollback.cpp
View file @
1ac81a9b
...
@@ -9,10 +9,13 @@
...
@@ -9,10 +9,13 @@
#include "tools.h"
#include "tools.h"
#include "QsLog.h"
#include "QsLog.h"
#include "cretopt.h"
#include "cretopt.h"
#include "fmnetwork.h"
#include <QtConcurrent>
RollBack
::
RollBack
(
QObject
*
parent
)
:
QThread
(
parent
)
RollBack
::
RollBack
(
QObject
*
parent
)
:
QThread
(
parent
)
{
{
_db
=
new
FMPDataBase
(
DB_ORDER
,
QString
(
"rollback"
));
_db
=
new
FMPDataBase
(
DB_ORDER
,
QString
(
"rollback"
));
_spr
.
release
(
10
);
}
}
RollBack
::~
RollBack
()
RollBack
::~
RollBack
()
...
@@ -53,8 +56,33 @@ void RollBack::RollWiteQuery(QSqlQuery &query)
...
@@ -53,8 +56,33 @@ void RollBack::RollWiteQuery(QSqlQuery &query)
continue
;
continue
;
}
}
QLOG_INFO
()
<<
json
;
QByteArray
data
=
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
);
_spr
.
acquire
();
QtConcurrent
::
run
(
[
this
,
parnetid
,
data
]()
{
QByteArray
array
;
QString
path
;
ToolS
::
GetPath
(
path
);
QString
url
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_URL
).
toString
();
if
(
FMNetWork
::
HttpPost
(
url
,
array
,
data
,
"application/json;charset=utf-8"
,
"application/json"
,
25
))
{
FMPDataBase
db
(
DB_ORDER
,
QString
(
"curr"
)
+
QString
::
number
(
QThread
::
currentThreadId
()));
db
.
dlt
(
DB_TABLE_NAME
,
QString
(
"%1='%2'"
).
arg
(
SQL_KEY_ORDERID
).
arg
(
parnetid
));
}
QLOG_WARN
()
<<
QThread
::
currentThreadId
()
<<
":"
<<
array
;
this
->
_spr
.
release
();
});
}
}
}
}
...
...
sbkpay/DataProcess/rollback.h
View file @
1ac81a9b
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <QThread>
#include <QThread>
#include <QPointer>
#include <QPointer>
#include <QSemaphore>
#include "fmp_database.h"
#include "fmp_database.h"
...
@@ -20,6 +21,7 @@ public:
...
@@ -20,6 +21,7 @@ public:
private
:
private
:
FMPDataBase
*
_db
;
FMPDataBase
*
_db
;
QSemaphore
_spr
;
};
};
#endif // ROLLBACK_H
#endif // ROLLBACK_H
sbkpay/control.cpp
View file @
1ac81a9b
...
@@ -264,16 +264,14 @@ bool Control::GetJson(ReqType type,QJsonObject &json, const QByteArray array, QS
...
@@ -264,16 +264,14 @@ bool Control::GetJson(ReqType type,QJsonObject &json, const QByteArray array, QS
if
(
type
==
againprint
)
if
(
type
==
againprint
)
json
.
insert
(
JSON_KEY_FMID
,
_fmId
);
json
.
insert
(
JSON_KEY_FMID
,
_fmId
);
if
(
type
==
refund
&&
json
.
contains
(
JSON_KEY_STATUSCODE
)
&&
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
json
.
insert
(
JSON_KET_CLIENTREF
,
FMTool
::
GetString
(
_request
.
Amount
,
12
));
RspFactory
::
GetResPonseJson
(
type
,
_response
,
json
);
RspFactory
::
GetResPonseJson
(
type
,
_response
,
json
);
if
(
json
.
contains
(
JSON_KEY_MESSAGE
))
if
(
json
.
contains
(
JSON_KEY_MESSAGE
))
error
=
json
[
JSON_KEY_MESSAGE
].
toString
();
error
=
json
[
JSON_KEY_MESSAGE
].
toString
();
if
(
type
==
refund
&&
json
.
contains
(
JSON_KEY_STATUSCODE
)
&&
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
json
.
insert
(
JSON_KET_CLIENTREF
,
FMTool
::
GetString
(
_request
.
Amount
,
12
));
if
(
json
.
contains
(
JSON_KEY_STATUSCODE
)
&&
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
if
(
json
.
contains
(
JSON_KEY_STATUSCODE
)
&&
json
[
JSON_KEY_STATUSCODE
].
toInt
()
==
100
)
return
true
;
return
true
;
...
...
sbkpay/sbkpay.pro.user
View file @
1ac81a9b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-08-25T1
4:34:56
. -->
<!-- Written by QtCreator 3.5.1, 2017-08-25T1
8:48:34
. -->
<qtcreator>
<qtcreator>
<data>
<data>
<variable>
EnvironmentId
</variable>
<variable>
EnvironmentId
</variable>
...
...
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