From 88260612664617252fb240c3d7a6d7f90fe7c57b Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 20 Sep 2019 00:05:40 +0900 Subject: [PATCH] =?UTF-8?q?autorun=5Fuser=20=EC=9D=B8=EC=9E=90=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_autoreset.php | 3 ++- hwe/j_install.php | 32 ++++++++++++++++++++++++++++++-- hwe/sammo/ResetHelper.php | 6 ++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/hwe/j_autoreset.php b/hwe/j_autoreset.php index d1f3b872..731d3481 100644 --- a/hwe/j_autoreset.php +++ b/hwe/j_autoreset.php @@ -89,7 +89,8 @@ $result = ResetHelper::buildScenario( $options['show_img_level'], $options['tournament_trig'], $options['join_mode'], - $options['starttime'] + $options['starttime'], + $options['autorun_user']?:null ); $result['affected']=1; diff --git a/hwe/j_install.php b/hwe/j_install.php index 08e5901b..387617ab 100644 --- a/hwe/j_install.php +++ b/hwe/j_install.php @@ -57,7 +57,8 @@ $v->rule('required', [ 'extend', 'join_mode', 'npcmode', - 'show_img_level' + 'show_img_level', + 'autorun_user_minutes' ])->rule('integer', [ 'turnterm', 'sync', @@ -67,6 +68,7 @@ $v->rule('required', [ 'npcmode', 'show_img_level', 'tournament_trig', + 'autorun_user_minutes' ])->rule('in', 'join_mode', ['onlyRandom', 'full']); if(!$v->validate()){ Json::die([ @@ -108,6 +110,30 @@ $npcmode = (int)$_POST['npcmode']; $show_img_level = (int)$_POST['show_img_level']; $tournament_trig = (int)$_POST['tournament_trig']; $join_mode = $_POST['join_mode']; +$autorun_user_minutes = (int)$_POST['autorun_user_minutes']; +$autorun_user_options = []; +foreach(Util::getReq('autorun_user', 'array_string', []) as $autorun_option){ + $autorun_user_options[$autorun_option] = 1; +} + +if($autorun_user_minutes > 0 && !$autorun_user_options){ + Json::die([ + 'result'=>false, + 'reason'=>'적어도 자동 행동 중 하나는 선택을 해야합니다.' + ]); +} + +if($autorun_user_minutes < 0){ + Json::die([ + 'result'=>false, + 'reason'=>'자동 행동 기한이 0보다 작을 수 없습니다.' + ]); +} + +$autorun_user = $autorun_user_minutes?[ + 'limit_minutes'=>$autorun_user_minutes, + 'option'=>$autorun_user_options +]:null; if($reserve_open){ $reserve_open = new \DateTime($reserve_open); @@ -143,6 +169,7 @@ if($reserve_open){ 'gameConf'=>$scenarioObj->getGameConf(), 'join_mode'=>$join_mode, 'starttime'=>$open_date, + 'autorun_user'=>$autorun_user ]; @@ -175,5 +202,6 @@ Json::die(ResetHelper::buildScenario( $show_img_level, $tournament_trig, $join_mode, - TimeUtil::DatetimeNow() + TimeUtil::DatetimeNow(), + $autorun_user )); \ No newline at end of file diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index a377ef2c..79345d64 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -144,7 +144,8 @@ class ResetHelper{ int $show_img_level, int $tournament_trig, string $join_mode, - string $turntime + string $turntime, + ?array $autorun_user ):array{ //FIXME: 분리할 것 if(120 % $turnterm != 0){ @@ -253,7 +254,8 @@ class ResetHelper{ 'extended_general'=>$extend, 'fiction'=>$fiction, 'tnmt_trig'=>$tournament_trig, - 'prev_winner'=>$prevWinner + 'prev_winner'=>$prevWinner, + 'autorun_user'=>$autorun_user ]; foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){