Commit bdd06ccf by gujin.wang

添加对卡券核销请求的分发处理

parent f821c854
...@@ -56,7 +56,6 @@ void FMPVipServer::onReadyRead() ...@@ -56,7 +56,6 @@ void FMPVipServer::onReadyRead()
dispatcher->doTask(recvData, rspData); dispatcher->doTask(recvData, rspData);
if(socket->isValid()){ if(socket->isValid()){
rspData;
Write(rspData); Write(rspData);
} }
else{ else{
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "taskfinal.h" #include "taskfinal.h"
#undef StartService #undef StartService
#include <fmp_epay_i.h> #include <fmp_epay_i.h>
#include "fmp_coupon_i.h"
FMVipDispatcher::FMVipDispatcher(QObject *parent) : FMVipDispatcher::FMVipDispatcher(QObject *parent) :
QObject(parent), QObject(parent),
...@@ -78,6 +78,41 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData) ...@@ -78,6 +78,41 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
rspData = taskFinal.doTask(); rspData = taskFinal.doTask();
break; break;
} }
case FM_Update_Store_Info:{
FMPCouponInterface* coupon = FMP::GetService<FMPCouponInterface>();
coupon->StartService();
QJsonObject obj = coupon->UpdateStoreInfo(jsonObj);
rspData = QJsonDocument(obj).toJson(QJsonDocument::Compact);
break;
}
case FM_Coupon_Check:{
FMPCouponInterface* coupon = FMP::GetService<FMPCouponInterface>();
coupon->StartService();
QJsonObject obj = coupon->VoucherCheck(jsonObj);
rspData = QJsonDocument(obj).toJson(QJsonDocument::Compact);
break;
}
case FM_Favors_Calculate:{
FMPCouponInterface* coupon = FMP::GetService<FMPCouponInterface>();
coupon->StartService();
QJsonObject obj = coupon->VoucherFavorsCalculate(jsonObj);
rspData = QJsonDocument(obj).toJson(QJsonDocument::Compact);
break;
}
case FM_Voucher_Verification:{
FMPCouponInterface* coupon = FMP::GetService<FMPCouponInterface>();
coupon->StartService();
QJsonObject obj = coupon->VoucherVerification(jsonObj);
rspData = QJsonDocument(obj).toJson(QJsonDocument::Compact);
break;
}
case FM_Voucher_Cancel:{
FMPCouponInterface* coupon = FMP::GetService<FMPCouponInterface>();
coupon->StartService();
QJsonObject obj = coupon->VoucherCancel(jsonObj);
rspData = QJsonDocument(obj).toJson(QJsonDocument::Compact);
break;
}
default: default:
rspData = QString::fromLocal8Bit("{\"msg:\":\"未知的请求类型\"}").toUtf8(); rspData = QString::fromLocal8Bit("{\"msg:\":\"未知的请求类型\"}").toUtf8();
break; break;
......
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
// 请求类型的枚举值 // 请求类型的枚举值
enum FM_TYPE { enum FM_TYPE {
FM_Update_Store_Info=1000,
FM_Coupon_Check=10039,
FM_Favors_Calculate=10040,
FM_Voucher_Verification = 10032,
FM_Voucher_Cancel = 10033,
FM_Login = 1001, FM_Login = 1001,
FM_Pay = 1003, FM_Pay = 1003,
FM_Order_Refund, FM_Order_Refund,
...@@ -203,20 +208,21 @@ const PropsMap::value_type PropsMapPairs[] = ...@@ -203,20 +208,21 @@ const PropsMap::value_type PropsMapPairs[] =
}; };
static PropsMap PosToServerProps(PropsMapPairs, PropsMapPairs + (sizeof(PropsMapPairs)/sizeof(PropsMapPairs[0]))); static PropsMap PosToServerProps(PropsMapPairs, PropsMapPairs + (sizeof(PropsMapPairs)/sizeof(PropsMapPairs[0])));
class FMPropsMap // class FMPropsMap
{ // {
public: // public:
static QString get(QString posProp) { // static QString get(QString posProp) {
PropsMap::iterator it = PosToServerProps.find(posProp); // PropsMap::iterator it = PosToServerProps.find(posProp);
if(it != PosToServerProps.end()) { // if(it != PosToServerProps.end()) {
return it->second; // return it->second;
} // }
return posProp; // return posProp;
} // }
}; // };
#endif #endif
#define ServerProps(posProp) FMPropsMap::get(posProp) // #define ServerProps(posProp) FMPropsMap::get(posProp)
#define ServerProps(posProp) PosToServerProps.find(posProp) == PosToServerProps.end() ? posProp : PosToServerProps[posProp]
// 签名字段 // 签名字段
const static QString SignProps[] = { const static QString SignProps[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment