...
This commit is contained in:
parent
69ef2d3f8d
commit
bf6a11ea23
@ -483,6 +483,9 @@ class ShopController extends BaseAuthedController
|
||||
private function getCostItemIdByTokenType($token_type)
|
||||
{
|
||||
switch ($token_type) {
|
||||
case ShopController::TOKEN_TYPE_GOLD:
|
||||
return V_ITEM_GOLD;
|
||||
break;
|
||||
case ShopController::TOKEN_TYPE_CEG:
|
||||
return V_ITEM_GOLD;
|
||||
break;
|
||||
@ -783,15 +786,35 @@ class ShopController extends BaseAuthedController
|
||||
return;
|
||||
}
|
||||
|
||||
$maxCount = mt\Parameter::getByName('daily_selection_refresh_time')['param_value'];
|
||||
$count = $this->countTodayRefreshTimes($address);
|
||||
if ($count >= 6) {
|
||||
if ($count >= $maxCount) {
|
||||
$this->_rspErr(2, 'The maximum number of refreshes has been reached');
|
||||
return;
|
||||
}
|
||||
|
||||
$count = $this->countTodayRefreshTimes($address);
|
||||
$costs = mt\Parameter::getByName('daily_selection_refresh_cost');
|
||||
$arrCosts = explode('|', $costs['param_value']);
|
||||
$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->_rspOk();
|
||||
$this->_decItems($costItems);
|
||||
$this->_rspData(
|
||||
array(
|
||||
'cost' => $cost,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$this->_rspErr(3, 'refresh failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user