Commit 15cc2cd3 by gujin.wang

以麦当劳为参考对卡券核销功能进行测试

parent 5d373f53
...@@ -55,7 +55,7 @@ int FMNetwork::send(const QString &url, const QByteArray &reqData, QByteArray &r ...@@ -55,7 +55,7 @@ int FMNetwork::send(const QString &url, const QByteArray &reqData, QByteArray &r
} else { } else {
int err = reply->error(); int err = reply->error();
error = FM_API_NETWORERROR; error = FM_API_NETWORERROR;
errorMsg = netErrInfo(err); errorMsg = reply->errorString();
} }
}else{ }else{
disconnect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); disconnect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "fmp_logger_i.h" #include "fmp_logger_i.h"
#include "resend.h" #include "resend.h"
#include <QDebug> #include <QDebug>
#include "fmloading.h"
FMPVipPrivate::FMPVipPrivate(FMPVip *vip): FMPVipPrivate::FMPVipPrivate(FMPVip *vip):
q_ptr(vip) q_ptr(vip)
...@@ -35,6 +36,9 @@ int FMPVipPrivate::Init() ...@@ -35,6 +36,9 @@ int FMPVipPrivate::Init()
home->notification(QString::fromLocal8Bit("[非码会员]启动成功!")); home->notification(QString::fromLocal8Bit("[非码会员]启动成功!"));
FMP_INFO() << "Vip start"; FMP_INFO() << "Vip start";
//for test
ctxTest = q->_ctx;
} }
return FMP_SUCCESS; return FMP_SUCCESS;
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
#include <QDialog> #include <QDialog>
#include <QMovie> #include <QMovie>
#include <ctkPluginContext.h>
extern ctkPluginContext *ctxTest;
namespace Ui { namespace Ui {
class FMLoading; class FMLoading;
} }
......
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
#include <QMutex> #include <QMutex>
#include "fmloading.h" #include "fmloading.h"
#include <ctkPluginContext.h>
#include <QJsonObject>
#include "fmp_redeem_i.h"
ctkPluginContext *ctxTest = nullptr;
FMVipLogin::FMVipLogin(QDialog *parent) : FMVipLogin::FMVipLogin(QDialog *parent) :
FMVipWnd(parent), FMVipWnd(parent),
ui(new Ui::FMVipLogin) ui(new Ui::FMVipLogin)
...@@ -50,6 +55,36 @@ QString FMVipLogin::getVersionInfo() ...@@ -50,6 +55,36 @@ QString FMVipLogin::getVersionInfo()
void FMVipLogin::on_login_btn_clicked() void FMVipLogin::on_login_btn_clicked()
{ {
QJsonObject result;
QJsonObject req;
//req["ver"] = 1;
//req["action"] = "redeem";
req["store_id"] = "99998";
req["operator_id"] = "00000002";
req["station_id"] = 1;
req["trans_id"] = QDateTime::currentDateTime().toString("yyyyMMddHHmmsszzz");
req["business_date"] = QDate::currentDate().toString("yyyyMMdd");
if(ctxTest != nullptr)
{
try
{
//! Verify pointer
ctxTest->getPlugin();
ctkServiceReference ref = ctxTest->getServiceReference<FMPRedeemInterface>();
FMPRedeemInterface* redeem = ctxTest->getService<FMPRedeemInterface>(ref);
redeem->StartService();
result = redeem->Redeem(QJsonObject(), req);
qDebug() << result;
}
catch(const ctkException&)
{
qDebug() << "Invalid context" << ctxTest;
}
}
return;
QString id = ui->login_edit->text(); QString id = ui->login_edit->text();
_session->addData("code", id); _session->addData("code", id);
......
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