접속장수 수 위치 이동

This commit is contained in:
2020-05-06 02:25:58 +09:00
parent a2823b3c29
commit f13cfd190e
3 changed files with 13 additions and 9 deletions
+6 -7
View File
@@ -862,18 +862,17 @@ function getOnlineNum()
return KVStorage::getStorage(DB::db(), 'game_env')->online;
}
function onlinegen()
function onlinegen(General $general)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$onlinegen = "";
$generalID = Session::getInstance()->generalID;
$nationID = DB::db()->queryFirstField('select `nation` from `general` where `no` = %i', $generalID);
$nationID = $general->getNationID();
if ($nationID === null || Util::toInt($nationID) === 0) {
$onlinegen = $gameStor->onlinegen;
} else {
$onlinegen = DB::db()->queryFirstField('select onlinegen from nation where nation=%i', $nationID);
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$onlinegen = $nationStor->onlinegen;
}
return $onlinegen;
}
@@ -1228,8 +1227,8 @@ function updateOnline()
if ($key == 0) {
$gameStor->onlinegen = $onnation[0];
} else {
$query = "update nation set onlinegen='$onnation[$key]' where nation='$key'";
MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$nationStor = KVStorage::getStorage($db, $key, 'nation_env');
$nationStor->onlinegen = $onnation[$key];
}
}
}
+7 -1
View File
@@ -58,6 +58,12 @@ $generalObj = General::createGeneralObjFromDB($me['no']);
$generalObj->setRawCity($db->queryFirstRow('SELECT * FROM city WHERE city = %i', $generalObj->getCityID()));
$scenario = $gameStor->scenario_text;
$nationID = $generalObj->getNationID();
if($nationID){
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->cacheValues(['notice', 'onlinegne']);
}
$valid = 0;
if ($gameStor->extended_general == 0) {
$extend = "표준";
@@ -209,7 +215,7 @@ echo "
<tr><td colspan=5 style="text-align:left;">접속중인 국가: <?=$gameStor->onlinenation?></td></tr>
<tr><td colspan=5 style="text-align:left;">운영자 메세지 : <span style='color:yellow;'><?=$gameStor->msg?></span></td></tr>
<tr><td colspan=5 style="text-align:left;"><div>【 국가방침 】</div><div><?=nationMsg($generalObj)?></div></td></tr>
<tr><td colspan=5 style="text-align:left;">【 접속자 】<?=onlinegen()?></td></tr>
<tr><td colspan=5 style="text-align:left;">【 접속자 】<?=onlinegen($generalObj)?></td></tr>
<?php
if ($session->userGrade >= 5) {
?>
-1
View File
@@ -116,7 +116,6 @@ CREATE TABLE `nation` (
`nation` INT(6) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(64) NOT NULL COLLATE 'utf8mb4_bin',
`color` CHAR(10) NOT NULL,
`onlinegen` TEXT NULL DEFAULT '',
`capital` INT(1) NULL DEFAULT '0',
`capset` INT(6) NULL DEFAULT '0',
`gennum` INT(3) NULL DEFAULT '1',