Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_vip
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_vip
Commits
f5e69428
Commit
f5e69428
authored
Jul 04, 2017
by
Carwyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正第二次请求不弹出窗口、socket 中途关闭崩溃问题
parent
2eeb1cce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
fmp_vip_p.cpp
+2
-2
fmp_vip_server.cpp
+9
-11
fmvipdispatcher.cpp
+5
-3
No files found.
fmp_vip_p.cpp
View file @
f5e69428
...
@@ -21,7 +21,7 @@ int FMPVipPrivate::Init()
...
@@ -21,7 +21,7 @@ int FMPVipPrivate::Init()
Q_Q
(
FMPVip
);
Q_Q
(
FMPVip
);
FMPHomeInterface
*
home
=
q
->
GetService
<
FMPHomeInterface
>
(
q
->
_ctx
);
FMPHomeInterface
*
home
=
q
->
GetService
<
FMPHomeInterface
>
(
q
->
_ctx
);
if
(
q
->
_inited
)
{
if
(
q
->
_inited
)
{
home
->
notification
(
QString
::
fromLocal8Bit
(
"[非码
会员
]已在运行!"
));
home
->
notification
(
QString
::
fromLocal8Bit
(
"[非码
POS插件
]已在运行!"
));
}
else
{
}
else
{
_settings
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
_settings
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
FMPVipSettings
::
instance
()
->
init
(
_settings
);
FMPVipSettings
::
instance
()
->
init
(
_settings
);
...
@@ -32,7 +32,7 @@ int FMPVipPrivate::Init()
...
@@ -32,7 +32,7 @@ int FMPVipPrivate::Init()
q
->
_inited
=
true
;
q
->
_inited
=
true
;
home
->
notification
(
QString
::
fromLocal8Bit
(
"[非码
会员
]启动成功!"
));
home
->
notification
(
QString
::
fromLocal8Bit
(
"[非码
POS插件
]启动成功!"
));
FMP_INFO
()
<<
"Vip start"
;
FMP_INFO
()
<<
"Vip start"
;
}
}
...
...
fmp_vip_server.cpp
View file @
f5e69428
...
@@ -28,8 +28,8 @@ void FMPVipServer::Listen(quint16 port)
...
@@ -28,8 +28,8 @@ void FMPVipServer::Listen(quint16 port)
void
FMPVipServer
::
Write
(
const
QByteArray
&
data
)
void
FMPVipServer
::
Write
(
const
QByteArray
&
data
)
{
{
if
(
socket
->
write
(
data
)
==
-
1
)
{
if
(
!
socket
||
socket
->
write
(
data
)
==
-
1
)
{
FMP_ERROR
()
<<
"Write error: "
<<
socket
->
error
()
<<
socket
->
errorString
(
);
FMP_ERROR
()
<<
"Write error: "
<<
(
socket
?
socket
->
errorString
()
:
"connection closed."
);
}
}
}
}
...
@@ -49,23 +49,21 @@ void FMPVipServer::onNewConnection()
...
@@ -49,23 +49,21 @@ void FMPVipServer::onNewConnection()
void
FMPVipServer
::
onDisconnected
()
void
FMPVipServer
::
onDisconnected
()
{
{
FMP_DEBUG
()
<<
"Socket disconnected."
;
FMP_DEBUG
()
<<
"Socket disconnected."
;
socket
->
deleteLater
();
socket
->
close
();
}
}
void
FMPVipServer
::
onReadyRead
()
void
FMPVipServer
::
onReadyRead
()
{
{
QByteArray
recvData
=
socket
->
readAll
();
QByteArray
recvData
=
socket
->
readAll
();
// FMSOCKEHEADER header = {0};
// memcpy(&header, recvData.data(), sizeof(FMSOCKEHEADER));
// if(header.flag != FMSOCKFLAG) {
// FMP_WARN() << "Incompatible protocol.";i j
// return;
// }
QByteArray
rspData
;
QByteArray
rspData
;
dispatcher
->
doTask
(
recvData
/*.mid(sizeof(FMSOCKEHEADER))*/
,
rspData
);
dispatcher
->
doTask
(
recvData
,
rspData
);
rspData
;
rspData
;
Write
(
rspData
);
Write
(
rspData
);
socket
->
waitForDisconnected
();
socket
->
deleteLater
();
socket
=
nullptr
;
}
}
fmvipdispatcher.cpp
View file @
f5e69428
...
@@ -56,6 +56,7 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
...
@@ -56,6 +56,7 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
epay
->
DockPayRequest
(
reqData
);
epay
->
DockPayRequest
(
reqData
);
epay
->
StartService
();
epay
->
StartService
();
rspData
=
epay
->
DockPayRespond
();
rspData
=
epay
->
DockPayRespond
();
epay
->
StopService
();
}
}
else
{
else
{
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
支付服务不可用
\"
}"
).
toUtf8
();
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
支付服务不可用
\"
}"
).
toUtf8
();
...
@@ -66,9 +67,10 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
...
@@ -66,9 +67,10 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
if
(
_ctx
)
{
if
(
_ctx
)
{
ctkServiceReference
ref
=
_ctx
->
getServiceReference
<
FMPePayInterface
>
();
ctkServiceReference
ref
=
_ctx
->
getServiceReference
<
FMPePayInterface
>
();
FMPePayInterface
*
epay
=
_ctx
->
getService
<
FMPePayInterface
>
(
ref
);
FMPePayInterface
*
epay
=
_ctx
->
getService
<
FMPePayInterface
>
(
ref
);
// epay->DockRefundRequest(reqData);
epay
->
DockRefundRequest
(
reqData
);
// epay->StartService();
epay
->
StartService
();
// rspData = epay->DockRefundRespond();
rspData
=
epay
->
DockRefundRespond
();
epay
->
StopService
();
}
}
else
{
else
{
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
退款服务不可用
\"
}"
).
toUtf8
();
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
退款服务不可用
\"
}"
).
toUtf8
();
...
...
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