autorun_user 인자 세팅

This commit is contained in:
2019-09-20 00:05:40 +09:00
parent e684877c94
commit 8826061266
3 changed files with 36 additions and 5 deletions
+2 -1
View File
@@ -89,7 +89,8 @@ $result = ResetHelper::buildScenario(
$options['show_img_level'], $options['show_img_level'],
$options['tournament_trig'], $options['tournament_trig'],
$options['join_mode'], $options['join_mode'],
$options['starttime'] $options['starttime'],
$options['autorun_user']?:null
); );
$result['affected']=1; $result['affected']=1;
+30 -2
View File
@@ -57,7 +57,8 @@ $v->rule('required', [
'extend', 'extend',
'join_mode', 'join_mode',
'npcmode', 'npcmode',
'show_img_level' 'show_img_level',
'autorun_user_minutes'
])->rule('integer', [ ])->rule('integer', [
'turnterm', 'turnterm',
'sync', 'sync',
@@ -67,6 +68,7 @@ $v->rule('required', [
'npcmode', 'npcmode',
'show_img_level', 'show_img_level',
'tournament_trig', 'tournament_trig',
'autorun_user_minutes'
])->rule('in', 'join_mode', ['onlyRandom', 'full']); ])->rule('in', 'join_mode', ['onlyRandom', 'full']);
if(!$v->validate()){ if(!$v->validate()){
Json::die([ Json::die([
@@ -108,6 +110,30 @@ $npcmode = (int)$_POST['npcmode'];
$show_img_level = (int)$_POST['show_img_level']; $show_img_level = (int)$_POST['show_img_level'];
$tournament_trig = (int)$_POST['tournament_trig']; $tournament_trig = (int)$_POST['tournament_trig'];
$join_mode = $_POST['join_mode']; $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){ if($reserve_open){
$reserve_open = new \DateTime($reserve_open); $reserve_open = new \DateTime($reserve_open);
@@ -143,6 +169,7 @@ if($reserve_open){
'gameConf'=>$scenarioObj->getGameConf(), 'gameConf'=>$scenarioObj->getGameConf(),
'join_mode'=>$join_mode, 'join_mode'=>$join_mode,
'starttime'=>$open_date, 'starttime'=>$open_date,
'autorun_user'=>$autorun_user
]; ];
@@ -175,5 +202,6 @@ Json::die(ResetHelper::buildScenario(
$show_img_level, $show_img_level,
$tournament_trig, $tournament_trig,
$join_mode, $join_mode,
TimeUtil::DatetimeNow() TimeUtil::DatetimeNow(),
$autorun_user
)); ));
+4 -2
View File
@@ -144,7 +144,8 @@ class ResetHelper{
int $show_img_level, int $show_img_level,
int $tournament_trig, int $tournament_trig,
string $join_mode, string $join_mode,
string $turntime string $turntime,
?array $autorun_user
):array{ ):array{
//FIXME: 분리할 것 //FIXME: 분리할 것
if(120 % $turnterm != 0){ if(120 % $turnterm != 0){
@@ -253,7 +254,8 @@ class ResetHelper{
'extended_general'=>$extend, 'extended_general'=>$extend,
'fiction'=>$fiction, 'fiction'=>$fiction,
'tnmt_trig'=>$tournament_trig, '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){ foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){