1
This commit is contained in:
parent
068334f9a0
commit
db24966e89
@ -252,8 +252,8 @@ class MissionController extends BaseAuthedController {
|
||||
{
|
||||
$missionId = getReqVal('mission_id', 0);
|
||||
$this->missionService->offerRewardMissionPreview(
|
||||
$missionId,
|
||||
$this->propertyChgService);
|
||||
$missionId
|
||||
);
|
||||
}
|
||||
|
||||
public function cancelOfferRewardMission()
|
||||
|
@ -634,6 +634,7 @@ class MissionService extends BaseService {
|
||||
$missionDto['state'] = 2;
|
||||
}
|
||||
$missionDto['objects'] = $mission['objects'];
|
||||
$missionDto['ceg_num'] = $this->calcCegPreview($mission['objects']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -753,46 +754,27 @@ class MissionService extends BaseService {
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
public function offerRewardMissionPreview($missionId, $propertyChgService)
|
||||
public function offerRewardMissionPreview($missionId)
|
||||
{
|
||||
$missionMeta = mt\Task::get($missionId);
|
||||
if (!$missionMeta) {
|
||||
myself()->_rspErr(1, 'mission_id parameter error');
|
||||
return;
|
||||
}
|
||||
$count = $this->getOfferRewardMissionCount();
|
||||
$cegNum = 0;
|
||||
$objects = explode('|', getReqVal('objects', 0));
|
||||
foreach ($objects as $val) {
|
||||
$strings = explode(':', $val);
|
||||
$strings = explode('|', getReqVal('objects', 0));
|
||||
$objects = array();
|
||||
foreach ($strings as $str){
|
||||
$strings2 = explode(':', $str);
|
||||
if (count($strings) < 2) {
|
||||
continue;
|
||||
}
|
||||
$type = $strings[0];
|
||||
$id = $strings[1];
|
||||
switch ($type) {
|
||||
case 0:
|
||||
{
|
||||
//武器
|
||||
$gunDb = Gun::find($id);
|
||||
if ($gunDb) {
|
||||
$gunDto = Gun::toDto($gunDb);
|
||||
$cegNum += Gun::calcPveGainGold($gunDto, $count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
//英雄
|
||||
$heroDb = Hero::find($id);
|
||||
if ($heroDb) {
|
||||
$heroDto = Hero::toDto($heroDb);
|
||||
$cegNum += Hero::calcPveGainGold($heroDto, $count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
array_push($objects,
|
||||
array(
|
||||
'type' => $strings2[0],
|
||||
'id' => $strings2[1],
|
||||
));
|
||||
}
|
||||
$cegNum = $this->calcCegPreview($objects);
|
||||
myself()->_rspData(array(
|
||||
'ceg_num' => $cegNum
|
||||
));
|
||||
@ -986,4 +968,37 @@ class MissionService extends BaseService {
|
||||
return false;
|
||||
}
|
||||
|
||||
private function calcCegPreview($objects)
|
||||
{
|
||||
$count = $this->getOfferRewardMissionCount();
|
||||
$cegNum = 0;
|
||||
foreach ($objects as $obj) {
|
||||
$type = $obj['type'];
|
||||
$id = $obj['id'];
|
||||
switch ($type) {
|
||||
case 0:
|
||||
{
|
||||
//武器
|
||||
$gunDb = Gun::find($id);
|
||||
if ($gunDb) {
|
||||
$gunDto = Gun::toDto($gunDb);
|
||||
$cegNum += Gun::calcPveGainGold($gunDto, $count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
//英雄
|
||||
$heroDb = Hero::find($id);
|
||||
if ($heroDb) {
|
||||
$heroDto = Hero::toDto($heroDb);
|
||||
$cegNum += Hero::calcPveGainGold($heroDto, $count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $cegNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user