Commit 26d61fae by NitefullWind

1. 实现支付。

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