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
ffcf864b
Commit
ffcf864b
authored
Aug 12, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修正支付后崩溃问题(跨线程引用栈变量); 2. 乱码问题; 3. 导出接口去掉窗口句柄
parent
fffc6402
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
20 deletions
+80
-20
sbkpay/control.cpp
+14
-10
sbkpay/control.h
+1
-1
sbkpay/fmtool.h
+1
-1
sbkpay/hostwidget.cpp
+1
-1
sbkpay/jsonfactory.h
+1
-1
sbkpay/main.cpp
+59
-3
sbkpay/requestmodel.h
+1
-1
sbkpay/sbkpay.pro
+2
-2
No files found.
sbkpay/control.cpp
View file @
ffcf864b
...
...
@@ -72,31 +72,35 @@ void Control::InitModel()
bool
Control
::
SendMessageToPayMent
(
const
QJsonObject
&
json
,
QByteArray
&
outdata
,
QString
&
error
)
{
char
in
[
MAX_BUF_LEN
]
=
{
0
};
char
out
[
MAX_BUF_LEN
]
=
{
0
};
QByteArray
array
=
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
);
QLibrary
lib
(
qApp
->
applicationDirPath
()
+
"/"
+
"FreemudWrapper.dll"
);
outdata
.
clear
();
strcpy
(
in
,
array
);
if
(
lib
.
load
())
{
GetValue
getvalue
=
(
GetValue
)
lib
.
resolve
(
"_GetValue@8"
);
if
(
getvalue
!=
NULL
)
{
QEventLoop
loop
;
Q
tConcurrent
::
run
(
[
this
,
&
loop
,
&
in
,
&
out
,
getvalue
]()
Q
Future
<
QByteArray
>
future
=
QtConcurrent
::
run
(
[
this
,
&
loop
,
json
,
getvalue
]()
->
QByteArray
{
char
in
[
MAX_BUF_LEN
]
=
{
0
};
char
out
[
MAX_BUF_LEN
]
=
{
0
};
QByteArray
array
=
QJsonDocument
(
json
).
toJson
(
QJsonDocument
::
Compact
);
strcpy
(
in
,
array
);
getvalue
(
in
,
out
);
loop
.
exit
();
return
QByteArray
(
out
);
});
QFutureWatcher
<
QByteArray
>
watcher
;
watcher
.
setFuture
(
future
);
connect
(
&
watcher
,
SIGNAL
(
finished
()),
&
loop
,
SLOT
(
quit
()));
loop
.
exec
();
outdata
=
QByteArray
(
out
);
outdata
=
watcher
.
result
(
);
return
true
;
}
else
...
...
sbkpay/control.h
View file @
ffcf864b
#ifndef CONTROL_H
#
ifndef
CONTROL_H
#define CONTROL_H
#include "requestmodel.h"
...
...
sbkpay/fmtool.h
View file @
ffcf864b
#ifndef FMTOOL
#
ifndef
FMTOOL
#define FMTOOL
#include <windows.h>
...
...
sbkpay/hostwidget.cpp
View file @
ffcf864b
...
...
@@ -211,7 +211,7 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ui
->
label_pay_money
->
setVisible
(
true
);
ui
->
label_pay_money
->
setText
(
message
);
ui
->
btn_pay_exit
->
setVisible
(
true
);
ui
->
btn_pay_exit
->
setText
(
"确认"
);
ui
->
btn_pay_exit
->
setText
(
QString
::
fromLocal8Bit
(
"确认"
)
);
if
(
flag
)
{
ui
->
label_pay_msg_time
->
setVisible
(
true
);
...
...
sbkpay/jsonfactory.h
View file @
ffcf864b
#ifndef JSONFACTORY
#
ifndef
JSONFACTORY
#define JSONFACTORY
#include "requestmodel.h"
...
...
sbkpay/main.cpp
View file @
ffcf864b
#
ifdef
SBKDLL
#include <qwinwidget.h>
#include <QMessageBox>
#include <windows.h>
#include "control.h"
#include "global.h"
#include "QsLog.h"
#include "requestmodel.h"
#include "fmtool.h"
#include "rspfactory.h"
#include <QDir>
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstance
,
DWORD
dwReason
,
LPVOID
/*lpvReserved*/
)
{
static
bool
ownApplication
=
FALSE
;
if
(
dwReason
==
DLL_PROCESS_ATTACH
)
ownApplication
=
QMfcApp
::
pluginInstance
(
hInstance
);
if
(
dwReason
==
DLL_PROCESS_DETACH
&&
ownApplication
)
delete
qApp
;
return
TRUE
;
}
extern
"C"
__declspec
(
dllexport
)
void
Start
(
const
char
*
indata
,
char
*
outdata
)
{
HWND
parent
=
GetDesktopWindow
();
QWinWidget
win
(
parent
);
QString
logDir
=
QString
(
"%1/log"
).
arg
(
QApplication
::
applicationDirPath
());
QDir
().
mkdir
(
logDir
);
QsLogging
::
Logger
&
logger
=
QsLogging
::
Logger
::
instance
();
logger
.
setLoggingLevel
(
QsLogging
::
TraceLevel
);
QString
str
=
qApp
->
applicationDirPath
()
+
"/log/sbuxpay.txt"
;
/* 配置输出定向器 */
QsLogging
::
DestinationPtr
fileDestination
(
QsLogging
::
DestinationFactory
::
MakeFileDestination
(
str
,
QsLogging
::
EnableLogRotation
,
QsLogging
::
MaxSizeBytes
(
1024
*
1024
),
QsLogging
::
MaxOldLogCount
(
5
)));
logger
.
addDestination
(
fileDestination
);
QsLogging
::
DestinationPtr
consleDest
(
QsLogging
::
DestinationFactory
::
MakeDebugOutputDestination
());
logger
.
addDestination
(
consleDest
);
Control
control
(
&
win
);
control
.
Start
(
indata
,
outdata
);
}
#else
#ifdef FM_TEST
#include "control.h"
...
...
@@ -101,7 +155,7 @@ int main(int argc, char *argv[])
AlipayRequest
req
;
FMTool
::
SetString
(
req
.
BusinessDay
,
8
,
QString
(
"20170908"
));
FMTool
::
SetString
(
req
.
TransType
,
2
,
QString
(
"
1
0"
));
FMTool
::
SetString
(
req
.
TransType
,
2
,
QString
(
"
4
0"
));
FMTool
::
SetString
(
req
.
Reserved1
,
64
,
QString
(
"1443"
));
FMTool
::
SetString
(
req
.
StoreNo
,
20
,
QString
(
"17607"
));
FMTool
::
SetString
(
req
.
DeviceNo
,
6
,
QString
(
"1"
));
...
...
@@ -153,4 +207,6 @@ int main(int argc, char *argv[])
return
a
.
exec
();
}
#endif
#endif //! FM_TEST
#endif //! #ifdef SBKDLL
sbkpay/requestmodel.h
View file @
ffcf864b
#ifndef REQUESTMODEL
#
ifndef
REQUESTMODEL
#define REQUESTMODEL
typedef
enum
...
...
sbkpay/sbkpay.pro
View file @
ffcf864b
...
...
@@ -12,7 +12,6 @@ TARGET = sbkpay
include
(
"./QsLog/QsLog.pri"
)
DEFINES
+=
FM_TEST
CONFIG
+=
C
++
11
SBKDLL
...
...
@@ -21,7 +20,8 @@ CONFIG += C++11 SBKDLL
include
(
$$
PWD
/
qtwinmigrate
/
src
/
qtwinmigrate
.
pri
)
SBKDLL
{
TEMPLATE
=
lib
CONFIG
+=
dll
DEFINES
+=
SBKDLL
CONFIG
+=
dll
}
else
{
TEMPLATE
=
app
...
...
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