每日任务的随机宝箱奖励
This commit is contained in:
parent
2731e77442
commit
d48f40660e
@ -463,6 +463,11 @@ class BaseAuthedController extends BaseController {
|
||||
$propertyService->addChip();
|
||||
}
|
||||
break;
|
||||
case mt\Item::RANDOM_BOX_TYPE:
|
||||
{
|
||||
$this->_openRandomBox($itemMeta,$awardService,$propertyService);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
$this->_addLog('additems', 'invalid_item', array(
|
||||
@ -489,6 +494,21 @@ class BaseAuthedController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
public function _openRandomBox($itemMeta,$awardService,$propertyService){
|
||||
if ($itemMeta['include_item_id']) {
|
||||
$includeItemIds = explode('|', $itemMeta['include_item_id']);
|
||||
$key = array_rand($includeItemIds,1);
|
||||
|
||||
$items = array(
|
||||
array(
|
||||
'item_id' => $includeItemIds[$key] ,
|
||||
'item_num' => 1
|
||||
)
|
||||
);
|
||||
$this->_addItems($items,$awardService,$propertyService);
|
||||
}
|
||||
}
|
||||
|
||||
public function _addTryUsingItems($items)
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
|
@ -186,19 +186,7 @@ class BattleController extends BaseAuthedController {
|
||||
// $this->_rspData($data);
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function test(){
|
||||
// echo "当前时间=>" . time() . '|' . date('Y-m-d H:i:s',time()) ;
|
||||
// echo "当天时间=>" . $this->_getDaySeconds(time()) . '|' . date('Y-m-d H:i:s',$this->_getDaySeconds(time()));
|
||||
// echo "下一天时间=>" . ($this->_getDaySeconds(time())+3600*24) . '|' . date('Y-m-d H:i:s',$this->_getDaySeconds(time())+3600*24);
|
||||
// echo "当周时间=>" . $this->_getMondaySeconds() . '|' . date('Y-m-d H:i:s',$this->_getMondaySeconds());
|
||||
// echo "下周时间=>" . ($this->_getMondaySeconds() + 7*24*3600) . '|' . date('Y-m-d H:i:s',$this->_getMondaySeconds() + 7*24*3600);
|
||||
// $this->switchAccount('james');
|
||||
// $user = $this->_getOrmUserInfo();
|
||||
// print_r($user);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
http post
|
||||
php://input
|
||||
|
@ -94,6 +94,8 @@ class Item {
|
||||
const PARACHUTE_TYPE = 16;
|
||||
const CHIP_BOX_TYPE = 17;
|
||||
const RING_TYPE = 19;
|
||||
const EMOJI_TYPE = 20;
|
||||
const RANDOM_BOX_TYPE = 21;
|
||||
|
||||
const FUNC_RENAME_CARD_SUBTYPE = 1;
|
||||
const MATERIAL_CHIP_SUBTYPE = 3;
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace services;
|
||||
|
||||
use mt\Item;
|
||||
|
||||
class AwardService extends BaseService {
|
||||
|
||||
private $items = array();
|
||||
@ -14,10 +16,17 @@ class AwardService extends BaseService {
|
||||
return;
|
||||
}
|
||||
}
|
||||
array_push($this->items, array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => $itemNum
|
||||
));
|
||||
$itemMeta = Item::get($itemId);
|
||||
if (!in_array(
|
||||
array(
|
||||
Item::RANDOM_BOX_TYPE,
|
||||
), $itemMeta['type'])){
|
||||
array_push($this->items, array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => $itemNum
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function toDto()
|
||||
|
Loading…
x
Reference in New Issue
Block a user