1
This commit is contained in:
parent
9998bc999f
commit
4514407efc
@ -25,7 +25,6 @@ use models\Gun;
|
||||
offer.reward.missions
|
||||
{
|
||||
"refreshtime": 0,
|
||||
"count": 0,
|
||||
"missions": [
|
||||
{
|
||||
"mission_id": 100,
|
||||
@ -84,12 +83,7 @@ class MissionService extends BaseService {
|
||||
'missions' => array()
|
||||
);
|
||||
}
|
||||
{
|
||||
$refreshTime = getXVal($this->offerRewartdMission, 'refreshtime');
|
||||
if (myself()->_getNowDaySeconds() > $refreshTime) {
|
||||
$this->refreshOfferRewardMission();
|
||||
}
|
||||
}
|
||||
$this->refreshOfferRewardMission();
|
||||
}
|
||||
|
||||
public function getMissionDto($userInfo, $seasonDb, $missionDb, $missionMeta)
|
||||
@ -558,25 +552,26 @@ class MissionService extends BaseService {
|
||||
|
||||
private function refreshOfferRewardMission()
|
||||
{
|
||||
$this->offerRewartdMission['refreshtime'] = myself()->_getNowTime();
|
||||
$sentMissions = array();
|
||||
foreach ($this->offerRewartdMission['missions'] as $mission) {
|
||||
if ($mission['sendtime'] > 0) {
|
||||
array_push($sentMissions, $mission);
|
||||
}
|
||||
$wantedRefreshMissionNum = mt\Parameter::getVal
|
||||
('wanted_refresh_mission_num', 0);
|
||||
if ($wantedRefreshMissionNum <=
|
||||
count($this->offerRewartdMission['missions'])) {
|
||||
return;
|
||||
}
|
||||
if (empty($this->offerRewartdMission['missions'])) {
|
||||
$this->offerRewartdMission['missions'] = array();
|
||||
$metas = mt\Task::getOfferRewardMissions
|
||||
($this->offerRewartdMission['missions']);
|
||||
if (count($metas) < $wantedRefreshMissionNum) {
|
||||
return;
|
||||
}
|
||||
$metas = mt\Task::getOfferRewardMissions($this->offerRewartdMission['missions']);
|
||||
$num = min(count($metas), mt\Parameter::getVal('wanted_refresh_mission_num', 0));
|
||||
if ($num > 0) {
|
||||
$selectKeys = array_rand($metas, $num);
|
||||
if (!is_array($selectKeys)) {
|
||||
$selectKeys = array($selectKeys);
|
||||
|
||||
foreach (array_rand($metas, count($metas)) as $key) {
|
||||
if (count($this->offerRewartdMission['missions']) >=
|
||||
$wantedRefreshMissionNum) {
|
||||
break;
|
||||
}
|
||||
foreach ($selectKeys as $key) {
|
||||
$meta = $metas[$key];
|
||||
$meta = $metas[$key];
|
||||
$found = false;
|
||||
if (!$found) {
|
||||
array_push($this->offerRewartdMission['missions'],
|
||||
array(
|
||||
'mission_id' => $meta['id'],
|
||||
@ -587,7 +582,7 @@ class MissionService extends BaseService {
|
||||
));
|
||||
}
|
||||
}
|
||||
$this->offerRewartdMission['count'] = $num;
|
||||
$this->offerRewartdMission['refreshtime'] = myself()->_getNowTime();
|
||||
$this->saveOfferRewardMission();
|
||||
}
|
||||
|
||||
@ -877,8 +872,8 @@ class MissionService extends BaseService {
|
||||
|
||||
public function getOfferRewardMissionCount()
|
||||
{
|
||||
$count = getXVal($this->offerRewartdMission, 'count');
|
||||
return $count;
|
||||
$missions = getXVal($this->offerRewartdMission, 'missions', array());
|
||||
return count($missions);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user