기본 커맨드 입력 가능하도록 구현
This commit is contained in:
@@ -8,40 +8,44 @@ $session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$generalID = $session->generalID;
|
||||
|
||||
|
||||
$action = Util::getReq('action', 'string');
|
||||
$arg = Json::decode(Util::getReq('arg', 'string'));
|
||||
$turnList = Json::decode(Util::getReq('turnList', 'string'));
|
||||
$turnList = Util::getReq('turnList', 'array_int');
|
||||
|
||||
if(!is_array($turnList) || !$turnList){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'턴이 입력되지 않았습니다.'
|
||||
'reason'=>'턴이 입력되지 않았습니다.',
|
||||
'test'=>'post'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$action){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'action이 입력되지 않았습니다.'
|
||||
'reason'=>'action이 입력되지 않았습니다.',
|
||||
'test'=>'post'
|
||||
]);
|
||||
}
|
||||
|
||||
if($arg === null || !is_array($arg)){
|
||||
if(!in_array($action, Util::array_flatten(GameConst::$availableGeneralCommand))){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바른 arg 형태가 아닙니다.'
|
||||
'reason'=>'사용할 수 없는 커맨드입니다.',
|
||||
'test'=>'post'
|
||||
]);
|
||||
}
|
||||
|
||||
$result = setGeneralCommand($generalID, $turnList, $action, $arg);
|
||||
if(!key_exists('result', $result)){
|
||||
$result['result'] = false;
|
||||
if($arg === null){
|
||||
$arg = [];
|
||||
}
|
||||
if(!key_exists('arg_test', $result)){
|
||||
$result['arg_test'] = false;
|
||||
|
||||
if(!is_array($arg)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바른 arg 형태가 아닙니다.',
|
||||
'test'=>'post'
|
||||
]);
|
||||
}
|
||||
if(!key_exists('reason', $result)){
|
||||
throw new MustNotBeReachedException('reason이 왜 없어?');
|
||||
}
|
||||
Json::die($result);
|
||||
|
||||
Json::die(setGeneralCommand($generalID, $turnList, $action, $arg));
|
||||
Reference in New Issue
Block a user