서버 예약 오픈을 UI에 통합
This commit is contained in:
+4
-1
@@ -51,14 +51,17 @@ $reserve_open = Util::getReq('reserve_open');
|
||||
if($reserve_open){
|
||||
$reserve_open = new \DateTime($reserve_open);
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
ResetHelper::clearDB();
|
||||
|
||||
$scenarioObj = new Scenario($scenario, true);
|
||||
$db->delete('reserved_open', true);
|
||||
$db->insert('reserved_open', [
|
||||
'options'=>Json::encode([
|
||||
'turnterm'=>$turnterm,
|
||||
'sync'=>$sync,
|
||||
'scenario'=>$scenario,
|
||||
'scenarioName'=>$scenarioObj->getTitle(),
|
||||
'fiction'=>$fiction,
|
||||
'extend'=>$extend,
|
||||
'npcmode'=>$npcmode,
|
||||
|
||||
@@ -4,15 +4,49 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
|
||||
$session = Session::requireLogin([
|
||||
'game'=>'x',
|
||||
'game'=>null,
|
||||
'me'=>null
|
||||
])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
if(!class_exists('\\sammo\\DB')){
|
||||
Json::die([
|
||||
'game'=>null,
|
||||
'me'=>null
|
||||
]);
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$game = $db->queryFirstRow('SELECT isUnited, npcMode, year, month, scenario, scenario_text, maxgeneral as maxUserCnt, turnTerm from game where `no`=1');
|
||||
|
||||
if(!$game){
|
||||
$reserved = $db->queryFirstRow(
|
||||
'SELECT * FROM reserved_open ORDER BY `date` ASC LIMIT 1'
|
||||
);
|
||||
if(!$reserved){
|
||||
Json::die([
|
||||
'game'=>null,
|
||||
'me'=>null
|
||||
]);
|
||||
}
|
||||
|
||||
$options = Json::decode($reserved['options']);
|
||||
|
||||
Json::die([
|
||||
'reserved'=>[
|
||||
'scenarioName'=>$options['scenarioName'],
|
||||
'turnterm'=>$options['turnterm'],
|
||||
'fictionMode'=>($options['fiction']?'연의':'가상'),
|
||||
'npcMode'=>($options['npcmode']?'가능':'불가'),
|
||||
'openDatetime'=>$reserved['date']
|
||||
],
|
||||
'game'=>null,
|
||||
'me'=>null
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$nationCnt = $db->queryFirstField('SELECT count(`nation`) from nation where `level` > 0');
|
||||
$genCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` < 2');
|
||||
$npcCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` >= 2');
|
||||
|
||||
+13
-1
@@ -643,4 +643,16 @@ CREATE TABLE `general_public_record` (
|
||||
)
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
ENGINE=InnoDB
|
||||
;
|
||||
;
|
||||
|
||||
######
|
||||
# 예약 오픈 테이블
|
||||
CREATE TABLE `reserved_open` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`options` TEXT NULL DEFAULT NULL,
|
||||
`date` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `date` (`date`)
|
||||
)
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
ENGINE=MyISAM;
|
||||
|
||||
Reference in New Issue
Block a user