diff --git a/webapp/controller/DailySelectionController.class.php b/webapp/controller/DailySelectionController.class.php index 39811766..a6efc6bd 100644 --- a/webapp/controller/DailySelectionController.class.php +++ b/webapp/controller/DailySelectionController.class.php @@ -48,46 +48,7 @@ use models\BcOrder; use services\LogService; use services\ShopAddItemService; -class DailySelectionController extends BaseAuthedController -{ - - public function refreshDailySelection() - { - $address = $this->_getAccountId(); - - $costs = mt\Parameter::getByName('daily_selection_refresh_cost'); - $arrCosts = explode('|', $costs['param_value']); - $maxCount = count($arrCosts); - - $count = $this->countTodayRefreshTimes($address); - if ($count >= $maxCount) { - $this->_rspErr(2, 'The maximum number of refreshes has been reached'); - return; - } - - $cost = $arrCosts[$count]; - $costItemId = $this->getCostItemIdByTokenType(ShopController::TOKEN_TYPE_GOLD); - $costItems = $this->makeCostItems($costItemId, $cost); - $lackItem = null; - if (!$this->_hasEnoughItems($costItems, $lackItem)) { - $this->_rspErr(2, $this->_getLackItemErrMsg($lackItem)); - return; - } - - $chk = $this->refreshDailySelectionWithMode($address, 1); - if ($chk) { - $this->_decItems($costItems); - - // error_log("refreshDailySelection-------" . $address . "---" . $cost); - $this->_rspData( - array( - 'cost' => $cost, - ) - ); - } else { - $this->_rspErr(3, 'refresh failed'); - } - } +class DailySelectionController extends BaseAuthedController { public function getDailySelectionList() { @@ -147,6 +108,44 @@ class DailySelectionController extends BaseAuthedController ); } + public function refreshDailySelection() + { + $address = $this->_getAccountId(); + + $costs = mt\Parameter::getByName('daily_selection_refresh_cost'); + $arrCosts = explode('|', $costs['param_value']); + $maxCount = count($arrCosts); + + $count = $this->countTodayRefreshTimes($address); + if ($count >= $maxCount) { + $this->_rspErr(2, 'The maximum number of refreshes has been reached'); + return; + } + + $cost = $arrCosts[$count]; + $costItemId = $this->getCostItemIdByTokenType(ShopController::TOKEN_TYPE_GOLD); + $costItems = $this->makeCostItems($costItemId, $cost); + $lackItem = null; + if (!$this->_hasEnoughItems($costItems, $lackItem)) { + $this->_rspErr(2, $this->_getLackItemErrMsg($lackItem)); + return; + } + + $chk = $this->refreshDailySelectionWithMode($address, 1); + if ($chk) { + $this->_decItems($costItems); + + // error_log("refreshDailySelection-------" . $address . "---" . $cost); + $this->_rspData( + array( + 'cost' => $cost, + ) + ); + } else { + $this->_rspErr(3, 'refresh failed'); + } + } + public function buyGoodsDS() { $idx = getReqVal('idx', 0);