This commit is contained in:
aozhiwei 2021-12-02 16:16:10 +08:00
parent ebcef6e4da
commit d5977c23fc
2 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,13 @@ class UserController extends BaseAuthedController {
private function loginCheck($userInfo)
{
$rankMeta = mt\Rank::get(1);
if ($rankMeta && $userInfo['rank'] < $rankMeta['rank']) {
$this->updateUserInfo(array(
'rank' => $rankMeta['rank'],
'score' => $rankMeta['min_score'],
));
}
return true;
}
@ -67,7 +74,7 @@ class UserController extends BaseAuthedController {
'head_frame' => 19003,
'level' => 100,
'exp' => 0,
'rank' => $rankMeta ? $rankMeta['id'] : 0,
'rank' => $rankMeta ? $rankMeta['rank'] : 0,
'score' => $rankMeta ? $rankMeta['min_score'] : 0,
'head_id' => 18001,
'hero_id' => 30100,

View File

@ -14,6 +14,8 @@ class User extends BaseModel {
'head_frame' => $row['head_frame'],
'level' => $row['level'],
'exp' => $row['exp'],
'rank' => $row['rank'],
'score' => $row['score'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'hero_id' => $row['hero_id'],
@ -31,6 +33,8 @@ class User extends BaseModel {
'head_frame' => $row['head_frame'],
'level' => $row['level'],
'exp' => $row['exp'],
'rank' => $row['rank'],
'score' => $row['score'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'hero_id' => $row['hero_id'],