TimeUtil 리팩토링
This commit is contained in:
+2
-2
@@ -35,7 +35,7 @@ case "분당김":
|
||||
$starttime = (new \DateTimeImmutable($gameStor->starttime))->sub(new \DateInterval("PT{$minute}M"));
|
||||
$tnmt_time = (new \DateTimeImmutable($gameStor->tnmt_time))->sub(new \DateInterval("PT{$minute}M"));
|
||||
|
||||
$gameStor->turntime = $turntime->format('Y-m-d H:i:s');
|
||||
$gameStor->turntime = $turntime->format('Y-m-d H:i:s.u');
|
||||
$gameStor->starttime = $starttime->format('Y-m-d H:i:s');
|
||||
$gameStor->tnmt_time = $tnmt_time->format('Y-m-d H:i:s');
|
||||
|
||||
@@ -52,7 +52,7 @@ case "분지연":
|
||||
$starttime = (new \DateTimeImmutable($gameStor->starttime))->add(new \DateInterval("PT{$minute}M"));
|
||||
$tnmt_time = (new \DateTimeImmutable($gameStor->tnmt_time))->add(new \DateInterval("PT{$minute}M"));
|
||||
|
||||
$gameStor->turntime = $turntime->format('Y-m-d H:i:s');
|
||||
$gameStor->turntime = $turntime->format('Y-m-d H:i:s.u');
|
||||
$gameStor->starttime = $starttime->format('Y-m-d H:i:s');
|
||||
$gameStor->tnmt_time = $tnmt_time->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
@@ -93,16 +93,18 @@ switch ($btn) {
|
||||
for ($i=0; $i < $count; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
$turntime = getRandTurn($turnterm);
|
||||
$query = "update general set turntime='$turntime' where no='{$gen['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$db->update('general', [
|
||||
'turntime'=>$turntime
|
||||
], 'no=%i', $gen['no']);
|
||||
}
|
||||
// 턴시간이 너무 멀리 떨어진 선수 제대로 보정
|
||||
} else {
|
||||
$query = "select no,turntime from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$count = MYDB_num_rows($result);
|
||||
for ($i=0; $i < $count; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
$servTurnTime = new \DateTime($admin['turntime']);
|
||||
$timeUnit = new \DateInterval("T{$unit}S");
|
||||
foreach($db->query('SELECT no,turntime FROM general') as $gen){
|
||||
$genTurnTime = new \DateTime($gen['turntime']);
|
||||
$timeDiff = $genTurnTime->diff($servTurnTime);
|
||||
|
||||
$num = intdiv((strtotime($gen['turntime']) - strtotime($admin['turntime'])), $unit);
|
||||
if ($num > 0) {
|
||||
$gen['turntime'] = date("Y-m-d H:i:s", strtotime($gen['turntime']) - $unit * $num);
|
||||
|
||||
@@ -48,7 +48,7 @@ switch($btn) {
|
||||
DB::db()->query('update general set block=0 where no IN %li', $genlist);
|
||||
break;
|
||||
case "1단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db->update('general', [
|
||||
'block'=>1,
|
||||
'killturn'=>24
|
||||
@@ -60,7 +60,7 @@ switch($btn) {
|
||||
], 'id IN %li', $uid);
|
||||
break;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
@@ -74,7 +74,7 @@ switch($btn) {
|
||||
], 'id IN %li', $uid);
|
||||
break;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
@@ -93,7 +93,7 @@ switch($btn) {
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "강제 사망":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db->update('general', [
|
||||
'turn0'=>EncodeCommand(0, 0, 0, 0),
|
||||
'killturn'=>0,
|
||||
|
||||
@@ -26,7 +26,7 @@ switch($btn) {
|
||||
DB::db()->query('update general set block=0 where no IN %li', $genlist);
|
||||
break;
|
||||
case "1단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
|
||||
//FIXME: subquery로 하는게 더 빠를 듯.
|
||||
@@ -34,14 +34,14 @@ switch($btn) {
|
||||
RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
break;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=2,killturn=24 where no IN %li',$genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
break;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=3,killturn=24 where no IN %li',$genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
@@ -51,12 +51,12 @@ switch($btn) {
|
||||
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
|
||||
break;
|
||||
case "강제 사망":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
DB::db()->query('update general set turn0=%s,killturn=0,turntime=%s where no IN %li',EncodeCommand(0, 0, 0, 0),$date, $genlist);
|
||||
break;
|
||||
case "메세지 전달":
|
||||
//TODO:새 갠메 시스템으로 변경
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$msgObj = new Message(
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ for ($i=0; $i < $dipcount; $i++) {
|
||||
case 7: $state = "<font color=green>불가침</font>"; break;
|
||||
}
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$note = "";
|
||||
if ($dip['fixed'] != "") {
|
||||
if ($dip['state'] == 7) {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ foreach($log as $i=>$value){
|
||||
}
|
||||
$year[] = $admin['year'];
|
||||
$month[] = $admin['month'];
|
||||
$date[] = date('Y-m-d H:i:s');
|
||||
$date[] = TimeUtil::now();
|
||||
|
||||
if ($admin['maxrefresh'] == 0) {
|
||||
$admin['maxrefresh'] = 1;
|
||||
|
||||
@@ -32,7 +32,7 @@ if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlim
|
||||
if($me['level'] >= 5) { $btn = "submit"; $btn2 = "button"; }
|
||||
else { $btn = "hidden"; $btn2 = "hidden"; }
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
|
||||
// 명령 목록
|
||||
$admin = $gameStor->getValues(['year','month','turnterm']);
|
||||
@@ -106,7 +106,7 @@ function turn(type) {
|
||||
<?php
|
||||
$year = $admin['year'];
|
||||
$month = $admin['month'];
|
||||
$date = substr(date('Y-m-d H:i:s'), 14);
|
||||
$date = substr(TimeUtil::now(), 14);
|
||||
|
||||
$totaldate = [];
|
||||
$turntime = [];
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ for ($i=0; $i < $nationcount; $i++) {
|
||||
$year--;
|
||||
}
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$note = "";
|
||||
if ($dip['fixed'] != "") {
|
||||
if ($dip['state'] == 7) {
|
||||
|
||||
@@ -43,7 +43,7 @@ if($num == -1 && $title != "" && $msg != "") {
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
|
||||
|
||||
@@ -38,7 +38,7 @@ if(getBlockLevel() != 1 && getBlockLevel() != 3) {
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
$query = "update nation set board{$num}='$msg',board{$num}_who='{$me['no']}',board{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set boardindex='$num' where nation='{$me['nation']}'";
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ function myCommandList() {
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
|
||||
// 명령 목록
|
||||
$admin = $gameStor->getValues(['year','month','turnterm']);
|
||||
|
||||
+69
-55
@@ -1246,7 +1246,7 @@ function increaseRefresh($type="", $cnt=1) {
|
||||
$generalID = $session->generalID;
|
||||
$userGrade = $session->userGrade;
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -1336,7 +1336,7 @@ function updateTraffic() {
|
||||
|
||||
$db->update('general', ['refresh'=>0], true);
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
//일시|년|월|총갱신|접속자|최다갱신자
|
||||
file_put_contents(__dir__."/logs/".UniqueConst::$serverID."/_traffic.txt",
|
||||
Json::encode([
|
||||
@@ -1524,17 +1524,17 @@ function checkTurn() {
|
||||
|
||||
$session = Session::getInstance();
|
||||
|
||||
pushLockLog(["- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
pushLockLog(["- checkTurn() : ".TimeUtil::now()." : ".$session->userName]);
|
||||
|
||||
// 파일락 해제
|
||||
if(!flock($fp, LOCK_UN)) { return; }
|
||||
// 세마포어 해제
|
||||
//if(!@sem_release($sema)) { echo "치명적 에러! Hide_D에게 문의하세요!"; exit(1); }
|
||||
|
||||
pushLockLog(["- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
pushLockLog(["- checkTurn() 입 : ".TimeUtil::now()." : ".$session->userName]);
|
||||
|
||||
//if(STEP_LOG) delStepLog();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', 진입');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', 진입');
|
||||
|
||||
//천통시에는 동결
|
||||
if($gameStor->isunited == 2) {
|
||||
@@ -1543,17 +1543,17 @@ function checkTurn() {
|
||||
}
|
||||
$gameStor->cacheAll();
|
||||
// 1턴이상 갱신 없었으면 서버 지연
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', checkDelay');
|
||||
checkDelay();
|
||||
// 접속자수, 접속국가, 국가별 접속장수 갱신
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', checkDelay');
|
||||
updateOnline();
|
||||
//접속자 수 따라서 갱신제한 변경
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', CheckOverhead');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', CheckOverhead');
|
||||
CheckOverhead();
|
||||
//서버정보
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$date = TimeUtil::now();
|
||||
// 최종 처리 월턴의 다음 월턴시간 구함
|
||||
$prevTurn = cutTurn($gameStor->turntime, $gameStor->turnterm);
|
||||
$nextTurn = addTurn($prevTurn, $gameStor->turnterm);
|
||||
@@ -1570,30 +1570,30 @@ function checkTurn() {
|
||||
//if(PROCESS_LOG) $processlog[0] = "[{$date}] 월턴 이전 갱신: name({$general['name']}), no({$general['no']}), turntime({$general['turntime']}), turn0({$general['turn0']})";
|
||||
//if(PROCESS_LOG) pushProcessLog($processlog);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processAI');
|
||||
if($general['npc'] >= 2) { processAI($general['no']); } // npc AI 처리
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', PreprocessCommand');
|
||||
PreprocessCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processCommand');
|
||||
processCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateCommand');
|
||||
updateCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateTurntime');
|
||||
updateTurntime($general['no']);
|
||||
|
||||
}
|
||||
|
||||
// 트래픽 업데이트
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTraffic');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateTraffic');
|
||||
updateTraffic();
|
||||
// 1달마다 처리하는 것들, 벌점 감소 및 건국,전턴,합병 -1, 군량 소모
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', preUpdateMonthly');
|
||||
$result = preUpdateMonthly();
|
||||
if($result == false) {
|
||||
pushLockLog(["-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
pushLockLog(["-- checkTurn() 오류출 : ".TimeUtil::now()." : ".$session->userName]);
|
||||
|
||||
// 잡금 해제
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', unlock');
|
||||
$gameStor->resetCache(true);
|
||||
unlock();
|
||||
return false;
|
||||
@@ -1602,7 +1602,7 @@ function checkTurn() {
|
||||
// 그 시각 년도,월 저장
|
||||
list($gameStor->year, $gameStor->month) = turnDate($nextTurn);
|
||||
|
||||
pushLockLog(["-- checkTurn() ".$gameStor->month."월 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
pushLockLog(["-- checkTurn() ".$gameStor->month."월 : ".TimeUtil::now()." : ".$session->userName]);
|
||||
|
||||
// 이벤트 핸들러 동작
|
||||
foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
|
||||
@@ -1617,46 +1617,46 @@ function checkTurn() {
|
||||
// 분기계산. 장수들 턴보다 먼저 있다면 먼저처리
|
||||
if($gameStor->month == 1) {
|
||||
// NPC 등장
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processGoldIncome');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processGoldIncome');
|
||||
processGoldIncome();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processSpring');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processSpring');
|
||||
processSpring();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateYearly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateYearly');
|
||||
updateYearly();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateQuaterly');
|
||||
updateQuaterly();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', disaster');
|
||||
disaster();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', tradeRate');
|
||||
tradeRate();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', addAge');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', addAge');
|
||||
addAge();
|
||||
// 새해 알림
|
||||
$alllog[] = "<C>◆</>{$gameStor->month}월:<C>{$gameStor->year}</>년이 되었습니다.";
|
||||
pushGeneralPublicRecord($alllog, $gameStor->year, $gameStor->month);
|
||||
} elseif($gameStor->month == 4) {
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateQuaterly');
|
||||
updateQuaterly();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', disaster');
|
||||
disaster();
|
||||
} elseif($gameStor->month == 7) {
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processRiceIncome');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processRiceIncome');
|
||||
processRiceIncome();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processFall');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processFall');
|
||||
processFall();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateQuaterly');
|
||||
updateQuaterly();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', disaster');
|
||||
disaster();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', tradeRate');
|
||||
tradeRate();
|
||||
} elseif($gameStor->month == 10) {
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateQuaterly');
|
||||
updateQuaterly();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', disaster');
|
||||
disaster();
|
||||
}
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', postUpdateMonthly');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', postUpdateMonthly');
|
||||
postUpdateMonthly();
|
||||
|
||||
// 다음달로 넘김
|
||||
@@ -1664,7 +1664,7 @@ function checkTurn() {
|
||||
$nextTurn = addTurn($prevTurn, $gameStor->turnterm);
|
||||
}
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__);
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', '.__LINE__);
|
||||
|
||||
// 이시각 정각 시까지 업데이트 완료했음
|
||||
$gameStor->turntime = $prevTurn;
|
||||
@@ -1683,20 +1683,20 @@ function checkTurn() {
|
||||
//if(PROCESS_LOG) $processlog[0] = "[{$date}] 월턴 이후 갱신: name({$general['name']}), no({$general['no']}), turntime({$general['turntime']}), turn0({$general['turn0']})";
|
||||
//if(PROCESS_LOG) pushProcessLog($processlog);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processAI');
|
||||
if($general['npc'] >= 2) { processAI($general['no']); } // npc AI 처리
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', PreprocessCommand');
|
||||
PreprocessCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processCommand');
|
||||
processCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateCommand');
|
||||
updateCommand($general['no']);
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', updateTurntime');
|
||||
updateTurntime($general['no']);
|
||||
}
|
||||
} while($gencount > 0);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__);
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', '.__LINE__);
|
||||
|
||||
$gameStor->turntime = $date;
|
||||
|
||||
@@ -1704,19 +1704,19 @@ function checkTurn() {
|
||||
$query = "update general set injury='80' where injury>'80'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//토너먼트 처리
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processTournament');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processTournament');
|
||||
processTournament();
|
||||
//거래 처리
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAuction');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', processAuction');
|
||||
processAuction();
|
||||
// 잡금 해제
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', unlock');
|
||||
$gameStor->resetCache(true);
|
||||
unlock();
|
||||
|
||||
pushLockLog(["- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
pushLockLog(["- checkTurn() 출 : ".TimeUtil::now()." : ".$session->userName]);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish');
|
||||
//if(STEP_LOG) pushStepLog(TimeUtil::now().', finish');
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2120,7 +2120,7 @@ function CheckHall($no) {
|
||||
return;
|
||||
}
|
||||
|
||||
$unitedDate = date('Y-m-d H:i:s');
|
||||
$unitedDate = TimeUtil::now();
|
||||
$nation = getNationStaticInfo($general['nation']);
|
||||
|
||||
$serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games');
|
||||
@@ -2960,15 +2960,29 @@ function SabotageInjury($city, $type=0) {
|
||||
}
|
||||
|
||||
function getRandTurn($term) {
|
||||
$randtime = rand(0, 60 * $term - 1);
|
||||
$turntime = date('Y-m-d H:i:s', strtotime('now') + $randtime);
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000;//6자리 소수
|
||||
|
||||
$randTime = new \DateInterval("PT0S");
|
||||
$randTime->s = $randSecond;
|
||||
$randTime->f = $randFraction;
|
||||
|
||||
return $turntime;
|
||||
$turnTime = new \DateTime();
|
||||
$turnTime->add($randTime);
|
||||
|
||||
return $turnTime->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
|
||||
function getRandTurn2($term) {
|
||||
$randtime = rand(0, 60 * $term - 1);
|
||||
$turntime = date('Y-m-d H:i:s', strtotime('now') - $randtime);
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000;//6자리 소수
|
||||
|
||||
$randTime = new \DateInterval("PT0S");
|
||||
$randTime->s = $randSecond;
|
||||
$randTime->f = $randFraction;
|
||||
|
||||
return $turntime;
|
||||
$turnTime = new \DateTime();
|
||||
$turnTime->sub($randTime);
|
||||
|
||||
return $turnTime->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ function getGeneralPublicRecordWithDate($year, $month) {
|
||||
}
|
||||
|
||||
function LogHistory($isFirst=0) {
|
||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', LogHistory Start');
|
||||
if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Start');
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -329,7 +329,7 @@ function LogHistory($isFirst=0) {
|
||||
$cityStr .= "$cityCount<br>";
|
||||
}
|
||||
|
||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', contents collected');
|
||||
if(STEP_LOG) pushStepLog(TimeUtil::now().', contents collected');
|
||||
|
||||
$db->insert('history', [
|
||||
'server_id' => UniqueConst::$serverID,
|
||||
@@ -344,6 +344,6 @@ function LogHistory($isFirst=0) {
|
||||
'city' => $cityStr
|
||||
]);
|
||||
|
||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', LogHistory Finish');
|
||||
if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Finish');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ pushAdminLog(["가입 : {$userID} // {$session->userName} // {$pick} // ".getenv
|
||||
|
||||
$rootDB->insert('member_log', [
|
||||
'member_no' => $userID,
|
||||
'date'=>date('Y-m-d H:i:s'),
|
||||
'date'=>TimeUtil::now(),
|
||||
'action_type'=>'make_general',
|
||||
'action'=>Json::encode([
|
||||
'server'=>DB::prefix(),
|
||||
|
||||
@@ -70,7 +70,7 @@ $month = $query['month'];
|
||||
$repeatCnt = $query['repeatCnt'];
|
||||
|
||||
$rawAttacker = $query['attackerGeneral'];
|
||||
$rawAttacker['turntime'] = date('Y-m-d H:i:s');
|
||||
$rawAttacker['turntime'] = TimeUtil::now();
|
||||
$rawAttackerCity = $query['attackerCity'];
|
||||
$rawAttackerNation = $query['attackerNation'];
|
||||
|
||||
|
||||
+2
-2
@@ -177,7 +177,7 @@ if ($admin['scenario'] >= 1000) {
|
||||
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
|
||||
$lastconnect = date('Y-m-d H:i:s');
|
||||
$lastconnect = TimeUtil::now();
|
||||
if ($lastconnect >= $turntime) {
|
||||
$turntime = addTurn($turntime, $admin['turnterm']);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ pushAdminLog(["가입 : {$userID} // {$name} // {$generalID}".getenv("REMOTE_ADD
|
||||
|
||||
$rootDB->insert('member_log', [
|
||||
'member_no' => $userID,
|
||||
'date'=>date('Y-m-d H:i:s'),
|
||||
'date'=>TimeUtil::now(),
|
||||
'action_type'=>'make_general',
|
||||
'action'=>Json::encode([
|
||||
'server'=>DB::prefix(),
|
||||
|
||||
@@ -163,7 +163,7 @@ class ResetHelper{
|
||||
);
|
||||
|
||||
|
||||
$turntime = date('Y-m-d H:i:s');
|
||||
$turntime = TimeUtil::now();
|
||||
$time = substr($turntime, 11, 2);
|
||||
if($sync == 0) {
|
||||
// 현재 시간을 1월로 맞춤
|
||||
|
||||
+3
-3
@@ -51,8 +51,8 @@ CREATE TABLE `general` (
|
||||
`book` INT(2) NULL DEFAULT '0',
|
||||
`horse` INT(2) NULL DEFAULT '0',
|
||||
`item` INT(2) NULL DEFAULT '0',
|
||||
`turntime` DATETIME NULL DEFAULT NULL,
|
||||
`recwar` DATETIME NULL DEFAULT NULL,
|
||||
`turntime` DATETIME(6) NULL DEFAULT NULL,
|
||||
`recwar` DATETIME(6) NULL DEFAULT NULL,
|
||||
`makenation` CHAR(255) NULL DEFAULT NULL,
|
||||
`makelimit` INT(2) NULL DEFAULT '0',
|
||||
`killturn` INT(3) NULL DEFAULT NULL,
|
||||
@@ -577,7 +577,7 @@ CREATE TABLE IF NOT EXISTS `ng_old_generals` (
|
||||
`owner` INT(11) NULL DEFAULT NULL,
|
||||
`name` VARCHAR(32) NOT NULL,
|
||||
`last_yearmonth` INT(11) NOT NULL,
|
||||
`turntime` DATETIME NOT NULL,
|
||||
`turntime` DATETIME(6) NOT NULL,
|
||||
`data` MEDIUMTEXT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `by_no` (`server_id`, `general_no`),
|
||||
|
||||
Reference in New Issue
Block a user