1
This commit is contained in:
parent
7345245249
commit
0e63848930
@ -11,54 +11,42 @@ require_once('mt/SeasonPoint.php');
|
||||
|
||||
class PassController extends BaseAuthedController {
|
||||
|
||||
|
||||
public function getPassInfo()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
$conn = $this->getMysql($account_id);
|
||||
$season = mt\Season::getNowSeason();
|
||||
$number = mt\Season::getNowSeasonNum();
|
||||
if ($number == 0) {
|
||||
$this->rspErr(ERR_USER_BASE + 2, '赛季未开启');
|
||||
return;
|
||||
}
|
||||
//判断当前赛季
|
||||
$number = 0;
|
||||
$open_time = 0;
|
||||
$end_time = 0;
|
||||
$sea_reward = array();
|
||||
$sea_reward2 = array();
|
||||
$rank_status = 0;
|
||||
$season = metatable\getNowSeason();
|
||||
$number = metatable\getNowSeasonNum();
|
||||
$open_time = strtotime($season['time1']);
|
||||
$end_time = strtotime($season['time2']);
|
||||
$item_multiply = $this->getExplode($season['season_reward']);
|
||||
$item_multiply2 = $this->getExplode($season['season_reward2']);
|
||||
for($ii = 1; $ii <= count($item_multiply); $ii++) {
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
));
|
||||
$rank_status = 0;
|
||||
$rank_status2 = 0;
|
||||
if (!$rowpass) {
|
||||
$ret = $conn->execScript('INSERT INTO passinfo(accountid, passid, active_status, honor_status, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'passinfo',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
':create_time' => phpcommon\getNowTime(),
|
||||
':modify_time' => phpcommon\getNowTime()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rank_status = 0;
|
||||
$rank_status2 = 0;
|
||||
} else {
|
||||
$rank_status = $rowpass['active_status'];
|
||||
$rank_status2 = $rowpass['honor_status'];
|
||||
}
|
||||
|
||||
'accountid' => $this->getAccountId(),
|
||||
'passid' => $ii,
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'passid' => $ii,
|
||||
'active_status' => 0,
|
||||
'honor_status' => 0,
|
||||
'create_time' => $this->getNowTime(),
|
||||
'modify_time' => $this->getNowTime()
|
||||
)
|
||||
);
|
||||
$key = $ii - 1;
|
||||
array_push($sea_reward, array(
|
||||
'item_id' => $item_multiply[$key][0],
|
||||
@ -77,10 +65,6 @@ class PassController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
if ($number == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '赛季未开启');
|
||||
return;
|
||||
}
|
||||
//当前段位及积分
|
||||
$rank = 0;
|
||||
$rank_score = 0;
|
||||
@ -159,8 +143,8 @@ class PassController extends BaseAuthedController {
|
||||
'errmsg'=> '',
|
||||
'pass_status' => $row['pass_status'],
|
||||
'season' => $number,
|
||||
'open_time' => $open_time,
|
||||
'end_time' => $end_time,
|
||||
'open_time' => strtotime($season['time1']),
|
||||
'end_time' => strtotime($season['time2']),
|
||||
'rank' => $rank,
|
||||
'rank_score' => $rank_score,
|
||||
'max_rank_score' => $max_rank_score,
|
||||
@ -175,7 +159,6 @@ class PassController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function getPassReward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
@ -598,4 +581,3 @@ class PassController extends BaseAuthedController {
|
||||
return $item_list;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -70,13 +70,37 @@ class Season {
|
||||
foreach (self::getMetaList() as $meta) {
|
||||
if (phpcommon\getNowTime() >= strtotime($meta['open_time']) &&
|
||||
phpcommon\getNowTime() <= strtotime($meta['end_time'])) {
|
||||
$seasonTime = strtotime($season['end_time']);
|
||||
$seasonTime = strtotime($meta['end_time']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $seasonTime;
|
||||
}
|
||||
|
||||
public static function getNowSeason()
|
||||
{
|
||||
foreach (self::getMetaList() as $meta) {
|
||||
if (phpcommon\getNowTime() >= strtotime($meta['open_time']) &&
|
||||
phpcommon\getNowTime() <= strtotime($meta['end_time'])) {
|
||||
return $meta;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getNowSeasonNum()
|
||||
{
|
||||
$i = 0;
|
||||
foreach (self::getMetaList() as $meta) {
|
||||
if (phpcommon\getNowTime() >= strtotime($meta['open_time']) &&
|
||||
phpcommon\getNowTime() <= strtotime($meta['end_time'])) {
|
||||
break;
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
|
||||
protected static $itemArr;
|
||||
protected static $metaList;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user