Commit 985d4ae6 by NitefullWind

1. 修复非码支付崩溃Bug。

parent a6840766
...@@ -20,7 +20,7 @@ void TaskQRPay::packagePOSReq() ...@@ -20,7 +20,7 @@ void TaskQRPay::packagePOSReq()
QSharedPointer<StoreInfo> storeInfo = GetLastStoreInfo(); QSharedPointer<StoreInfo> storeInfo = GetLastStoreInfo();
QSharedPointer<Order> _order; QSharedPointer<Order> _order(new Order());
try { try {
// _transactionPay.reset(DBSP()->begin()); // _transactionPay.reset(DBSP()->begin());
transaction t(DBSP()->begin()); transaction t(DBSP()->begin());
...@@ -29,7 +29,7 @@ void TaskQRPay::packagePOSReq() ...@@ -29,7 +29,7 @@ void TaskQRPay::packagePOSReq()
odb::result<Order> r = DBSP()->query<Order>(query<Order>::orderId == orderId); odb::result<Order> r = DBSP()->query<Order>(query<Order>::orderId == orderId);
if(r.empty()) { if(r.empty()) {
QSharedPointer<StoreInfo> transStoreInfo; QSharedPointer<StoreInfo> transStoreInfo(new StoreInfo());
transStoreInfo->setStoreId(getPosJsonValue(PosProps.StoreId).toString()); transStoreInfo->setStoreId(getPosJsonValue(PosProps.StoreId).toString());
transStoreInfo->setPosId(getPosJsonValue(PosProps.PosId).toString()); transStoreInfo->setPosId(getPosJsonValue(PosProps.PosId).toString());
transStoreInfo->setBusinessDate(getPosJsonValue(PosProps.BusinessDate).toString()); transStoreInfo->setBusinessDate(getPosJsonValue(PosProps.BusinessDate).toString());
...@@ -41,7 +41,7 @@ void TaskQRPay::packagePOSReq() ...@@ -41,7 +41,7 @@ void TaskQRPay::packagePOSReq()
_order->setStoreInfo(storeInfo); _order->setStoreInfo(storeInfo);
} }
_order->setOrderId(getPosJsonValue(PosProps.OrderId).toString()); _order->setOrderId(orderId);
_order->setOrderAmount(getPosJsonValue(PosProps.OrderAmount).toInt()); _order->setOrderAmount(getPosJsonValue(PosProps.OrderAmount).toInt());
_order->setUndisAmount(getPosJsonValue(PosProps.UndisAmount).toInt()); _order->setUndisAmount(getPosJsonValue(PosProps.UndisAmount).toInt());
...@@ -50,8 +50,6 @@ void TaskQRPay::packagePOSReq() ...@@ -50,8 +50,6 @@ void TaskQRPay::packagePOSReq()
_order->setProductText(productText); _order->setProductText(productText);
DBSP()->persist(_order); DBSP()->persist(_order);
t.commit();
} else { } else {
_order = DBSP()->load<Order>(r.begin()->id()); _order = DBSP()->load<Order>(r.begin()->id());
...@@ -96,11 +94,10 @@ void TaskQRPay::packagePOSReq() ...@@ -96,11 +94,10 @@ void TaskQRPay::packagePOSReq()
_order->setPaidAmount(_order->paidAmount()+pay->payAmount()); _order->setPaidAmount(_order->paidAmount()+pay->payAmount());
} }
}
DBSP()->update(_order); DBSP()->update(_order);
t.commit();
t.commit(); }
} catch (const odb::exception &e) { } catch (const odb::exception &e) {
QString info = QString::fromLocal8Bit("存储支付信息时异常:%1").arg(e.what()); QString info = QString::fromLocal8Bit("存储支付信息时异常:%1").arg(e.what());
FMP_ERROR() << info; FMP_ERROR() << info;
......
...@@ -34,13 +34,13 @@ void TaskQRRefund::packagePOSReq() ...@@ -34,13 +34,13 @@ void TaskQRRefund::packagePOSReq()
} else { } else {
_order = DBSP()->load<Order>(r.begin()->id()); _order = DBSP()->load<Order>(r.begin()->id());
// 检查订单是否已结算 // // 检查订单是否已结算
if(_order->settled()) { // if(_order->settled()) {
QString info = QString::fromLocal8Bit("订单已结算,不能再进行支付."); // QString info = QString::fromLocal8Bit("订单已结算,不能进行退款.");
FMP_ERROR() << info; // FMP_ERROR() << info;
setError(FM_API_ERROR, info); // setError(FM_API_ERROR, info);
return; // return;
} // }
} }
QSharedPointer<Pay> refundPay; QSharedPointer<Pay> refundPay;
......
...@@ -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 48 #define VER_BUILD 49
//! 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