Commit f4a98964 authored by 顾文旭's avatar 顾文旭

log

parent 02bab96b
...@@ -445,6 +445,11 @@ class Tcc2Service ...@@ -445,6 +445,11 @@ class Tcc2Service
//T时候执行C2,条件加上乐观锁 //T时候执行C2,条件加上乐观锁
if ($tccInfo["status"] == Tcc::STATUS_C1_SUCCESS) { if ($tccInfo["status"] == Tcc::STATUS_C1_SUCCESS) {
try {
$goodsSku = PindanGoodsSku::getRecord(["goods_sku_id" => $goodsSkuId]);
FileLog::info("Tcc inventory_rest add start ", "tid:" . $tid . " num:" . $num . " goods_sku_id" . $goodsSkuId
. " total_amount_order: " . $goodsSku['total_amount_order'] . " inventory_rest:" . $goodsSku['inventory_rest'] .
" total_amount_sold:" . $goodsSku['total_amount_sold'] . " inventory_total:" . $goodsSku['inventory_total']);
$rowCount = PindanGoodsSku::save([ $rowCount = PindanGoodsSku::save([
"total_amount_order[-]" => $num, "total_amount_order[-]" => $num,
"inventory_rest[+]" => $num, "inventory_rest[+]" => $num,
...@@ -453,6 +458,18 @@ class Tcc2Service ...@@ -453,6 +458,18 @@ class Tcc2Service
PindanGoodsSku::rollback(); PindanGoodsSku::rollback();
throw new GoodsException(["cus" => 32]); throw new GoodsException(["cus" => 32]);
} }
FileLog::info("Tcc inventory_rest add end", "tid:" . $tid . " num:" . $num . " goods_sku_id" . $goodsSkuId
. " total_amount_order: " . $goodsSku['total_amount_order'] . " inventory_rest:" . $goodsSku['inventory_rest']
. " total_amount_sold:" . $goodsSku['total_amount_sold'] . " inventory_total:" . $goodsSku['inventory_total']);
if ($goodsSku['inventory_rest'] + $goodsSku['total_amount_sold'] > $goodsSku['inventory_total']) {
FileLog::error("Tcc inventory_rest add error", " inventory_rest:" . $goodsSku['inventory_rest'] .
" total_amount_sold:" . $goodsSku['total_amount_sold'] . " inventory_total:" . $goodsSku['inventory_total']);
}
} catch (\Exception $e) {
FileLog::error("Tcc inventory_rest add Exception", $e->getMessage());
}
} }
} }
...@@ -546,7 +563,7 @@ class Tcc2Service ...@@ -546,7 +563,7 @@ class Tcc2Service
$num = $item["num"]; $num = $item["num"];
$params = [ $params = [
"inventory_rest[+]" => $num, "inventory_rest[+]" => $num,
"total_amount_order[-]" => $num, "total_amount_order[-]" => $num,
]; ];
$rowCount = PindanGoodsSku::save($params, ["goods_sku_id" => $item["goods_sku_id"]]); $rowCount = PindanGoodsSku::save($params, ["goods_sku_id" => $item["goods_sku_id"]]);
if ($rowCount <= 0) { if ($rowCount <= 0) {
......
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