forked from devsam/core
장수 생성시 빠르게 쿼리를 날려 중복 생성하는 것이 불가능하도록
This commit is contained in:
@@ -71,6 +71,8 @@ if ($gencount >= $maxgeneral) {
|
||||
]);
|
||||
}
|
||||
|
||||
$db->query("lock tables plock write");
|
||||
|
||||
//등록 시작
|
||||
$db->update('general', [
|
||||
'name2'=>$userNick,
|
||||
@@ -81,6 +83,8 @@ $db->update('general', [
|
||||
'owner'=>$userID,
|
||||
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
|
||||
|
||||
$db->query("unlock tables");
|
||||
|
||||
if(!$db->affectedRows()){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -71,6 +71,8 @@ $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");
|
||||
|
||||
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
|
||||
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
|
||||
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name);
|
||||
@@ -80,6 +82,7 @@ if ($oldGeneral) {
|
||||
window.alert('이미 등록하셨습니다!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
if ($oldName) {
|
||||
@@ -87,6 +90,7 @@ if ($oldName) {
|
||||
window.alert('이미 있는 장수입니다. 다른 이름으로 등록해 주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
if ($gameStor->maxgeneral <= $gencount) {
|
||||
@@ -94,6 +98,7 @@ if ($gameStor->maxgeneral <= $gencount) {
|
||||
window.alert('더이상 등록할 수 없습니다!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
if (mb_strlen($name) < 1) {
|
||||
@@ -101,6 +106,7 @@ if (mb_strlen($name) < 1) {
|
||||
window.alert('이름이 짧습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
if (mb_strlen($name) > 9) {
|
||||
@@ -108,6 +114,7 @@ if (mb_strlen($name) > 9) {
|
||||
window.alert('이름이 유효하지 않습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
if ($leader + $power + $intel > GameConst::$defaultStatTotal) {
|
||||
@@ -115,6 +122,7 @@ if ($leader + $power + $intel > GameConst::$defaultStatTotal) {
|
||||
window.alert('능력치가 ".GameConst::$defaultStatTotal."을 넘어섰습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
$db->query("unlock tables");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -247,6 +255,8 @@ $db->insert('general', [
|
||||
]);
|
||||
$generalID = $db->insertId();
|
||||
|
||||
$db->query("unlock tables");
|
||||
|
||||
$cityname = CityConst::byID($city)->name;
|
||||
|
||||
$me = [
|
||||
|
||||
Reference in New Issue
Block a user