Commit 985d4ae6 by NitefullWind

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

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