Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_epay
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
fmp_epay
Commits
67cc7070
Commit
67cc7070
authored
Jun 30, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加异步发送socket函数
parent
e7673af9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
fmp_epay_p.cpp
+21
-0
fmp_epay_p.h
+2
-0
No files found.
fmp_epay_p.cpp
View file @
67cc7070
...
@@ -94,6 +94,7 @@ void FMPePayPrivate::Init()
...
@@ -94,6 +94,7 @@ void FMPePayPrivate::Init()
Q_Q
(
FMPePay
);
Q_Q
(
FMPePay
);
q
->
_inited
=
true
;
q
->
_inited
=
true
;
_wakeupByMonitor
=
false
;
_wakeupByMonitor
=
false
;
_preOrderDone
=
true
;
clearorder
();
clearorder
();
if
(
_network
==
nullptr
)
if
(
_network
==
nullptr
)
...
@@ -586,6 +587,9 @@ void FMPePayPrivate::ParsePayJson(const QByteArray &json)
...
@@ -586,6 +587,9 @@ void FMPePayPrivate::ParsePayJson(const QByteArray &json)
QJsonDocument
jsonDoc
=
QJsonDocument
::
fromJson
(
json
,
&
jsonError
);
QJsonDocument
jsonDoc
=
QJsonDocument
::
fromJson
(
json
,
&
jsonError
);
if
(
jsonError
.
error
==
QJsonParseError
::
NoError
)
if
(
jsonError
.
error
==
QJsonParseError
::
NoError
)
{
{
if
(
!
_preOrderDone
){
}
QJsonObject
jsonObject
=
jsonDoc
.
object
();
QJsonObject
jsonObject
=
jsonDoc
.
object
();
QJsonArray
_array
=
jsonObject
[
"transactions"
].
toArray
();
QJsonArray
_array
=
jsonObject
[
"transactions"
].
toArray
();
QJsonObject
transactions
=
_array
.
at
(
0
).
toObject
();
QJsonObject
transactions
=
_array
.
at
(
0
).
toObject
();
...
@@ -598,6 +602,7 @@ void FMPePayPrivate::ParsePayJson(const QByteArray &json)
...
@@ -598,6 +602,7 @@ void FMPePayPrivate::ParsePayJson(const QByteArray &json)
if
(
_payDialog
!=
NULL
)
if
(
_payDialog
!=
NULL
)
_payDialog
->
setEditNum
(
order_amount
);
_payDialog
->
setEditNum
(
order_amount
);
_wakeupByMonitor
=
true
;
_wakeupByMonitor
=
true
;
_preOrderDone
=
false
;
}
else
}
else
{
{
...
@@ -632,3 +637,19 @@ void FMPePayPrivate::SetWakeupFlag(bool status)
...
@@ -632,3 +637,19 @@ void FMPePayPrivate::SetWakeupFlag(bool status)
{
{
_wakeupByMonitor
=
status
;
_wakeupByMonitor
=
status
;
}
}
void
FMPePayPrivate
::
SendToMonitor
(
const
QByteArray
&
data
)
{
QTcpSocket
client
;
// char data[]="hello qt!";
client
.
connectToHost
(
QHostAddress
(
"127.0.0.1"
),
23771
);
if
(
client
.
waitForConnected
()){
client
->
write
(
data
);
if
(
!
client
.
waitForBytesWritten
())
FMP_INFO
()
<<
"socket 发送失败!"
;
}
else
{
FMP_INFO
()
<<
"socket 连接失败!"
;
}
client
.
close
();
}
fmp_epay_p.h
View file @
67cc7070
...
@@ -37,6 +37,7 @@ public:
...
@@ -37,6 +37,7 @@ public:
void
SetWakeupFlag
(
bool
status
);
void
SetWakeupFlag
(
bool
status
);
void
ClosePayWindow
(
int
type
=
1
);
void
ClosePayWindow
(
int
type
=
1
);
void
SendToMonitor
(
const
QByteArray
&
data
);
QSqlTableModel
*
model
()
const
;
QSqlTableModel
*
model
()
const
;
...
@@ -77,6 +78,7 @@ public:
...
@@ -77,6 +78,7 @@ public:
private
:
private
:
bool
_wakeupByMonitor
;
bool
_wakeupByMonitor
;
bool
_preOrderDone
;
//前一个订单是否已经处理结束
QJsonObject
_current_json
;
QJsonObject
_current_json
;
QByteArray
_pay_json
;
QByteArray
_pay_json
;
...
...
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