This commit is contained in:
hujiabin 2023-06-05 12:02:34 +08:00
parent f3d5a2e26a
commit dc9a232395
3 changed files with 35 additions and 48 deletions

View File

@ -83,12 +83,19 @@ class StarController extends BaseAuthedController {
$this->_rspErr(1, "Can't get it again");
return;
}
$dropMeta = mt\Drop::get($meta['drop_id']);
if (!$dropMeta) {
$this->_rspErr(10, 'server internal error:' . $meta['drop_id']);
return;
}
$this->_scatterDrop('missionStar:' . $missionId, $dropMeta, $this->awardService, $this->propertyChgService);
$items = array(
array(
'item_id' => $meta['item_id'],
'item_num' => $meta['item_num'],
)
);
$this->_addItems($items,$this->awardService, $this->propertyChgService);
// $dropMeta = mt\Drop::get($meta['drop_id']);
// if (!$dropMeta) {
// $this->_rspErr(10, 'server internal error:' . $meta['drop_id']);
// return;
// }
// $this->_scatterDrop('missionStar:' . $missionId, $dropMeta, $this->awardService, $this->propertyChgService);
MissionStar::add($meta['season_id'],$missionId);
$this->_rspData(array(
'award' => $this->awardService->toDto(),
@ -105,11 +112,19 @@ class StarController extends BaseAuthedController {
$missionStarDb = MissionStar::find($meta['season_id'],$meta['id']);
if ($this->userInfo['star_num'] >= $target && !$missionStarDb){
//可领取
$dropMeta = mt\Drop::get($meta['drop_id']);
if ($dropMeta) {
$this->_scatterDrop('missionStar:' . $meta['id'], $dropMeta, $this->awardService, $this->propertyChgService);
$items = array(
array(
'item_id' => $meta['item_id'],
'item_num' => $meta['item_num'],
)
);
$this->_addItems($items,$this->awardService, $this->propertyChgService);
MissionStar::add($meta['season_id'],$meta['id']);
}
// $dropMeta = mt\Drop::get($meta['drop_id']);
// if ($dropMeta) {
// $this->_scatterDrop('missionStar:' . $meta['id'], $dropMeta, $this->awardService, $this->propertyChgService);
// MissionStar::add($meta['season_id'],$meta['id']);
// }
}
}
$this->_rspData(array(

View File

@ -34,18 +34,16 @@ class StarLevel
return null;
}
public static function getCurrent($num){
public static function getMaxSlot($num){
$metaList = self::getDefaultList();
$maxLen = count($metaList);
for ($i=0;$i<$maxLen;$i++){
if ($num >= $metaList[$maxLen-1]['need_star_num']){
return $metaList[$maxLen-1];
}
if ($num >= $metaList[$i]['need_star_num'] &&
$num < $metaList[$i+1]['need_star_num']) {
return $metaList[$i];
$maxSlot = 1;
foreach ($metaList as $meta){
if ($num >= $meta['need_star_num'] && $meta['unlock_chip_slot']){
$maxSlot = $meta['unlock_chip_slot'];
}
}
return $maxSlot;
}
public static function getDefaultList(){
@ -97,7 +95,6 @@ class StarLevel
protected static $metaList;
protected static $metaList2;
protected static $metaListStar;
}

View File

@ -29,11 +29,6 @@ class ChipPageService extends BaseService
'account_id'=> myself()->_getAccountId()
)
);
// if (!$rows){
// for ($i=0;$i<self::INIT_CHIP_PAGE_NUM;$i++){
// ChipPage::addChipPage();
// }
// }
if ($rows){
foreach ($rows as $row){
$this->refreshSlotState($row);
@ -44,15 +39,13 @@ class ChipPageService extends BaseService
public function refreshSlotState($row){
$data = emptyReplace(json_decode($row['data'], true), array());
$userInfo = myself()->_getOrmUserInfo();
$starMeta = \mt\StarLevel::getCurrent($userInfo['star_num']);
if ($starMeta['unlock_chip_slot']){
$maxSlot = \mt\StarLevel::getMaxSlot($userInfo['star_num']);
foreach ($data as &$val){
if ($starMeta['unlock_chip_slot'] < $val['slot_id'] && $val['state'] == 0){
if ($maxSlot < $val['slot_id'] && $val['state'] == 0){
$val['state'] = 0;
}else{
$val['state'] = 1;
}
}
SqlHelper::update(
myself()->_getSelfMysql(),
@ -65,24 +58,6 @@ class ChipPageService extends BaseService
)
);
}
// foreach ($data as &$val){
// if ($userInfo['level'] < $val['slot_id'] && $val['state'] == 0){
// $val['state'] = 0;
// }else{
// $val['state'] = 1;
// }
// }
//
// SqlHelper::update(
// myself()->_getSelfMysql(),
// 't_chip_page',
// array(
// 'idx' => $row['idx']
// ),
// array(
// 'data' => json_encode($data),
// )
// );
}
}