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
401c325c
Commit
401c325c
authored
Aug 10, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复重复弹窗
parent
3c7f304f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
sbkpay/control.cpp
+27
-4
sbkpay/control.h
+4
-1
No files found.
sbkpay/control.cpp
View file @
401c325c
...
...
@@ -17,13 +17,17 @@ typedef int (* GetRSACret)(int ,const char *,const char *);
Control
::
Control
(
QObject
*
parent
)
:
QObject
(
parent
)
{
InitModel
();
connect
(
&
_widget
,
&
HostWidget
::
RequestWithType
,
this
,
&
Control
::
RequestWithType
);
}
void
Control
::
Start
(
const
char
*
indata
,
char
*
outdata
)
{
QEventLoop
loop
;
if
(
_widget
==
NULL
)
_widget
=
new
HostWidget
();
connect
(
_widget
,
&
HostWidget
::
RequestWithType
,
this
,
&
Control
::
RequestWithType
);
QLOG_INFO
()
<<
"get data from pos : "
<<
indata
;
if
(
strlen
(
indata
)
>
sizeof
(
struct
AlipayRequest
))
...
...
@@ -32,20 +36,34 @@ void Control::Start(const char *indata, char *outdata)
memcpy
(
outdata
,
&
_response
,
sizeof
(
struct
AlipayRequest
));
QLOG_ERROR
()
<<
"send error msg to pos : "
<<
outdata
;
_lock
.
lock
();
delete
_widget
;
_widget
=
NULL
;
_lock
.
lock
();
return
;
}
memcpy
(
&
_request
,
indata
,
strlen
(
indata
));
_widget
.
ShowWithRequest
(
_request
);
_widget
->
ShowWithRequest
(
_request
);
connect
(
&
_widget
,
&
HostWidget
::
ExitWithMSG
,
this
,
[
this
,
&
loop
]
(
QString
message
)
connect
(
_widget
,
&
HostWidget
::
ExitWithMSG
,
this
,
[
this
,
&
loop
]
(
QString
message
)
{
QLOG_INFO
()
<<
"quit with : "
<<
message
;
loop
.
exit
();
});
loop
.
exec
();
_lock
.
lock
();
delete
_widget
;
_widget
=
NULL
;
_lock
.
unlock
();
}
void
Control
::
GetErrorResponse
(
QString
message
,
AlipayResponse
&
response
)
...
...
@@ -132,7 +150,12 @@ bool Control::GetRSA()
else
QLOG_ERROR
()
<<
"load dll failed"
;
_widget
.
ShowWiteMGS
(
sign
,
rlt
);
_lock
.
lock
();
if
(
_widget
!=
NULL
)
_widget
->
ShowWiteMGS
(
sign
,
rlt
);
_lock
.
unlock
();;
return
rlt
;
}
...
...
sbkpay/control.h
View file @
401c325c
...
...
@@ -6,6 +6,7 @@
#include <QObject>
#include <QApplication>
#include <QLibrary>
#include <QMutex>
class
Control
:
public
QObject
{
...
...
@@ -38,7 +39,9 @@ public slots:
private
:
struct
AlipayRequest
_request
;
struct
AlipayResponse
_response
;
HostWidget
_widget
;
HostWidget
*
_widget
;
//确保exe结束后不会重新弹窗
QMutex
_lock
;
};
#endif // CONTROL_H
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