1
This commit is contained in:
parent
9a64598a45
commit
068334f9a0
@ -339,10 +339,7 @@ class Gun extends BaseModel {
|
|||||||
if ($count <= 0) {
|
if ($count <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$newGold = min($gunDto['pve_ceg_uplimit'],
|
$finalyAddGold = self::calcPveGainGold($gunDto, $count);
|
||||||
$gunDto['today_pve_get_ceg'] +
|
|
||||||
round($gunDto['pve_ceg_uplimit'] / $count));
|
|
||||||
$finalyAddGold = max(0, $newGold - $gunDto['today_pve_get_ceg']);
|
|
||||||
if ($finalyAddGold > 0) {
|
if ($finalyAddGold > 0) {
|
||||||
self::update($gunDto['gun_uniid'],
|
self::update($gunDto['gun_uniid'],
|
||||||
array(
|
array(
|
||||||
@ -353,4 +350,16 @@ class Gun extends BaseModel {
|
|||||||
return $finalyAddGold;
|
return $finalyAddGold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function calcPveGainGold($gunDto, $count)
|
||||||
|
{
|
||||||
|
if ($count <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$newGold = min($gunDto['pve_ceg_uplimit'],
|
||||||
|
$gunDto['today_pve_get_ceg'] +
|
||||||
|
round($gunDto['pve_ceg_uplimit'] / $count));
|
||||||
|
$finalyAddGold = max(0, $newGold - $gunDto['today_pve_get_ceg']);
|
||||||
|
return $finalyAddGold;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -380,10 +380,7 @@ class Hero extends BaseModel {
|
|||||||
if ($count <= 0) {
|
if ($count <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$newGold = min($heroDto['pve_ceg_uplimit'],
|
$finalyAddGold = self::calcPveGainGold($gunDto, $count);
|
||||||
$heroDto['today_pve_get_ceg'] +
|
|
||||||
round($heroDto['pve_ceg_uplimit'] / $count));
|
|
||||||
$finalyAddGold = max(0, $newGold - $heroDto['today_pve_get_ceg']);
|
|
||||||
if ($finalyAddGold > 0) {
|
if ($finalyAddGold > 0) {
|
||||||
self::update($heroDto['hero_uniid'],
|
self::update($heroDto['hero_uniid'],
|
||||||
array(
|
array(
|
||||||
@ -394,4 +391,16 @@ class Hero extends BaseModel {
|
|||||||
return $finalyAddGold;
|
return $finalyAddGold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function calcPveGainGold($gunDto, $count)
|
||||||
|
{
|
||||||
|
if ($count <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$newGold = min($gunDto['pve_ceg_uplimit'],
|
||||||
|
$gunDto['today_pve_get_ceg'] +
|
||||||
|
round($gunDto['pve_ceg_uplimit'] / $count));
|
||||||
|
$finalyAddGold = max(0, $newGold - $gunDto['today_pve_get_ceg']);
|
||||||
|
return $finalyAddGold;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -760,8 +760,41 @@ class MissionService extends BaseService {
|
|||||||
myself()->_rspErr(1, 'mission_id parameter error');
|
myself()->_rspErr(1, 'mission_id parameter error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$count = $this->getOfferRewardMissionCount();
|
||||||
|
$cegNum = 0;
|
||||||
|
$objects = explode('|', getReqVal('objects', 0));
|
||||||
|
foreach ($objects as $val) {
|
||||||
|
$strings = explode(':', $val);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
myself()->_rspData(array(
|
myself()->_rspData(array(
|
||||||
'ceg_num' => 0
|
'ceg_num' => $cegNum
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user