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
0ba5bc93
Commit
0ba5bc93
authored
Sep 08, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 可配置日志相关参数。
parent
35113112
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
20 deletions
+55
-20
sbkpay/DataProcess/cretopt.h
+2
-0
sbkpay/DataProcess/rollback.cpp
+9
-8
sbkpay/control.cpp
+0
-2
sbkpay/global.h
+5
-0
sbkpay/main.cpp
+20
-8
sbkpay/rspfactory.h
+1
-1
sbkpay/version.h
+1
-1
tests/TestSimphony/tst_testsimphony.cpp
+17
-0
No files found.
sbkpay/DataProcess/cretopt.h
View file @
0ba5bc93
...
...
@@ -76,7 +76,9 @@ 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/rollback.cpp
View file @
0ba5bc93
...
...
@@ -107,10 +107,10 @@ void RollBack::run()
while
(
!
isInterruptionRequested
())
{
int
timeout
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_TIMEOUT
).
toInt
();
// int timeout = setting.GetValue(VALUE_TIMEOUT, 30
).toInt();
if
(
timeout
==
0
)
timeout
=
30
;
//
if(timeout == 0)
//
timeout = 30;
do
{
...
...
@@ -128,11 +128,12 @@ void RollBack::run()
}
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
();
// loop.exec();
this
->
sleep
(
1
);
}
}
sbkpay/control.cpp
View file @
0ba5bc93
...
...
@@ -435,8 +435,6 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
int
result
=
skbSend
(
in
,
guid
,
out
,
errMsg
,
mode
.
data
(),
operation
.
data
());
#endif //! End def MOCK
QLOG_DEBUG
()
<<
"StarbucksAPI return to GBK: "
<<
QString
::
fromLocal8Bit
(
out
);
QString
outXMlString
=
QString
::
fromLocal8Bit
(
out
);
QLOG_INFO
()
<<
"OLTP return: "
<<
result
<<
" data: "
<<
outXMlString
;
...
...
sbkpay/global.h
View file @
0ba5bc93
...
...
@@ -106,6 +106,11 @@
#define CONFIG_PRINT_ENDDAY_NAME "PRINT/EDNDAYNAME"
#define CONFIG_PRINT_SHIFT_NAME "PRINT/SHIFTNAME"
#define CONFIG_PRINT_AGAIN_NAME "PRINT/AGAINNAME"
#define CONFIG_LOG_PATH "LOG/PATH"
#define CONFIG_LOG_NAME "LOG/NAME"
#define CONFIG_LOG_LEVEL "LOG/LEVEL"
#define CONFIG_LOG_SIZE "LOG/SIZE"
#define CONFIG_LOG_COUNT "LOG/COUNT"
#endif // GLOBAL
sbkpay/main.cpp
View file @
0ba5bc93
...
...
@@ -81,7 +81,7 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
qputenv
(
"PATH"
,
val
);
FMPSettings
setting
;
QString
configPath
=
setting
.
GetValue
(
CONFIG_ALL_PATH
,
"C:
\\
Freemud
\\
"
).
toString
();
QString
configPath
=
setting
.
GetValue
(
CONFIG_ALL_PATH
,
path
).
toString
();
QApplication
::
addLibraryPath
(
configPath
);
qDebug
()
<<
"Library paths: "
<<
QApplication
::
libraryPaths
()
<<
configPath
;
...
...
@@ -101,17 +101,29 @@ extern "C" __declspec(dllexport) void Start(const char *indata, char *outdata)
char
path
[
MAX_PATH
]
=
{
0
};
ToolS
::
GetProcPath
(
path
);
QString
logDir
=
QString
(
"%1/log"
).
arg
(
QString
(
path
));
QDir
().
mkdir
(
logDir
);
FMPSettings
setting
;
QString
logPath
=
setting
.
GetValue
(
CONFIG_LOG_PATH
,
QString
(
path
)
+
"/log"
).
toString
();
QString
logName
=
setting
.
GetValue
(
CONFIG_LOG_NAME
,
"sbuxpay.txt"
).
toString
();
QsLogging
::
Level
logLevel
=
(
QsLogging
::
Level
)
setting
.
GetValue
(
CONFIG_LOG_LEVEL
,
0
).
toInt
();
if
(
logLevel
<
QsLogging
::
TraceLevel
||
logLevel
>
QsLogging
::
OffLevel
)
{
logLevel
=
QsLogging
::
TraceLevel
;
}
int
logSize
=
setting
.
GetValue
(
CONFIG_LOG_SIZE
,
1
).
toInt
();
int
logCount
=
setting
.
GetValue
(
CONFIG_LOG_COUNT
,
5
).
toInt
();
QDir
logDir
(
logPath
);
if
(
!
logDir
.
exists
())
{
logDir
.
mkpath
(
logDir
.
absolutePath
());
}
QString
logFilePath
=
logDir
.
absolutePath
()
+
'/'
+
logName
;
QsLogging
::
Logger
&
logger
=
QsLogging
::
Logger
::
instance
();
logger
.
setLoggingLevel
(
QsLogging
::
TraceLevel
);
QString
str
=
QString
(
path
)
+
"
\\
log
\\
sbuxpay.txt"
;
logger
.
setLoggingLevel
(
logLevel
);
/* 配置输出定向器 */
QsLogging
::
DestinationPtr
fileDestination
(
QsLogging
::
DestinationFactory
::
MakeFileDestination
(
str
,
QsLogging
::
EnableLogRotation
,
QsLogging
::
MaxSizeBytes
(
1024
*
1024
),
QsLogging
::
MaxOldLogCount
(
5
)));
logFilePath
,
QsLogging
::
EnableLogRotation
,
QsLogging
::
MaxSizeBytes
(
1024
*
1024
*
logSize
),
QsLogging
::
MaxOldLogCount
(
logCount
)));
logger
.
addDestination
(
fileDestination
);
QsLogging
::
DestinationPtr
consleDest
(
QsLogging
::
DestinationFactory
::
MakeDebugOutputDestination
());
...
...
sbkpay/rspfactory.h
View file @
0ba5bc93
...
...
@@ -364,7 +364,7 @@ private:
QString
printFileName
=
setting
.
GetValue
(
configKey
,
PRINT_FILE_NAME
).
toString
();
QString
filePath
=
path
;
QString
filePath
=
dir
.
absolutePath
()
;
if
(
!
filePath
.
endsWith
(
'/'
)
&&
!
filePath
.
endsWith
(
'\\'
))
{
filePath
.
append
(
'\\'
);
}
...
...
sbkpay/version.h
View file @
0ba5bc93
...
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 3
7
#define VER_BUILD 3
8
//! Convert version numbers to string
#define _STR(S) #S
...
...
tests/TestSimphony/tst_testsimphony.cpp
View file @
0ba5bc93
...
...
@@ -4,6 +4,7 @@
#include "jsonfactory.h"
#include "fmnetwork.h"
#include "tools.h"
#include "cretopt.h"
#include <QDebug>
// add necessary includes here
...
...
@@ -26,6 +27,8 @@ private slots:
void
test_CreateOLTPXML_data
();
void
test_CreateOLTPXML
();
void
test_GetSign
();
};
TestSimphony
::
TestSimphony
()
...
...
@@ -167,6 +170,20 @@ void TestSimphony::test_InitPOSReqJsonObj()
QCOMPARE
(
resultJson
[
"statusCode"
].
toInt
(),
100
);
}
void
TestSimphony
::
test_GetSign
()
{
QByteArray
rollbackString
=
"{
\"
businessDate
\"
:
\"
20170907
\"
,
\"
code
\"
:
\"
282100361166771154
\"
,
\"
mac
\"
:
\"
F8-0F-41-82-C4-1F
\"
,
\"
operatorId
\"
:
\"
16151427
\"
,
\"
partnerId
\"
:1446,
\"
partnerOrderId
\"
:
\"
1446130116446320170907164514
\"
,
\"
promotionTag
\"
:
\"\"
,
\"
reqType
\"
:72,
\"
sign
\"
:
\"
WgxSX+sf5V0u6Zw4Vki/lswwAou+EX5aLL8g2WYVcYMEmkJsBEUNZsT/RHgVUZT4GiWbKSOixLf80qcES1ovZO4/nzEM7YoDBCeCBFZzhRmAWyIDa33lh23mm9JCgTF9T44kkxGmJtAnPyxUKPatZCSF0gfyjMjyqosInaxIxNA=
\"
,
\"
stationId
\"
:
\"
4463
\"
,
\"
storeId
\"
:
\"
130116
\"
,
\"
transAmount
\"
:100800,
\"
transId
\"
:431,
\"
undiscountAmount
\"
:0,
\"
ver
\"
:1}"
;
QJsonDocument
jsonDocument
=
QJsonDocument
::
fromJson
(
rollbackString
);
QJsonObject
json
=
jsonDocument
.
object
();
qDebug
()
<<
json
;
json
[
JSON_KEY_REQTYPE
]
=
3
;
json
[
JSON_KEY_VER
]
=
DEFAULT_JSON_VER_VALUE
;
QCOMPARE
(
CretOperate
::
GetSign
(
json
),
true
);
}
QTEST_MAIN
(
TestSimphony
)
#include "tst_testsimphony.moc"
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