diff --git a/hwe/func.php b/hwe/func.php index d80e03e7..0850103c 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -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]; } } } diff --git a/hwe/index.php b/hwe/index.php index 057608d6..16152488 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -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 " 접속중인 국가: onlinenation?> 운영자 메세지 : msg?>
【 국가방침 】
- 【 접속자 】 + 【 접속자 】 userGrade >= 5) { ?> diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 66cde77f..a988cc8b 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -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',