From fb7c67f317f5949e50f0ea0436cc3eab90d981d2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 18 Aug 2019 18:01:11 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=99=EC=9D=98=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95,=20?= =?UTF-8?q?=EA=B0=80=EC=9E=85/=EB=B9=99=EC=9D=98=20=EC=8B=9C=20=EB=9D=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_select_npc.php | 25 ++++++++++++++++--------- hwe/join_post.php | 2 +- js/entrance.js | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/hwe/j_select_npc.php b/hwe/j_select_npc.php index edb0e66b..819f3547 100644 --- a/hwe/j_select_npc.php +++ b/hwe/j_select_npc.php @@ -22,6 +22,13 @@ $rootDB = RootDB::db(); $oNow = new \DateTimeImmutable(); $now = $oNow->format('Y-m-d H:i:s'); +list( + $year, + $month, + $maxgeneral, + $npcmode +) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode']); + $userNick = RootDB::db()->queryFirstField('SELECT `NAME` FROM member WHERE `NO`=%i',$userID); if(!$userNick){ Json::die([ @@ -30,6 +37,8 @@ if(!$userNick){ ]); } +$db->query("lock tables general write, select_npc_token write"); + $pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now); if(!$pickResult){ Json::die([ @@ -38,7 +47,6 @@ if(!$pickResult){ ]); } - $pickResult = Json::decode($pickResult); if(!key_exists($pick, $pickResult)){ Json::die([ @@ -50,14 +58,9 @@ $pickedNPC = $pickResult[$pick]; $gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'); -list( - $year, - $month, - $maxgeneral, - $npcmode -) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode']); if(!$npcmode){ + $db->query("unlock tables"); Json::die([ 'result'=>false, 'reason'=>'빙의 가능한 서버가 아닙니다' @@ -65,13 +68,14 @@ if(!$npcmode){ } if ($gencount >= $maxgeneral) { + $db->query("unlock tables"); Json::die([ 'result'=>false, 'reason'=>'더 이상 등록 할 수 없습니다.' ]); } -$db->query("lock tables plock write"); + //등록 시작 $db->update('general', [ @@ -83,9 +87,10 @@ $db->update('general', [ 'owner'=>$userID, ], 'owner <= 0 AND npc = 2 AND no = %i', $pick); -$db->query("unlock tables"); + if(!$db->affectedRows()){ + $db->query("unlock tables"); Json::die([ 'result'=>false, 'reason'=>'장수 등록에 실패했습니다.' @@ -94,6 +99,8 @@ if(!$db->affectedRows()){ $db->delete('select_npc_token', 'owner=%i or valid_until < %s', $userID, $now); +$db->query("unlock tables"); + $josaYi = JosaUtil::pick($userNick, '이'); pushGeneralHistory($pickedNPC, "●{$year}년 {$month}월:{$pickedNPC['name']}의 육체에 {$userNick}{$josaYi} 빙의되다."); //pushGenLog($me, $mylog); diff --git a/hwe/join_post.php b/hwe/join_post.php index 507e0d4e..20420676 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -71,7 +71,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor->cacheValues(['year','month','maxgeneral','scenario','show_img_level','turnterm','turntime','genius','npcmode']); ########## 동일 정보 존재여부 확인. ########## -$db->query("lock tables plock write"); +$db->query("lock tables general write, city read, storage read"); $gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'); $oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID); diff --git a/js/entrance.js b/js/entrance.js index 4608fbff..0657302d 100644 --- a/js/entrance.js +++ b/js/entrance.js @@ -149,7 +149,7 @@ function Entrance_drawServerList(serverInfos){ TemplateEngine(serverFullTemplate, {}) ); } - else if(game.npcMode == '가눙'){ + else if(game.npcMode == '가능'){ $serverHtml.append( TemplateEngine(serverCreateAndSelectTemplate, {serverPath:serverPath}) ).addClass('server_create_and_select');