Commit 272c667e authored by luhongguang's avatar luhongguang

update: tcc 同一条数据取消时候问题

parent 1f5ca56c
...@@ -548,12 +548,12 @@ class Tcc2Service ...@@ -548,12 +548,12 @@ class Tcc2Service
$goodsSkuId = $item["goods_sku_id"]; $goodsSkuId = $item["goods_sku_id"];
$num = $item["num"]; $num = $item["num"];
$sku = PindanGoodsSku::getRecord(["goods_sku_id" => $goodsSkuId] $sku = PindanGoodsSku::getRecordMaster(["goods_sku_id" => $goodsSkuId]
, ["goods_sku_id", "total_amount_order", "inventory_rest", "inventory_lock", "online_status"]); , ["goods_sku_id", "total_amount_order", "inventory_rest", "inventory_lock", "online_status"]);
if (!empty($sku[0])) {
$params = [ $params = [
"inventory_rest" => $sku["inventory_rest"] + $num, "inventory_rest" => $sku[0]["inventory_rest"] + $num,
"total_amount_order" => $sku["total_amount_order"] - $num, "total_amount_order" => $sku[0]["total_amount_order"] - $num,
]; ];
$rowCount = PindanGoodsSku::save($params, ["goods_sku_id" => $goodsSkuId, "total_amount_order[>=]" => $num]); $rowCount = PindanGoodsSku::save($params, ["goods_sku_id" => $goodsSkuId, "total_amount_order[>=]" => $num]);
if ($rowCount <= 0) { if ($rowCount <= 0) {
...@@ -561,6 +561,7 @@ class Tcc2Service ...@@ -561,6 +561,7 @@ class Tcc2Service
throw new GoodsException(["cus" => 32]); throw new GoodsException(["cus" => 32]);
} }
} }
}
if (!PindanGoodsSku::commit()) { if (!PindanGoodsSku::commit()) {
PindanGoodsSku::rollback(); PindanGoodsSku::rollback();
......
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