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
6aa8b2c2
Commit
6aa8b2c2
authored
Apr 17, 2017
by
Carwyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.同步基础接口InitService/UninitService
parent
96d23ec1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
56 deletions
+57
-56
fmp_epay.cpp
+7
-8
fmp_epay.h
+7
-4
fmp_epay_i.h
+16
-3
fmp_epay_p.cpp
+21
-30
fmp_epay_p.h
+3
-8
fmp_epayview_dialog.cpp
+1
-1
fmp_pe_handlers.cpp
+2
-2
No files found.
fmp_epay.cpp
View file @
6aa8b2c2
...
...
@@ -20,23 +20,22 @@ FMPePay::FMPePay(ctkPluginContext *context)
_ste_handler
(
new
FMPStartEventHandler
(
_ctx
,
this
)),
d_ptr
(
new
FMPePayPrivate
(
this
))
{
}
int
FMPePay
::
Stop
Service
()
void
FMPePay
::
Init
Service
()
{
if
(
!
_inited
)
return
FMP_SUCCESS
;
if
(
_inited
)
return
;
Q_D
(
FMPePay
);
return
d
->
StopService
();
d
->
Init
();
}
int
FMPePay
::
Pay
()
void
FMPePay
::
UninitService
()
{
if
(
_inited
)
return
FMP_SUCCESS
;
if
(
_inited
)
{
Q_D
(
FMPePay
);
return
d
->
Pay
();
d
->
Uninit
();
}
}
void
FMPePay
::
SetBasicInfo
(
QVariantHash
hash
)
...
...
fmp_epay.h
View file @
6aa8b2c2
...
...
@@ -9,7 +9,7 @@
class
FMPePayPrivate
;
class
FMPStartEventHandler
;
class
FMPePay
:
public
QObject
,
public
FMPePayInterface
class
FMPePay
:
public
FMPePayInterface
{
Q_OBJECT
Q_INTERFACES
(
FMPBaseInterface
)
...
...
@@ -19,10 +19,13 @@ class FMPePay : public QObject, public FMPePayInterface
public
:
FMPePay
(
ctkPluginContext
*
context
);
int
StopService
();
int
Pay
();
void
SetBasicInfo
(
QVariantHash
hash
);
protected
slots
:
void
InitService
();
void
UninitService
();
private
:
bool
_inited
;
bool
_needanimation
;
...
...
fmp_epay_i.h
View file @
6aa8b2c2
...
...
@@ -7,11 +7,24 @@
* 业务插件接口,必须继承自 FMPluginInterface
* @brief The FMPePayInterface class
*/
class
FMPePayInterface
:
public
FMPluginInterface
class
FMPePayInterface
:
public
QObject
,
public
FMPluginInterface
{
Q_OBJECT
public
:
explicit
FMPePayInterface
(
ctkPluginContext
*
ctx
)
:
FMPluginInterface
(
ctx
)
{}
virtual
int
Pay
()
=
0
;
explicit
FMPePayInterface
(
ctkPluginContext
*
ctx
)
:
FMPluginInterface
(
ctx
)
{
connect
(
this
,
&
FMPePayInterface
::
TriggerInit
,
this
,
&
FMPePayInterface
::
InitService
);
connect
(
this
,
&
FMPePayInterface
::
TriggerUninit
,
this
,
&
FMPePayInterface
::
UninitService
);
}
protected
slots
:
void
InitService
()
=
0
;
void
UninitService
()
=
0
;
signals
:
void
TriggerInit
();
void
TriggerUninit
();
// /**
// * @brief ShowPayDialog
// * 呈现支付主界面
...
...
fmp_epay_p.cpp
View file @
6aa8b2c2
...
...
@@ -60,7 +60,7 @@ FMPePayPrivate::~FMPePayPrivate()
}
}
int
FMPePayPrivate
::
StopService
()
void
FMPePayPrivate
::
Uninit
()
{
Q_Q
(
FMPePay
);
q
->
_inited
=
false
;
...
...
@@ -84,40 +84,12 @@ int FMPePayPrivate::StopService()
delete
_db
;
_db
=
nullptr
;
}
return
FMP_SUCCESS
;
}
int
FMPePayPrivate
::
Pay
()
void
FMPePayPrivate
::
Init
()
{
Q_Q
(
FMPePay
);
q
->
_inited
=
true
;
connect
(
this
,
SIGNAL
(
showPayWnd
()),
this
,
SLOT
(
onShowPayWnd
()));
emit
showPayWnd
();
return
FMP_SUCCESS
;
}
void
FMPePayPrivate
::
clearorder
()
{
Q_Q
(
FMPePay
);
QtConcurrent
::
run
(
[
q
,
this
]()
{
FMPDataBase
db
(
q
->
_databasename
,
QString
(
"fmp_pay_clean"
))
;
QDateTime
date
=
QDateTime
::
currentDateTime
();
QDateTime
tmpdate
=
date
.
addDays
(
-
(
q
->
_ordershelflife
));
QString
deletedate
=
tmpdate
.
toString
(
"yyyy-MM-dd"
);
FMP_INFO
()
<<
"deletedate"
<<
deletedate
;
db
.
dlt
(
q
->
_table
,
QString
(
QString
(
SQL_KEY_BUSSINEDATE
)
+
"<datetime('%1')"
).
arg
(
deletedate
));
});
}
void
FMPePayPrivate
::
onShowPayWnd
()
{
Q_Q
(
FMPePay
);
clearorder
();
...
...
@@ -179,6 +151,25 @@ void FMPePayPrivate::onShowPayWnd()
_payDialog
->
show
();
}
void
FMPePayPrivate
::
clearorder
()
{
Q_Q
(
FMPePay
);
QtConcurrent
::
run
(
[
q
,
this
]()
{
FMPDataBase
db
(
q
->
_databasename
,
QString
(
"fmp_pay_clean"
))
;
QDateTime
date
=
QDateTime
::
currentDateTime
();
QDateTime
tmpdate
=
date
.
addDays
(
-
(
q
->
_ordershelflife
));
QString
deletedate
=
tmpdate
.
toString
(
"yyyy-MM-dd"
);
FMP_INFO
()
<<
"deletedate"
<<
deletedate
;
db
.
dlt
(
q
->
_table
,
QString
(
QString
(
SQL_KEY_BUSSINEDATE
)
+
"<datetime('%1')"
).
arg
(
deletedate
));
});
}
QSqlTableModel
*
FMPePayPrivate
::
model
()
const
{
return
_model
;
...
...
fmp_epay_p.h
View file @
6aa8b2c2
...
...
@@ -21,9 +21,9 @@ public:
explicit
FMPePayPrivate
(
FMPePay
*
parent
);
~
FMPePayPrivate
();
int
StopService
();
void
Uninit
();
int
Pay
();
void
Init
();
void
ControlPayJson
(
QString
sum
,
QString
code
);
...
...
@@ -52,16 +52,11 @@ private:
void
clearorder
();
signals
:
void
showPayWnd
();
void
error
(
QString
errormsg
);
void
finished
(
QJsonObject
json
);
public
slots
:
void
onShowPayWnd
();
protected
slots
:
void
witedata
();
public
:
...
...
fmp_epayview_dialog.cpp
View file @
6aa8b2c2
...
...
@@ -579,7 +579,7 @@ void FMPPayDialog::on_btn_clear_clicked()
void
FMPPayDialog
::
on_btn_close_clicked
()
{
this
->
hide
();
_control
->
StopService
();
_control
->
Uninit
();
}
void
FMPPayDialog
::
onLineeditCodeGetFocus
()
...
...
fmp_pe_handlers.cpp
View file @
6aa8b2c2
...
...
@@ -18,7 +18,7 @@ void FMPStartEventHandler::handleEvent(const ctkEvent &event)
if
(
_epay
)
{
if
(
event
.
getProperty
(
FMP_PROPKEY_AGREED
).
toBool
())
{
// _epay->UpgradeOldPlugins(event.getProperty(FMP_PROPKEY_PID_LIST).toList());
_epay
->
Pay
();
_epay
->
TriggerInit
();
}
else
{
FMP_WARN
()
<<
"Refused start request"
<<
event
.
getTopic
();
...
...
@@ -45,7 +45,7 @@ void FMPNetWorkEventHandler::handleEvent(const ctkEvent &event)
{
if
(
_epay
)
{
if
(
event
.
getProperty
(
FMP_PROPKEY_AGREED
).
toBool
())
{
_epay
->
Pay
();
_epay
->
TriggerInit
();
}
else
{
FMP_WARN
()
<<
"Refused start request"
<<
event
.
getTopic
();
...
...
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