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
08b78a0f
Commit
08b78a0f
authored
Sep 17, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 整合master分支 [
d0285615
] 代码。
parent
e3a81986
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
27 deletions
+24
-27
sbkpay/DataProcess/cretopt.h
+0
-2
sbkpay/DataProcess/fmp_database.cpp
+3
-9
sbkpay/DataProcess/rollback.cpp
+18
-15
sbkpay/DataProcess/rollback.h
+2
-0
sbkpay/main.cpp
+1
-1
No files found.
sbkpay/DataProcess/cretopt.h
View file @
08b78a0f
...
...
@@ -76,9 +76,7 @@ public:
DataProcess
::
GetJsonKeyArray
(
list
,
json
);
DataProcess
::
SortString
(
list
);
QLOG_INFO
()
<<
"list: "
<<
list
;
DataProcess
::
GetValueFromJson
(
list
,
json
,
values
);
QLOG_INFO
()
<<
"values: "
<<
values
;
QByteArray
array
=
values
.
toUtf8
();
...
...
sbkpay/DataProcess/fmp_database.cpp
View file @
08b78a0f
...
...
@@ -80,10 +80,7 @@ bool FMPDataBase::insert(QString table, QVariantHash data)
QStringList
columnnamelist
;
QStringList
columnvaluelist
;
if
(
!
getSql
(
table
,
data
,
columnnamelist
,
columnvaluelist
))
{
return
false
;
}
getSql
(
table
,
data
,
columnnamelist
,
columnvaluelist
);
QSqlQuery
query
(
_db
);
...
...
@@ -110,10 +107,7 @@ bool FMPDataBase::update(QString table, QVariantHash data, QString condition)
QString
sql
;
if
(
!
getSql
(
table
,
data
,
sql
))
{
return
false
;
}
getSql
(
table
,
data
,
sql
);
QSqlQuery
query
(
_db
);
...
...
@@ -209,7 +203,7 @@ bool FMPDataBase::getSql(QString table, QVariantHash data, QStringList& columnna
if
(
columnnamelist
.
size
()
==
0
)
return
fals
e
;
return
tru
e
;
return
true
;
}
...
...
sbkpay/DataProcess/rollback.cpp
View file @
08b78a0f
...
...
@@ -87,8 +87,10 @@ void RollBack::RollWiteQuery(QSqlDatabase &_db, QSqlQuery &query)
if
(
FMNetWork
::
RequestToOLTP
(
json
,
array
,
error
,
20
))
{
QString
sql
=
QString
(
"delete from orderlist where orderid='%1'"
).
arg
(
parnetid
);
QLOG_ERROR
()
<<
sql
;
query
.
exec
(
sql
);
QLOG_INFO
()
<<
sql
;
if
(
!
query
.
exec
(
sql
))
QLOG_ERROR
()
<<
query
.
lastError
()
<<
query
.
lastError
().
text
();
}
QLOG_WARN
()
<<
"rollback resulte "
<<
QThread
::
currentThreadId
()
<<
":"
<<
array
;
...
...
@@ -101,21 +103,21 @@ void RollBack::run()
QString
path
;
ToolS
::
GetPath
(
path
);
QSqlDatabase
_db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
,
QString
(
"backup"
));
_db
.
setDatabaseName
(
path
+
DB_ORDER
);
_db
.
open
();
while
(
!
isInterruptionRequested
())
{
// int timeout = setting.GetValue(VALUE_TIMEOUT, 30).toInt();
// if(timeout == 0)
// timeout = 30;
int
timeout
=
_setting
.
GetValue
(
VALUE_TIMEOUT
,
30
).
toInt
();
do
{
QSqlDatabase
_db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
,
QString
(
"backup"
));
_db
.
setDatabaseName
(
path
+
DB_ORDER
);
_db
.
open
();
QSqlQuery
query
(
_db
);
QLOG_WARN
()
<<
"find sql : "
<<
"select * from orderlist"
;
bool
flag
=
query
.
exec
(
"select * from orderlist"
);
if
(
!
flag
)
...
...
@@ -124,14 +126,15 @@ void RollBack::run()
RollWiteQuery
(
_db
,
query
);
_db
.
close
();
}
while
(
0
);
//
QEventLoop loop;
//
QTimer timer;
//
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
//
timer.start(timeout*1000);
QEventLoop
loop
;
QTimer
timer
;
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
timer
.
start
(
timeout
*
1000
);
// loop.exec();
this
->
sleep
(
1
);
loop
.
exec
();
}
}
sbkpay/DataProcess/rollback.h
View file @
08b78a0f
...
...
@@ -4,6 +4,7 @@
#include <QThread>
#include <QPointer>
#include <QSemaphore>
#include "fmp_settings.h"
class
QSqlDatabase
;
class
QSqlQuery
;
...
...
@@ -22,6 +23,7 @@ public:
private
:
//FMPDataBase *_db;
QSemaphore
_spr
;
FMPSettings
_setting
;
};
#endif // ROLLBACK_H
sbkpay/main.cpp
View file @
08b78a0f
...
...
@@ -35,7 +35,7 @@ static void InitLogger()
logLevel
=
QsLogging
::
TraceLevel
;
}
int
logSize
=
setting
.
GetValue
(
CONFIG_LOG_SIZE
,
1
).
toInt
();
int
logCount
=
setting
.
GetValue
(
CONFIG_LOG_COUNT
,
5
).
toInt
();
int
logCount
=
setting
.
GetValue
(
CONFIG_LOG_COUNT
,
20
).
toInt
();
QDir
logDir
(
logPath
);
if
(
!
logDir
.
exists
())
{
...
...
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