인사부 수정
This commit is contained in:
@@ -11,18 +11,19 @@ $isAmbassador = Util::getReq('isAmbassador', bool);
|
|||||||
$genlist = Util::getReq('genlist', 'array_int');
|
$genlist = Util::getReq('genlist', 'array_int');
|
||||||
|
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
$session = Session::requireGameLogin([])->setReadOnly();
|
||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$me = $db->query('SELECT no, level, nation FROM general WHERE owner = %i', $userID);
|
$me = $db->queryFirstRow('SELECT no, level, nation FROM general WHERE owner = %i', $userID);
|
||||||
|
|
||||||
if(!$me || $me['level'] != 12){
|
if(!$me || $me['level'] != 12){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'군주가 아닙니다'
|
'reason'=>'군주가 아닙니다',
|
||||||
|
'tmp'=>$me
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +74,7 @@ $db->update('general', [
|
|||||||
'permission'=>$targetType,
|
'permission'=>$targetType,
|
||||||
], 'no IN %li', $realCandidates);
|
], 'no IN %li', $realCandidates);
|
||||||
|
|
||||||
if(!$realCandidates){
|
Json::die([
|
||||||
Json::die([
|
'result'=>true,
|
||||||
'result'=>true,
|
'reason'=>'success'
|
||||||
'reason'=>'success'
|
]);
|
||||||
]);
|
|
||||||
}
|
|
||||||
+45
-1
@@ -1,3 +1,33 @@
|
|||||||
|
function changePermission(isAmbassador, rawGeneralList){
|
||||||
|
console.log(isAmbassador);
|
||||||
|
console.log(rawGeneralList);
|
||||||
|
|
||||||
|
var generalList = [];
|
||||||
|
$.each(rawGeneralList, function(idx, value){
|
||||||
|
generalList.push(parseInt(value.id));
|
||||||
|
})
|
||||||
|
|
||||||
|
$.post({
|
||||||
|
url:'j_general_set_permission.php',
|
||||||
|
dataType:'json',
|
||||||
|
data:{
|
||||||
|
isAmbassador:isAmbassador,
|
||||||
|
genlist:generalList
|
||||||
|
},
|
||||||
|
}).then(function(data){
|
||||||
|
if(!data){
|
||||||
|
alert('변경하지 못했습니다.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!data.result){
|
||||||
|
alert('변경하지 못했습니다. : '+data.reason);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
alert('변경했습니다.');
|
||||||
|
location.reload();
|
||||||
|
}, errUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#selectAmbassador').select2({
|
$('#selectAmbassador').select2({
|
||||||
theme: 'bootstrap4',
|
theme: 'bootstrap4',
|
||||||
@@ -32,6 +62,20 @@ $(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#changeAmbassador').click(function(){
|
$('#changeAmbassador').click(function(){
|
||||||
//TODO: 변경 코드
|
if(!confirm('외교권자를 변경할까요?')){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
changePermission(true, $('#selectAmbassador').select2('data'));
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#changeAuditor').click(function(){
|
||||||
|
if(!confirm('조언자를 변경할까요?')){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
changePermission(false, $('#selectAuditor').select2('data'));
|
||||||
|
return false;
|
||||||
|
})
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user