每日任务
This commit is contained in:
parent
1c8f6dc18a
commit
10f0c55f33
@ -274,7 +274,7 @@ class BaseAuthedController extends BaseController {
|
||||
break;
|
||||
case V_ITEM_ACTIVE:
|
||||
{
|
||||
return;
|
||||
|
||||
$addItem = max(0, mt\Parameter::getVal('activeness_limit', 0) - $this->_getDailyV(TN_DAILY_ACTIVE, 0));
|
||||
$addItem = min($addItem, $itemNum);
|
||||
if ($addItem > 0) {
|
||||
@ -302,6 +302,9 @@ class BaseAuthedController extends BaseController {
|
||||
$this->_updateUserInfo(array(
|
||||
'gold' => function () use($itemNum) {
|
||||
return "GREATEST(0, gold - ${itemNum})";
|
||||
},
|
||||
'consume_gold' => function () use ($itemNum){
|
||||
return "consume_gold + ${itemNum}";
|
||||
}
|
||||
));
|
||||
}
|
||||
|
@ -111,6 +111,10 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
$this->_rspData($data);
|
||||
}
|
||||
public function test(){
|
||||
$a = myself()->_getDailyV(TN_DAILY_ACTIVE, 0);
|
||||
print_r($a);
|
||||
}
|
||||
|
||||
/*
|
||||
http post
|
||||
@ -220,7 +224,7 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
}
|
||||
array_push($data['members'], $info);
|
||||
array_push($data['members'], $info);error_log("PresetInfo---".json_encode($data));
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
|
@ -41,22 +41,22 @@ class MissionController extends BaseAuthedController {
|
||||
{
|
||||
parent::_handlePre();
|
||||
DynData::preload();
|
||||
// $this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
$this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
// if (!$this->currRankSeasonMeta) {
|
||||
// $this->_rspErr(10, 'server internal error');
|
||||
// die();
|
||||
// }
|
||||
$this->propertyChgService = new services\PropertyChgService();
|
||||
$this->userInfo = $this->_safeGetOrmUserInfo();
|
||||
// $this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
|
||||
// if (!$this->seasonDb) {
|
||||
// Season::add($this->currRankSeasonMeta['id']);
|
||||
// $this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
|
||||
// }
|
||||
// if (!$this->seasonDb) {
|
||||
// $this->_rspErr(10, 'server internal error');
|
||||
// die();
|
||||
// }
|
||||
$this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
|
||||
if (!$this->seasonDb) {
|
||||
Season::add($this->currRankSeasonMeta['id']);
|
||||
$this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
|
||||
}
|
||||
if (!$this->seasonDb) {
|
||||
$this->_rspErr(10, 'server internal error');
|
||||
die();
|
||||
}
|
||||
$this->awardService = new services\AwardService();
|
||||
$this->missionService = new services\MissionService();
|
||||
$this->missionService->init($this->userInfo, $this->seasonDb);
|
||||
@ -103,6 +103,8 @@ class MissionController extends BaseAuthedController {
|
||||
$this->_rspData(array(
|
||||
'current_active_value' => min($this->_getV(TN_ACTIVE, 0), mt\Parameter::getVal('max_activity', 0)),
|
||||
'max_active_value' => mt\Parameter::getVal('max_activity', 0),
|
||||
'day_active_limit' => mt\Parameter::getVal('activeness_limit', 0),
|
||||
'week_active_limit' => mt\Parameter::getVal('max_weekly', 0),
|
||||
'mission_list1' => $missionDtoList1,
|
||||
'mission_list2' => $missionDtoList2
|
||||
));
|
||||
|
@ -236,10 +236,14 @@ class BattleDataService extends BaseService {
|
||||
//单人模式最高排名
|
||||
$this->minValue($battleData, 'single_battle_rank', getReqVal('ranked', 0));
|
||||
} else {
|
||||
//组队模式战斗次数
|
||||
$this->minValue($battleData, 'team_battle_rank', getReqVal('ranked', 0));
|
||||
//组队模式最高排名
|
||||
$this->minValue($battleData, 'team_battle_rank', getReqVal('ranked', 0));
|
||||
//组队模式战斗次数
|
||||
$this->incValue($battleData, 'total_team_battle_times', 1);
|
||||
//组队模式前30名次数
|
||||
if (getReqVal('ranked', 0) <= 30){
|
||||
$this->incValue($battleData, 'total_team_top_X_battle_times', 1);
|
||||
}
|
||||
}
|
||||
$ranked = getReqVal('ranked', 0);
|
||||
if ($ranked == 1) {
|
||||
|
@ -57,39 +57,40 @@ class MissionService extends BaseService {
|
||||
public function init($userInfo, $seasonDb)
|
||||
{
|
||||
$this->userInfo = $userInfo;
|
||||
// $this->seasonDb = $seasonDb;
|
||||
$this->seasonDb = $seasonDb;
|
||||
$this->hisBattleData = Battle::getMyBattleData();
|
||||
// $seasonBattleData = json_decode($this->seasonDb['battle_data'], true);
|
||||
// if (!isset($seasonBattleData)) {
|
||||
// $seasonBattleData = array();
|
||||
// }
|
||||
// $this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array());
|
||||
// $this->thisWeekBattleData = getXVal($seasonBattleData, 'this_week_data', array());
|
||||
// $this->todayBattleData = getXVal($seasonBattleData, 'today_data', array());
|
||||
// if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) <
|
||||
// myself()->_getNowDaySeconds()) {
|
||||
// $this->todayBattleData = array(
|
||||
// 'createtime' => myself()->_getNowTime(),
|
||||
// 'modifytime' => myself()->_getNowTime(),
|
||||
// );
|
||||
// }
|
||||
// if (myself()->_getDaySeconds(getXVal($this->thisWeekBattleData, 'modifytime', 0)) <
|
||||
// myself()->_getMondaySeconds()) {
|
||||
// $this->thisWeekBattleData = array(
|
||||
// 'createtime' => myself()->_getNowTime(),
|
||||
// 'modifytime' => myself()->_getNowTime(),
|
||||
// );
|
||||
// }
|
||||
$this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE);
|
||||
if (!$this->offerRewartdMission) {
|
||||
$this->offerRewartdMission = array(
|
||||
'missions' => array(),
|
||||
'refreshtime' => 0
|
||||
$seasonBattleData = json_decode($this->seasonDb['battle_data'], true);
|
||||
if (!isset($seasonBattleData)) {
|
||||
$seasonBattleData = array();
|
||||
}
|
||||
$this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array());
|
||||
$this->thisWeekBattleData = getXVal($seasonBattleData, 'this_week_data', array());
|
||||
$this->todayBattleData = getXVal($seasonBattleData, 'today_data', array());
|
||||
if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) <
|
||||
myself()->_getNowDaySeconds()) {
|
||||
$this->todayBattleData = array(
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
);
|
||||
}
|
||||
if (myself()->_getNowTime() - $this->offerRewartdMission['refreshtime'] >= 86400){
|
||||
$this->refreshOfferRewardMission();
|
||||
if (myself()->_getDaySeconds(getXVal($this->thisWeekBattleData, 'modifytime', 0)) <
|
||||
myself()->_getMondaySeconds()) {
|
||||
$this->thisWeekBattleData = array(
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
);
|
||||
}
|
||||
|
||||
// $this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE);
|
||||
// if (!$this->offerRewartdMission) {
|
||||
// $this->offerRewartdMission = array(
|
||||
// 'missions' => array(),
|
||||
// 'refreshtime' => 0
|
||||
// );
|
||||
// }
|
||||
// if (myself()->_getNowTime() - $this->offerRewartdMission['refreshtime'] >= 86400){
|
||||
// $this->refreshOfferRewardMission();
|
||||
// }
|
||||
}
|
||||
|
||||
public function getMissionDto($userInfo, $seasonDb, $missionDb, $missionMeta)
|
||||
@ -101,11 +102,11 @@ class MissionService extends BaseService {
|
||||
'state' => Mission::NOT_FINISHED_STATE,
|
||||
'objects' => array(),
|
||||
'lefttime' => 0,
|
||||
'ceg_num' => 0,
|
||||
"awards" => array(
|
||||
V_ITEM_GOLD,
|
||||
mt\Drop::get($missionMeta['reward'])?mt\Drop::get($missionMeta['reward'])['item_id']:0
|
||||
)
|
||||
// 'ceg_num' => 0,
|
||||
// "awards" => array(
|
||||
// V_ITEM_GOLD,
|
||||
// mt\Drop::get($missionMeta['reward'])?mt\Drop::get($missionMeta['reward'])['item_id']:0
|
||||
// )
|
||||
);
|
||||
if ($missionDb) {
|
||||
if ($missionMeta['type'] == mt\Task::DAILY_MISSON_TYPE) {
|
||||
@ -175,9 +176,9 @@ class MissionService extends BaseService {
|
||||
break;
|
||||
case mt\Task::TEAM_BATTLE_RANK_COND:
|
||||
{
|
||||
//组队比赛排名前X
|
||||
//组队比赛排名前X次数
|
||||
$missionDto['current'] = $this->getBattleData($missionDb, $missionMeta,
|
||||
'team_battle_rank');
|
||||
'total_team_top_X_battle_times');
|
||||
}
|
||||
break;
|
||||
case mt\Task::TOTAL_KILL_NUM_COND:
|
||||
@ -448,6 +449,9 @@ class MissionService extends BaseService {
|
||||
$val = 0;
|
||||
$battleData = $this->internalGetBattleData($missionMeta);
|
||||
$val = getXVal($battleData, $key, 0);
|
||||
if ($key == 'total_alive_time'){
|
||||
$val = $val/1000/60;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user