Commit 26d61fae by NitefullWind

1. 实现支付。

parent 607a96ba
......@@ -167,6 +167,7 @@ inline QSharedPointer<StoreInfo> GetLastStoreInfo()
odb::transaction t (DBSP()->begin ());
StoreInfo_last storeInfo = DBSP()->query_value<StoreInfo_last>();
storeInfoP->setId(storeInfo._id);
storeInfoP->setStoreId(storeInfo._storeId);
storeInfoP->setPosId(storeInfo._posId);
storeInfoP->setBusinessDate(storeInfo._businessDate);
......@@ -174,6 +175,7 @@ inline QSharedPointer<StoreInfo> GetLastStoreInfo()
t.commit ();
} catch (const odb::exception &e) {
storeInfoP.clear();
qDebug() << "Exception: Get last store info: " << e.what();
}
return storeInfoP;
......
......@@ -123,7 +123,12 @@ void Order::setRefunded(bool refunded)
_refunded = refunded;
}
PayList Order::payList() const
PayList &Order::payList()
{
return _payList;
}
const PayList &Order::payList() const
{
return _payList;
}
......@@ -133,7 +138,12 @@ void Order::setPayList(const PayList &payList)
_payList = payList;
}
QLazySharedPointer<StoreInfo> Order::storeInfo() const
QLazySharedPointer<StoreInfo> &Order::storeInfo()
{
return _storeInfo;
}
const QLazySharedPointer<StoreInfo> &Order::storeInfo() const
{
return _storeInfo;
}
......
......@@ -13,7 +13,7 @@
#include <odb/qt/lazy-ptr.hxx>
#define DB_VERSION_BASE 1
#define DB_VERSION_CURRENT 10
#define DB_VERSION_CURRENT 12
#pragma db model version(DB_VERSION_BASE, DB_VERSION_CURRENT)
namespace DB {
......@@ -79,10 +79,12 @@ public:
bool refunded() const;
void setRefunded(bool refunded);
PayList payList() const;
PayList &payList();
const PayList &payList() const;
void setPayList(const PayList &payList);
QLazySharedPointer<StoreInfo> storeInfo() const;
QLazySharedPointer<StoreInfo> &storeInfo();
const QLazySharedPointer<StoreInfo> &storeInfo() const;
void setStoreInfo(const QLazySharedPointer<StoreInfo> &storeInfo);
unsigned long id() const;
......@@ -112,8 +114,6 @@ private:
#pragma db not_null
QLazySharedPointer<StoreInfo> _storeInfo;
QString _testCol;
};
//! Pay
......@@ -218,6 +218,8 @@ private:
query((?) + "order by id desc limit 0,1")
struct StoreInfo_last
{
#pragma db column(StoreInfo::_id)
unsigned long _id;
#pragma db column(StoreInfo::_storeId)
QString _storeId;
#pragma db column(StoreInfo::_posId)
......
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
<changeset version="10"/>
<changeset version="12"/>
<changeset version="11"/>
<changeset version="10">
<alter-table name="Order">
<drop-column name="testCol"/>
</alter-table>
</changeset>
<changeset version="9"/>
......
......@@ -118,6 +118,10 @@ bool FMTask::sendToServer(bool isShowMsg)
QByteArray data = json.toJson(QJsonDocument::Compact);
url = FMPVipSettings::instance()->getServerUrl() + "/" + ReqUrl.at(FM_Type());
#ifdef FM_DEBUG
url = "http://127.0.0.1:5000/vip/" + ReqUrl.at(FM_Type());
#endif
QByteArray rspData;
FMNetwork net;
......
......@@ -19,9 +19,11 @@ void TaskLogin::packagePOSReq()
QString msg;
if(storeInfo == nullptr) {
msg = QString::fromLocal8Bit("未设置营业信息,不能进行会员认证");
FMP_ERROR() << msg;
setError(FM_API_ERROR, msg);
return;
}
posReqJsonObj[PosProps.StoreId] = storeInfo->storeId();
posReqJsonObj[PosProps.PosId] = storeInfo->posId();
posReqJsonObj[PosProps.BusinessDate] = storeInfo->businessDate();
......
......@@ -2,14 +2,11 @@
#define TASKPAY_H
#include "fmtask.h"
#include "taskothers.h"
#include "database.h"
#include <QThread>
class TaskCouponThread;
//namespace FMItem {
// class Order;
//}
class TaskPay : public FMTask
{
Q_OBJECT
......@@ -28,7 +25,8 @@ private slots:
private:
TaskCouponThread *couponThread;
// FMItem::Order *_order;
QSharedPointer<DB::Order> _order;
// odb::transaction _transactionPay;
};
// 加载代金券的线程类
......
TEMPLATE = subdirs
SUBDIRS += \
# testplugin \
testplugin \
autotest
CONFIG += ordered
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 39
#define VER_BUILD 42
//! Convert version numbers to string
#define _STR(S) #S
......
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