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
7448cbf8
Commit
7448cbf8
authored
Nov 08, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 增加卡券核销插件支持。
parent
064b676c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
10 deletions
+27
-10
fmvip/fmp_vip_settings.cpp
+5
-0
fmvip/fmp_vip_settings.h
+2
-0
fmvip/fmvipdispatcher.cpp
+15
-7
fmvip/global.h
+3
-2
tests/testplugin/tst_testplugin.cpp
+1
-0
version.h
+1
-1
No files found.
fmvip/fmp_vip_settings.cpp
View file @
7448cbf8
...
@@ -27,6 +27,11 @@ bool FMPVipSettings::getIsNeedSocketHeader()
...
@@ -27,6 +27,11 @@ bool FMPVipSettings::getIsNeedSocketHeader()
return
_GetValue
(
FMP_INIKEY_NEEDSOCKETHEADER
,
false
).
toBool
();
return
_GetValue
(
FMP_INIKEY_NEEDSOCKETHEADER
,
false
).
toBool
();
}
}
int
FMPVipSettings
::
GetPayPartnerId
()
{
return
_GetValue
(
"Home/PartnerId"
,
1371
).
toInt
();
}
QVariant
FMPVipSettings
::
_GetValue
(
const
QString
&
key
,
QVariant
defaultValue
)
QVariant
FMPVipSettings
::
_GetValue
(
const
QString
&
key
,
QVariant
defaultValue
)
{
{
if
(
_settings
)
{
if
(
_settings
)
{
...
...
fmvip/fmp_vip_settings.h
View file @
7448cbf8
...
@@ -17,6 +17,8 @@ public:
...
@@ -17,6 +17,8 @@ public:
QString
getServerUrl
();
QString
getServerUrl
();
bool
getIsNeedSocketHeader
();
bool
getIsNeedSocketHeader
();
int
GetPayPartnerId
();
private
:
private
:
explicit
FMPVipSettings
(
QObject
*
parent
=
0
);
explicit
FMPVipSettings
(
QObject
*
parent
=
0
);
...
...
fmvip/fmvipdispatcher.cpp
View file @
7448cbf8
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
#undef StartService
#undef StartService
#include <fmp_epay_i.h>
#include <fmp_epay_i.h>
#include "fmp_redeem_i.h"
#include "fmp_redeem_i.h"
#include "dbop.h"
#include "items/storeinfo.h"
FMVipDispatcher
::
FMVipDispatcher
(
QObject
*
parent
)
:
FMVipDispatcher
::
FMVipDispatcher
(
QObject
*
parent
)
:
QObject
(
parent
),
QObject
(
parent
),
...
@@ -85,13 +87,19 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
...
@@ -85,13 +87,19 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
if
(
_ctx
){
if
(
_ctx
){
ctkServiceReference
ref
=
_ctx
->
getServiceReference
<
FMPRedeemInterface
>
();
ctkServiceReference
ref
=
_ctx
->
getServiceReference
<
FMPRedeemInterface
>
();
FMPRedeemInterface
*
redeem
=
_ctx
->
getService
<
FMPRedeemInterface
>
(
ref
);
FMPRedeemInterface
*
redeem
=
_ctx
->
getService
<
FMPRedeemInterface
>
(
ref
);
//for test
// jsonObj["store_id"] = "fm99999";
FMItem
::
StoreInfo
storeInfo
;
// jsonObj["pos_id"] = "01";
bool
isOk
=
DBOP
::
GetLastItem
(
&
storeInfo
);
// jsonObj["operator_id"] = "00000002";
if
(
!
isOk
)
{
// jsonObj["partner_id"] = 1371;
rspData
=
QString
::
fromLocal8Bit
(
ErrorMsgJson
).
arg
(
FM_API_ERROR
).
arg
(
QString
::
fromLocal8Bit
(
"未设置门店信息,不能进行支付."
)).
toUtf8
();
QJsonObject
result
=
redeem
->
Redeem
(
jsonObj
);
}
else
{
rspData
=
QJsonDocument
(
result
).
toJson
(
QJsonDocument
::
Compact
);
jsonObj
[
PosProps
.
StoreId
]
=
storeInfo
.
storeId
();
jsonObj
[
PosProps
.
PosId
]
=
storeInfo
.
posId
();
jsonObj
[
PosProps
.
OperatorId
]
=
storeInfo
.
operatorId
();
jsonObj
[
PosProps
.
PartnerId
]
=
FMPVipSettings
::
instance
()
->
GetPayPartnerId
();
QJsonObject
result
=
redeem
->
Redeem
(
jsonObj
);
rspData
=
QJsonDocument
(
result
).
toJson
(
QJsonDocument
::
Compact
);
}
}
}
else
{
else
{
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
卡券服务不可用
\"
}"
).
toUtf8
();
rspData
=
QString
::
fromLocal8Bit
(
"{
\"
msg:
\"
:
\"
卡券服务不可用
\"
}"
).
toUtf8
();
...
...
fmvip/global.h
View file @
7448cbf8
...
@@ -71,7 +71,7 @@ struct PP{
...
@@ -71,7 +71,7 @@ struct PP{
PP
()
PP
()
{
{
AppId
=
"appId"
;
AppId
=
"appId"
;
PartnerId
=
"partner
I
d"
;
PartnerId
=
"partner
_i
d"
;
T
=
"t"
;
T
=
"t"
;
Sign
=
"sign"
;
Sign
=
"sign"
;
StoreId
=
"store_id"
;
StoreId
=
"store_id"
;
...
@@ -278,6 +278,7 @@ const PropsMap::value_type PropsMapPairs[] =
...
@@ -278,6 +278,7 @@ const PropsMap::value_type PropsMapPairs[] =
PropsMap
::
value_type
(
PosProps
.
ConsumeNum
,
"consumeNum"
),
PropsMap
::
value_type
(
PosProps
.
ConsumeNum
,
"consumeNum"
),
PropsMap
::
value_type
(
PosProps
.
Price
,
"price"
),
PropsMap
::
value_type
(
PosProps
.
Price
,
"price"
),
PropsMap
::
value_type
(
PosProps
.
ChargeAmount
,
"payAmount"
),
PropsMap
::
value_type
(
PosProps
.
ChargeAmount
,
"payAmount"
),
PropsMap
::
value_type
(
PosProps
.
PartnerId
,
"partnerId"
),
};
};
static
PropsMap
PosToServerProps
(
PropsMapPairs
,
PropsMapPairs
+
(
sizeof
(
PropsMapPairs
)
/
sizeof
(
PropsMapPairs
[
0
])));
static
PropsMap
PosToServerProps
(
PropsMapPairs
,
PropsMapPairs
+
(
sizeof
(
PropsMapPairs
)
/
sizeof
(
PropsMapPairs
[
0
])));
...
@@ -339,7 +340,7 @@ enum {
...
@@ -339,7 +340,7 @@ enum {
};
};
// 返回错误信息的json
// 返回错误信息的json
#define ErrorMsgJson "{\"status_code\":%1,\"msg\":\"%2\"
,\"prompt\":0
}"
#define ErrorMsgJson "{\"status_code\":%1,\"msg\":\"%2\"}"
#define ErrorNeedPayCode "fmv:请使用支付码付款"
#define ErrorNeedPayCode "fmv:请使用支付码付款"
typedef
std
::
map
<
const
int
,
const
char
*>
FMErrorMap
;
typedef
std
::
map
<
const
int
,
const
char
*>
FMErrorMap
;
...
...
tests/testplugin/tst_testplugin.cpp
View file @
7448cbf8
...
@@ -85,6 +85,7 @@ void TestPlugin::test_dotask_data()
...
@@ -85,6 +85,7 @@ void TestPlugin::test_dotask_data()
"}"
);
"}"
);
QTest
::
newRow
(
"Order"
)
<<
QByteArray
(
"{
\"
fm_cmd
\"
: 1007,
\"
order_id
\"
:
\"
20171018003
\"
}"
);
QTest
::
newRow
(
"Order"
)
<<
QByteArray
(
"{
\"
fm_cmd
\"
: 1007,
\"
order_id
\"
:
\"
20171018003
\"
}"
);
QTest
::
newRow
(
"Fund"
)
<<
QByteArray
(
"{
\"
fm_cmd
\"
: 1002,
\"
order_id
\"
:
\"
20171018001
\"
}"
);
QTest
::
newRow
(
"Fund"
)
<<
QByteArray
(
"{
\"
fm_cmd
\"
: 1002,
\"
order_id
\"
:
\"
20171018001
\"
}"
);
QTest
::
newRow
(
"CouponPay"
)
<<
QByteArray
(
"{
\"
fm_cmd
\"
: 10032}"
);
}
}
void
TestPlugin
::
test_dotask
()
void
TestPlugin
::
test_dotask
()
...
...
version.h
View file @
7448cbf8
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_REVISION 0
#define VER_BUILD 2
1
#define VER_BUILD 2
5
//! Convert version numbers to string
//! Convert version numbers to string
#define _STR(S) #S
#define _STR(S) #S
...
...
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