1
This commit is contained in:
parent
6915934214
commit
7b95031281
@ -162,24 +162,7 @@ class MissionController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
$this->_scatterDrop('mission:' . $missionId, $dropMeta, $this->awardService, $this->propertyChgService);
|
||||
if ($missionMeta['type'] == mt\Task::DAILY_MISSON_TYPE) {
|
||||
//(账号内所有PVE角色NFT每日获得极限总和(CEG)+账号内所有PVE武器NFT每日获得极限总和(CEG))*10%/每日任务数量
|
||||
$this->propertyChgService->addUserChg();
|
||||
$cegUpLimit = Hero::getRawPveCegUpLimit() + Gun::getRawPveCegUpLimit();
|
||||
$count = mt\Task::getDaildyMissionCount();
|
||||
if (!$count || !$cegUpLimit) {
|
||||
$this->_rspErr(10, 'server internal error:');
|
||||
return;
|
||||
}
|
||||
$gold = ($cegUpLimit * 0.1) / $count;
|
||||
error_log(json_encode(array(
|
||||
'cegUpLimit' => $cegUpLimit,
|
||||
'count' => $count,
|
||||
'ceg' => $gold
|
||||
)));
|
||||
myself()->_addVirtualItem(V_ITEM_GOLD, round($gold));
|
||||
$this->awardService->addItem(V_ITEM_GOLD, round($gold));
|
||||
}
|
||||
$this->procSpecMissionCommit($missionDto, $missionMeta);
|
||||
Mission::add($missionId);
|
||||
$missionDb = Mission::find($missionId);
|
||||
$missionDto = $this->missionService->getMissionDto(
|
||||
@ -232,6 +215,7 @@ class MissionController extends BaseAuthedController {
|
||||
$dropSource = 'mission:' . $missionDto['mission_id'];
|
||||
$this->_scatterDrop($dropSource, $dropMeta, $this->awardService, $this->propertyChgService);
|
||||
}
|
||||
$this->procSpecMissionCommit($missionDto, $missionMeta);
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'award' => $this->awardService->toDto(),
|
||||
@ -281,4 +265,76 @@ class MissionController extends BaseAuthedController {
|
||||
$this->propertyChgService);
|
||||
}
|
||||
|
||||
private function procSpecMissionCommit($missionDto, $missionMeta)
|
||||
{
|
||||
switch ($missionMeta['type']) {
|
||||
case mt\Task::DAILY_MISSON_TYPE:
|
||||
{
|
||||
//(账号内所有PVE角色NFT每日获得极限总和(CEG)+账号内所有PVE武器NFT每日获得极限总和(CEG))*10%/每日任务数量
|
||||
$this->propertyChgService->addUserChg();
|
||||
$cegUpLimit = Hero::getRawPveCegUpLimit() + Gun::getRawPveCegUpLimit();
|
||||
$count = mt\Task::getDaildyMissionCount();
|
||||
if (!$count || !$cegUpLimit) {
|
||||
$this->_rspErr(10, 'server internal error:');
|
||||
return;
|
||||
}
|
||||
$gold = ($cegUpLimit * 0.1) / $count;
|
||||
error_log(json_encode(array(
|
||||
'cegUpLimit' => $cegUpLimit,
|
||||
'count' => $count,
|
||||
'ceg' => $gold
|
||||
)));
|
||||
myself()->_addVirtualItem(V_ITEM_GOLD, round($gold));
|
||||
$this->awardService->addItem(V_ITEM_GOLD, round($gold));
|
||||
}
|
||||
break;
|
||||
case mt\Task::OFFER_REWARD_MISSON_TYPE:
|
||||
{
|
||||
//(PVE角色NFT每日获得极限(CEG)+PVE武器NFT每日获得极限(CEG))*90%/悬赏任务数量
|
||||
$totalHeroUpLimit = 0;
|
||||
$totalGunUpLimit = 0;
|
||||
$count = $this->missionService-> getOfferRewardMissionCount();
|
||||
$this->propertyChgService->addUserChg();
|
||||
foreach ($missionDto['objects'] as $obj) {
|
||||
switch ($obj['type']) {
|
||||
case 0:
|
||||
{
|
||||
//weapon
|
||||
$gunDb = Gun::find($obj['id']);
|
||||
if ($gunDb) {
|
||||
$gunDto = Gun::toDto($gunDb);
|
||||
$totalGunUpLimit += $gunDto['raw_pve_ceg_uplimit'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
//hero
|
||||
$heroDb = Hero::find($obj['id']);
|
||||
if ($heroDb) {
|
||||
$heroDto = Hero::toDto($heroDb);
|
||||
$totalHeroUpLimit += $heroDto['raw_pve_ceg_uplimit'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}//end foreach
|
||||
if ($count > 0) {
|
||||
$ceg = ($totalHeroUpLimit + $totalGunUpLimit) * 0.9/ $count;
|
||||
myself()->_addVirtualItem(V_ITEM_GOLD, round($gold));
|
||||
$this->awardService->addItem(V_ITEM_GOLD, round($gold));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ use models\Hero;
|
||||
offer.reward.missions
|
||||
{
|
||||
"refreshtime": 0,
|
||||
"count": 0,
|
||||
"missions": [
|
||||
{
|
||||
"mission_id": 100,
|
||||
@ -583,6 +584,7 @@ class MissionService extends BaseService {
|
||||
));
|
||||
}
|
||||
}
|
||||
$this->offerRewartdMission['count'] = $num;
|
||||
$this->saveOfferRewardMission();
|
||||
}
|
||||
|
||||
@ -636,6 +638,8 @@ class MissionService extends BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
$heroCount = 0;
|
||||
$gunCount = 0;
|
||||
$objects = explode('|', getReqVal('objects', 0));
|
||||
foreach ($objects as $val) {
|
||||
$strings = explode(':', $val);
|
||||
@ -648,6 +652,7 @@ class MissionService extends BaseService {
|
||||
case 0:
|
||||
{
|
||||
//武器
|
||||
++$gunCount;
|
||||
array_push(
|
||||
$mission['objects'],
|
||||
array(
|
||||
@ -660,6 +665,7 @@ class MissionService extends BaseService {
|
||||
case 1:
|
||||
{
|
||||
//英雄
|
||||
++$heroCount;
|
||||
$heroDb = Hero::find($id);
|
||||
if (!$heroDb) {
|
||||
myself()->_rspErr(1, 'objects parameter error' . $id);
|
||||
@ -676,7 +682,6 @@ class MissionService extends BaseService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
error_log(111);
|
||||
$mission['sendtime'] = myself()->_getNowTime();
|
||||
error_log(json_encode($mission));
|
||||
$this->offerRewartdMission['missions'][$idx] = $mission;
|
||||
@ -773,4 +778,10 @@ class MissionService extends BaseService {
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
public function getOfferRewardMissionCount()
|
||||
{
|
||||
$count = getXVal($this->offerRewartdMission, 'count');
|
||||
return $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user