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
8debc885
Commit
8debc885
authored
Jun 15, 2018
by
xiaojing.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉测试宏
parent
6c090f86
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
125 deletions
+13
-125
fmvip/fmp_vip_settings.cpp
+1
-20
fmvip/task/fmtask.cpp
+1
-8
fmvip/task/tasklogin.cpp
+0
-3
fmvip/windows/fmmsgwnd.cpp
+8
-8
fmvip/windows/fmviplogin.cpp
+1
-52
fmvip/windows/fmviplogin.h
+0
-3
fmvip/windows/fmviporder.cpp
+0
-7
fmvip/windows/fmviprefund.cpp
+2
-19
fmvip/windows/fmviprefund.h
+0
-5
No files found.
fmvip/fmp_vip_settings.cpp
View file @
8debc885
...
@@ -2,14 +2,6 @@
...
@@ -2,14 +2,6 @@
#include <fmp_settings_i.h>
#include <fmp_settings_i.h>
#include <QDebug>
#include <QDebug>
#ifdef UNIT_TEST
#include <Qsettings>
#include <QApplication>
#endif
FMPVipSettings
::
FMPVipSettings
(
QObject
*
parent
)
:
QObject
(
parent
)
FMPVipSettings
::
FMPVipSettings
(
QObject
*
parent
)
:
QObject
(
parent
)
{
{
}
}
...
@@ -21,22 +13,11 @@ FMPVipSettings *FMPVipSettings::instance()
...
@@ -21,22 +13,11 @@ FMPVipSettings *FMPVipSettings::instance()
}
}
#ifdef UNIT_TEST
QString
FMPVipSettings
::
getServerUrl
()
{
QSettings
*
_setting
=
new
QSettings
(
qApp
->
applicationDirPath
()
+
"/"
+
"FreemudPOS.ini"
,
QSettings
::
IniFormat
);
QString
serverUrl
=
_setting
->
value
(
FMP_INIKEY_VIPSERVER
,
"Server"
).
toString
();
return
serverUrl
;
}
#else
QString
FMPVipSettings
::
getServerUrl
()
QString
FMPVipSettings
::
getServerUrl
()
{
{
return
_GetValue
(
FMP_INIKEY_VIPSERVER
).
toString
();
return
_GetValue
(
FMP_INIKEY_VIPSERVER
).
toString
();
}
}
#endif
void
FMPVipSettings
::
init
(
FMPSettingsInterface
*
settings
)
void
FMPVipSettings
::
init
(
FMPSettingsInterface
*
settings
)
{
{
...
...
fmvip/task/fmtask.cpp
View file @
8debc885
...
@@ -95,15 +95,8 @@ void FMTask::showWindow()
...
@@ -95,15 +95,8 @@ void FMTask::showWindow()
if
(
_window
!=
nullptr
)
{
if
(
_window
!=
nullptr
)
{
_window
->
initWnd
(
this
->
session
());
_window
->
initWnd
(
this
->
session
());
int
ret
;
int
ret
;
#ifdef UNIT_TEST
if
(
_FM_Type
==
FM_Login
||
_FM_Type
==
FM_Pay
||
_FM_Type
==
FM_Refund
)
ret
=
1
;
else
ret
=
_window
->
exec
();
#else
ret
=
_window
->
exec
();
ret
=
_window
->
exec
();
#endif
if
(
ret
!=
1
)
{
if
(
ret
!=
1
)
{
setError
(
FM_API_WINDOWCLOSE
);
setError
(
FM_API_WINDOWCLOSE
);
}
}
...
...
fmvip/task/tasklogin.cpp
View file @
8debc885
...
@@ -83,9 +83,6 @@ void TaskLogin::onLogin()
...
@@ -83,9 +83,6 @@ void TaskLogin::onLogin()
bool
canPay
=
(
getServerJsonValue
(
PosProps
.
CanPay
).
toInt
()
==
1
);
bool
canPay
=
(
getServerJsonValue
(
PosProps
.
CanPay
).
toInt
()
==
1
);
#ifdef UNIT_TEST
canPay
=
true
;
#endif
if
(
!
canPay
)
{
if
(
!
canPay
)
{
if
(
getPosJsonValue
(
PosProps
.
Fm_cmd
).
toInt
()
!=
FM_Pay
)
{
if
(
getPosJsonValue
(
PosProps
.
Fm_cmd
).
toInt
()
!=
FM_Pay
)
{
FMMsgWnd
::
LoginSuccess
(
account
,
name
,
birthday
,
_window
);
FMMsgWnd
::
LoginSuccess
(
account
,
name
,
birthday
,
_window
);
...
...
fmvip/windows/fmmsgwnd.cpp
View file @
8debc885
...
@@ -73,45 +73,45 @@ int FMMsgWnd::_exec(InfoType type, const QString &info)
...
@@ -73,45 +73,45 @@ int FMMsgWnd::_exec(InfoType type, const QString &info)
void
FMMsgWnd
::
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
FailureWnd
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
#ifndef UNIT_TEST
FMMsgWnd
window
(
parent
);
FMMsgWnd
window
(
parent
);
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
_exec
(
FMMsgWnd
::
T_Failure
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Failure
,
info
);
#endif
}
}
void
FMMsgWnd
::
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
WarningWnd
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
#ifndef UNIT_TEST
FMMsgWnd
window
(
parent
);
FMMsgWnd
window
(
parent
);
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
_exec
(
FMMsgWnd
::
T_Warning
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Warning
,
info
);
#endif
}
}
void
FMMsgWnd
::
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
)
void
FMMsgWnd
::
SuccessWnd
(
const
QString
&
info
,
QDialog
*
parent
)
{
{
#ifndef UNIT_TEST
FMMsgWnd
window
(
parent
);
FMMsgWnd
window
(
parent
);
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
window
.
_exec
(
FMMsgWnd
::
T_Success
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_Success
,
info
);
#endif
}
}
void
FMMsgWnd
::
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
)
void
FMMsgWnd
::
LoginSuccess
(
const
QString
&
account
,
const
QString
&
name
,
const
QString
&
birthday
,
QDialog
*
parent
)
{
{
#ifndef UNIT_TEST
FMMsgWnd
window
(
parent
);
FMMsgWnd
window
(
parent
);
if
(
parent
!=
nullptr
)
{
if
(
parent
!=
nullptr
)
{
window
.
setGeometry
(
parent
->
geometry
());
window
.
setGeometry
(
parent
->
geometry
());
}
}
QString
info
=
QString
::
fromLocal8Bit
(
"账号:%1
\n
姓名:%2
\n
生日:%3"
).
arg
(
account
).
arg
(
name
).
arg
(
birthday
);
QString
info
=
QString
::
fromLocal8Bit
(
"账号:%1
\n
姓名:%2
\n
生日:%3"
).
arg
(
account
).
arg
(
name
).
arg
(
birthday
);
window
.
_exec
(
FMMsgWnd
::
T_LoginSuccess
,
info
);
window
.
_exec
(
FMMsgWnd
::
T_LoginSuccess
,
info
);
#endif
}
}
int
FMMsgWnd
::
Question
(
const
QString
&
info
,
QDialog
*
parent
)
int
FMMsgWnd
::
Question
(
const
QString
&
info
,
QDialog
*
parent
)
...
...
fmvip/windows/fmviplogin.cpp
View file @
8debc885
...
@@ -7,17 +7,7 @@
...
@@ -7,17 +7,7 @@
#include "fmnumpad.h"
#include "fmnumpad.h"
#ifdef UNIT_TEST
#include <QTest>
#include <QEventLoop>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QNetworkReply>
#include <QNetworkRequest>
#endif
FMVipLogin
::
FMVipLogin
(
QDialog
*
parent
)
:
FMVipLogin
::
FMVipLogin
(
QDialog
*
parent
)
:
FMVipWnd
(
parent
),
FMVipWnd
(
parent
),
...
@@ -56,12 +46,6 @@ bool FMVipLogin::initWnd(Session *session)
...
@@ -56,12 +46,6 @@ bool FMVipLogin::initWnd(Session *session)
ui
->
operator_label
->
setText
(
session
->
data
(
PosProps
.
OperatorId
).
toString
());
ui
->
operator_label
->
setText
(
session
->
data
(
PosProps
.
OperatorId
).
toString
());
ui
->
bd_label
->
setText
(
session
->
data
(
PosProps
.
BussinessDate
).
toString
());
ui
->
bd_label
->
setText
(
session
->
data
(
PosProps
.
BussinessDate
).
toString
());
ui
->
login_edit
->
setPlaceholderText
(
placeText
);
ui
->
login_edit
->
setPlaceholderText
(
placeText
);
#ifdef UNIT_TEST
QString
paycode
=
GetPayCode
();
QTest
::
keyClicks
(
ui
->
login_edit
,
paycode
);
QTest
::
mouseClick
(
ui
->
login_btn
,
Qt
::
LeftButton
);
#endif
return
true
;
return
true
;
}
}
QString
FMVipLogin
::
getVersionInfo
()
QString
FMVipLogin
::
getVersionInfo
()
...
@@ -106,39 +90,4 @@ void FMVipLogin::on_login_key_clicked()
...
@@ -106,39 +90,4 @@ void FMVipLogin::on_login_key_clicked()
_numpad
->
exec
();
_numpad
->
exec
();
}
}
}
}
#ifdef UNIT_TEST
QString
FMVipLogin
::
GetPayCode
()
{
QNetworkAccessManager
networkAcessManager
;
QNetworkRequest
_req
;
QString
codeFormat
;
QString
url
=
"http://membertest1.sandload.cn:8748/wechat/card/getPayCode?partnerId=7f657d18-9f3f-41fd-b97f-1a71f7d1ffa0&openId=o4_93jjwHWPke-U1IT2IkUO5hbII&mobile=15821343897&URL=http%3A%2F%2Fjtest.sandload.cn"
;
_req
.
setUrl
(
url
);
auto
reply
=
networkAcessManager
.
get
(
_req
);
QEventLoop
loop
;
connect
(
reply
,
SIGNAL
(
finished
()),
&
loop
,
SLOT
(
quit
()));
loop
.
exec
();
QByteArray
rspData
=
reply
->
readAll
();
qDebug
()
<<
"reply get "
<<
rspData
;
QJsonParseError
jsonErr
;
QJsonDocument
rspJson
=
QJsonDocument
::
fromJson
(
rspData
,
&
jsonErr
);
//QJsonObject serverRspJsonObj;
if
(
jsonErr
.
error
==
QJsonParseError
::
NoError
)
{
//serverRspJsonObj = rspJson.object();
if
(
rspJson
.
isObject
())
{
QVariantMap
result
=
rspJson
.
toVariant
().
toMap
();
QVariantMap
nestedMap
=
result
[
"data"
].
toMap
();
codeFormat
=
nestedMap
[
"codeFormat"
].
toString
();
codeFormat
.
remove
(
QRegExp
(
"
\\
s"
));
qDebug
()
<<
"length:"
<<
codeFormat
;
}
}
return
codeFormat
;
}
#endif
fmvip/windows/fmviplogin.h
View file @
8debc885
...
@@ -34,8 +34,5 @@ private:
...
@@ -34,8 +34,5 @@ private:
Ui
::
FMVipLogin
*
ui
;
Ui
::
FMVipLogin
*
ui
;
FMNumPad
*
_numpad
;
FMNumPad
*
_numpad
;
#ifdef UNIT_TEST
QString
GetPayCode
();
//测试的时候用于获取付款码
#endif
};
};
#endif // FMVIPLOGIN_H
#endif // FMVIPLOGIN_H
fmvip/windows/fmviporder.cpp
View file @
8debc885
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
#include <QScrollBar>
#include <QScrollBar>
#include <QItemSelectionModel>
#include <QItemSelectionModel>
#ifdef UNIT_TEST
#include <QTest>
#endif
FMVipOrder
::
FMVipOrder
(
QDialog
*
parent
)
:
FMVipOrder
::
FMVipOrder
(
QDialog
*
parent
)
:
FMVipWnd
(
parent
),
FMVipWnd
(
parent
),
...
@@ -89,9 +85,6 @@ bool FMVipOrder::initWnd(Session *session)
...
@@ -89,9 +85,6 @@ bool FMVipOrder::initWnd(Session *session)
ui
->
score_edit
->
setValidator
(
new
QRegExpValidator
(
regexp
));
ui
->
score_edit
->
setValidator
(
new
QRegExpValidator
(
regexp
));
setWillPayText
();
setWillPayText
();
#ifdef UNIT_TEST
QTest
::
mouseClick
(
ui
->
pay_btn
,
Qt
::
LeftButton
);
#endif
return
true
;
return
true
;
}
}
...
...
fmvip/windows/fmviprefund.cpp
View file @
8debc885
...
@@ -9,9 +9,7 @@
...
@@ -9,9 +9,7 @@
#include "items/order.h"
#include "items/order.h"
#include "items/pay.h"
#include "items/pay.h"
#include "items/storeinfo.h"
#include "items/storeinfo.h"
#ifdef UNIT_TEST
#include <QTest>
#endif
FMVipRefund
::
FMVipRefund
(
QDialog
*
parent
)
:
FMVipRefund
::
FMVipRefund
(
QDialog
*
parent
)
:
FMVipWnd
(
parent
),
FMVipWnd
(
parent
),
...
@@ -108,9 +106,7 @@ bool FMVipRefund::initWnd(Session *session)
...
@@ -108,9 +106,7 @@ bool FMVipRefund::initWnd(Session *session)
col
=
0
;
col
=
0
;
}
}
}
}
#ifdef UNIT_TEST
UiAutoTest
();
#endif
return
true
;
return
true
;
}
}
...
@@ -153,16 +149,3 @@ void FMVipRefund::setIsRefundSuccess(bool isRefundSuccess)
...
@@ -153,16 +149,3 @@ void FMVipRefund::setIsRefundSuccess(bool isRefundSuccess)
}
}
//测试程序自动退款时退最近的一笔
#ifdef UNIT_TEST
void
FMVipRefund
::
UiAutoTest
()
{
int
rows
=
ui
->
tableWidget_pays
->
rowCount
();
ui
->
tableWidget_pays
->
setCurrentCell
(
rows
-
1
,
QItemSelectionModel
::
Select
);
QWidget
*
cell
=
ui
->
tableWidget_pays
->
cellWidget
(
rows
-
1
,
3
);
QPushButton
*
button
=
dynamic_cast
<
QPushButton
*>
(
cell
);
QTest
::
mouseClick
(
button
,
Qt
::
LeftButton
);
QTest
::
mouseClick
(
ui
->
close_btn
,
Qt
::
LeftButton
);
}
#endif
fmvip/windows/fmviprefund.h
View file @
8debc885
...
@@ -28,11 +28,6 @@ public:
...
@@ -28,11 +28,6 @@ public:
bool
isRefundSuccess
()
const
;
bool
isRefundSuccess
()
const
;
void
setIsRefundSuccess
(
bool
isRefundSuccess
);
void
setIsRefundSuccess
(
bool
isRefundSuccess
);
#ifdef UNIT_TEST
void
UiAutoTest
();
#endif
signals
:
signals
:
void
refundPay
(
int
);
void
refundPay
(
int
);
void
refundOrder
(
int
);
void
refundOrder
(
int
);
...
...
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