1
This commit is contained in:
parent
cda80ff04a
commit
b90e48824f
@ -332,15 +332,4 @@ class BaseAuthedController extends BaseController {
|
||||
DynData::decV($x, $y, $decVal);
|
||||
}
|
||||
|
||||
public function _checkSeason($userInfo, $initRankMeta, $currSeasonMeta)
|
||||
{
|
||||
#$rankMeta = mt\Rank::get(1);
|
||||
if ($initRankMeta && $userInfo['rank'] < $initRankMeta['rank']) {
|
||||
$this->_updateUserInfo(array(
|
||||
'rank' => $initRankMeta['rank'],
|
||||
'score' => $initRrankMeta['min_score'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,4 +17,8 @@ class SeasonController extends BaseAuthedController {
|
||||
{
|
||||
}
|
||||
|
||||
private function precheck($userInfo)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,15 +5,12 @@ require_once('models/Hero.php');
|
||||
|
||||
require_once('mt/Parameter.php');
|
||||
require_once('mt/Drop.php');
|
||||
require_once('mt/EquipUpgrade.php');
|
||||
require_once('mt/Season.php');
|
||||
require_once('mt/SeasonPoint.php');
|
||||
require_once('mt/RankReward.php');
|
||||
require_once('mt/Equip.php');
|
||||
require_once('mt/Hero.php');
|
||||
require_once('mt/Rank.php');
|
||||
|
||||
require_once('services/PropertyChgService.php');
|
||||
require_once('services/SeasonService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
@ -43,15 +40,14 @@ class UserController extends BaseAuthedController {
|
||||
|
||||
private function loginCheck($userInfo)
|
||||
{
|
||||
if (!$this->_checkSeason()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
$seasonService = new services\SeasonService();
|
||||
return $seasonService->checkSeason($userInfo);
|
||||
}
|
||||
|
||||
private function createNewUser($userName, $avatarUrl)
|
||||
{
|
||||
$rankMeta = mt\Rank::get(1);
|
||||
$initRankMeta = mt\Rank::getInitRank();
|
||||
$currSeasonMeta = mt\Season::getCurrentSeason();
|
||||
SqlHelper::upsert
|
||||
($this->_getSelfMysql(),
|
||||
't_user',
|
||||
@ -70,10 +66,11 @@ class UserController extends BaseAuthedController {
|
||||
'head_frame' => 19003,
|
||||
'level' => 100,
|
||||
'exp' => 0,
|
||||
'rank' => $rankMeta ? $rankMeta['rank'] : 0,
|
||||
'score' => $rankMeta ? $rankMeta['min_score'] : 0,
|
||||
'rank' => $initRankMeta ? $initRankMeta['rank'] : 0,
|
||||
'score' => $initRankMeta ? $initRankMeta['min_score'] : 0,
|
||||
'head_id' => 18001,
|
||||
'hero_id' => 30100,
|
||||
'last_season_id' => $currSeasonMeta ? $currSeasonMeta['id'] : 0,
|
||||
'createtime' => $this->_getNowTime(),
|
||||
'modifytime' => $this->_getNowTime(),
|
||||
)
|
||||
|
@ -11,6 +11,11 @@ class Rank {
|
||||
return getXVal(self::getMetaList(), $id);
|
||||
}
|
||||
|
||||
public static function getInitRank()
|
||||
{
|
||||
return self::get(1);
|
||||
}
|
||||
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$metaList) {
|
||||
|
38
webapp/services/SeasonService.php
Normal file
38
webapp/services/SeasonService.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace services;
|
||||
|
||||
require_once('mt/Rank.php');
|
||||
require_once('mt/Season.php');
|
||||
require_once('models/User.php');
|
||||
|
||||
use models\User;
|
||||
|
||||
class SeasonService extends BaseService {
|
||||
|
||||
public function checkSeason($userInfo)
|
||||
{
|
||||
$initRankMeta = mt\Rank::getInitRank();
|
||||
$currRankMeta = mt\Rank::get($userInfo['rank']);
|
||||
$dropRankMeta = mt\Rank::get($currRankMeta ? $currRankMeta['drop_rank'] : 0);
|
||||
$currSeasonMeta = mt\Season::getCurrentSeason();
|
||||
if ($currSeasonMeta && $currSeasonMeta['id'] != $userInfo['last_season_id']) {
|
||||
//掉档
|
||||
if ($dropRankMeta) {
|
||||
myself()->_updateUserInfo(array(
|
||||
'rank' => $dropRankMeta['rank'],
|
||||
'score' => $dropRankMeta['min_score'],
|
||||
));
|
||||
}
|
||||
}
|
||||
if ($initRankMeta && $userInfo['rank'] < $initRankMeta['rank']) {
|
||||
myself()->_updateUserInfo(array(
|
||||
'rank' => $initRankMeta['rank'],
|
||||
'score' => $initRankMeta['min_score'],
|
||||
));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user