From dca6395b5cca2fb7f0fad695bd0dc7349ec24908 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 11:08:23 +0800 Subject: [PATCH 1/2] ... --- webapp/controller/ShopController.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index c0514169..5f5e7666 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1375,7 +1375,13 @@ class ShopController extends BaseAuthedController } } - $free_num = $goods['free_num'] - $this->countFreeBuyTimes($address, $id, $goods_id); + if (!empty($goods['free_type'])) { + $count = $this->countFreeBuyTimes($goods['free_type'], $goods['id'], $goods['goods_id']); + $goods['free_num'] = $goods['free_num'] - $count; + error_log('free_num:' . $goods['free_num']); + } + + $free_num = $goods['free_num']; $pending = $this->checkPendingBuyGoodsNormal($address, $goods_id, $shop_id, $id); error_log("getChestItems start " . json_encode( array( From dca36bd4380eb46afaf70783681dee7301cf459b Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 11:24:02 +0800 Subject: [PATCH 2/2] ... --- webapp/controller/ShopController.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 5f5e7666..f975bc72 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -1038,9 +1038,7 @@ class ShopController extends BaseAuthedController $this->internalAddItem($propertyChgService, $itemMeta, $goods_count, 1); $this->_rspOk(); } else { - error_log("buy normal 1, need_price = " . $need_price . " goods_num = " . $goods_num); $price = $this->normalizeWeb3Price($goods_num * $need_price); - error_log("buy normal 2, price = " . $price); $item_id = $row['goods_id']; $item_count = $goods_num; @@ -1051,8 +1049,6 @@ class ShopController extends BaseAuthedController $item_count ); - error_log("buy normal 3, response = " . json_encode($response)); - BcOrder::upsert($response['trans_id'], array( 'item_id' => $item_id, 'item_num' => $item_count, @@ -1066,6 +1062,9 @@ class ShopController extends BaseAuthedController $response['item_id'] = $item_id; $response['item_num'] = $item_count; + + error_log("buy normal, item_id = " . $item_id . " item_count = " . $item_count . " need_price = " . $need_price . " price = " . $price . " response = " . json_encode($response)); + $this->_rspData( array( "block_chain" => $response