1
This commit is contained in:
parent
a83efc37f4
commit
c2ff3a529b
@ -48,46 +48,7 @@ use models\BcOrder;
|
|||||||
use services\LogService;
|
use services\LogService;
|
||||||
use services\ShopAddItemService;
|
use services\ShopAddItemService;
|
||||||
|
|
||||||
class DailySelectionController extends BaseAuthedController
|
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 getDailySelectionList()
|
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()
|
public function buyGoodsDS()
|
||||||
{
|
{
|
||||||
$idx = getReqVal('idx', 0);
|
$idx = getReqVal('idx', 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user