...
This commit is contained in:
parent
0b5a86dd32
commit
ad420b180e
@ -1164,10 +1164,27 @@ class ShopController extends BaseAuthedController
|
|||||||
$this->_rspErr(2, 'id is invalid');
|
$this->_rspErr(2, 'id is invalid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$isFreeBuy = false;
|
||||||
|
if (!empty($shop['free_type'])) {
|
||||||
|
$count = $this->countFreeBuyTimes($shop);
|
||||||
|
if ($count < $shop['free_num']) {
|
||||||
|
$isFreeBuy = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
$cost = $shop['price'] * $num;
|
$cost = $shop['price'] * $num;
|
||||||
|
if ($isFreeBuy) {
|
||||||
|
$cost = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$recommend = $shop['recommend'];
|
$recommend = $shop['recommend'];
|
||||||
|
|
||||||
$itemStore = mt\ShopChest::getRandomItemListByChestType($recommend);
|
$itemStore = mt\ShopChest::getRandomItemListByChestType($recommend);
|
||||||
|
if ($isFreeBuy) {
|
||||||
|
if ($num != 1) {
|
||||||
|
$this->_rspErr(2, 'num is invalid');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i = 0; $i < $num; $i++) {
|
for ($i = 0; $i < $num; $i++) {
|
||||||
@ -1186,6 +1203,9 @@ class ShopController extends BaseAuthedController
|
|||||||
$record[$key] = array("item_id" => $item['item_id'], "item_num" => $item['num']);
|
$record[$key] = array("item_id" => $item['item_id'], "item_num" => $item['num']);
|
||||||
array_push($result, $record[$key]);
|
array_push($result, $record[$key]);
|
||||||
}
|
}
|
||||||
|
if ($isFreeBuy && $num == 1) {
|
||||||
|
$this->addFreeBuyRecord($shop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log("buyBlindBox start " . json_encode(
|
error_log("buyBlindBox start " . json_encode(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user