버그 수정
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
//통합 세력장수&암행부 viewer
|
//통합 세력장수&암행부 viewer
|
||||||
@@ -21,103 +22,116 @@ $me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, p
|
|||||||
$con = checkLimit($me['con']);
|
$con = checkLimit($me['con']);
|
||||||
if ($con >= 2) {
|
if ($con >= 2) {
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result' => false,
|
||||||
'reason'=>'접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
|
'reason' => '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nationID = $me['nation'];
|
$nationID = $me['nation'];
|
||||||
$permission = checkSecretPermission($me, true);
|
$permission = checkSecretPermission($me, true);
|
||||||
if($reqForce && $reqType > $permission){
|
if ($reqForce && $reqType > $permission) {
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result' => false,
|
||||||
'reason'=>'권한이 부족합니다.'
|
'reason' => '권한이 부족합니다.'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$permission = min($reqType, $permission);
|
$permission = min($reqType, $permission);
|
||||||
$nationArr = getNationStaticInfo($nationID);
|
$nationArr = getNationStaticInfo($nationID);
|
||||||
$viewColumns = [
|
$viewColumns = [
|
||||||
'no'=>0,
|
'no' => 0,
|
||||||
'name'=>0,
|
'name' => 0,
|
||||||
'owner_name'=>9,
|
'owner_name' => 9,
|
||||||
'nation'=>0,
|
'nation' => 0,
|
||||||
'city'=>1,
|
'city' => 1,
|
||||||
'officer_level'=>0,
|
'officer_level' => 2,
|
||||||
'officer_city'=>2,
|
'officer_city' => 2,
|
||||||
'npc'=>0,
|
'npc' => 0,
|
||||||
'defence_train'=>2,
|
'defence_train' => 2,
|
||||||
'troop'=>2,
|
'troop' => 2,
|
||||||
'injury'=>0,
|
'injury' => 0,
|
||||||
'leadership'=>0,
|
'leadership' => 0,
|
||||||
'strength'=>0,
|
'strength' => 0,
|
||||||
'intel'=>0,
|
'intel' => 0,
|
||||||
'experience'=>1,
|
'experience' => 1,
|
||||||
'explevel'=>0,
|
'explevel' => 0,
|
||||||
'dedication'=>1,
|
'dedication' => 1,
|
||||||
'dedlevel'=>0,
|
'dedlevel' => 0,
|
||||||
'gold'=>0,
|
'gold' => 0,
|
||||||
'rice'=>0,
|
'rice' => 0,
|
||||||
'crewtype'=>2,
|
'crewtype' => 2,
|
||||||
'crew'=>2,
|
'crew' => 2,
|
||||||
'train'=>2,
|
'train' => 2,
|
||||||
'atmos'=>2,
|
'atmos' => 2,
|
||||||
'killturn'=>1,
|
'killturn' => 0,
|
||||||
'turntime'=>2,
|
'turntime' => 2,
|
||||||
'picture'=>0,
|
'picture' => 0,
|
||||||
'imgsvr'=>0,
|
'imgsvr' => 0,
|
||||||
'age'=>0,
|
'age' => 0,
|
||||||
'special'=>0,
|
'special' => 0,
|
||||||
'special2'=>0,
|
'special2' => 0,
|
||||||
'personal'=>0,
|
'personal' => 0,
|
||||||
'belong'=>0,
|
'belong' => 0,
|
||||||
'horse'=>2,
|
'horse' => 2,
|
||||||
'weapon'=>2,
|
'weapon' => 2,
|
||||||
'book'=>2,
|
'book' => 2,
|
||||||
'item'=>2,
|
'item' => 2,
|
||||||
'connect'=>0
|
'connect' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
$customViewColumns = [
|
$customViewColumns = [
|
||||||
'officerLevel'=>1,
|
'officerLevel' => 0,
|
||||||
'officerLevelText'=>1,
|
'officerLevelText' => 0,
|
||||||
'lbonus'=>1,
|
'lbonus' => 0,
|
||||||
'ownerName'=>1,
|
'ownerName' => 0,
|
||||||
'honorText'=>1,
|
'honorText' => 0
|
||||||
'expLevelText'=>1,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function getOfficerLevel($rawGeneral)
|
||||||
|
{
|
||||||
|
global $permission;
|
||||||
|
$level = $rawGeneral['officer_level'];
|
||||||
|
if ($level >= 5) {
|
||||||
|
return $level;
|
||||||
|
}
|
||||||
|
if ($permission > 1) {
|
||||||
|
return $level;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
$specialViewFilter = [
|
$specialViewFilter = [
|
||||||
'officerLevel'=>function($rawGeneral){
|
'officerLevel' => function ($rawGeneral){
|
||||||
return $rawGeneral['officer_level'];
|
return getOfficerLevel($rawGeneral);
|
||||||
},
|
},
|
||||||
'special'=>function($rawGeneral){
|
'special' => function ($rawGeneral) {
|
||||||
return getGeneralSpecialDomesticName($rawGeneral['special']);
|
return getGeneralSpecialDomesticName($rawGeneral['special']);
|
||||||
},
|
},
|
||||||
'special2'=>function($rawGeneral){
|
'special2' => function ($rawGeneral) {
|
||||||
return getGeneralSpecialWarName($rawGeneral['special2']);
|
return getGeneralSpecialWarName($rawGeneral['special2']);
|
||||||
},
|
},
|
||||||
'personal'=>function($rawGeneral){
|
'personal' => function ($rawGeneral) {
|
||||||
return getGenChar($rawGeneral['personal']);
|
return getGenChar($rawGeneral['personal']);
|
||||||
},
|
},
|
||||||
'lbonus'=>function($rawGeneral)use($nationArr){
|
'lbonus' => function ($rawGeneral) use ($nationArr) {
|
||||||
return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']);
|
return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']);
|
||||||
},
|
},
|
||||||
'ownerName'=>function($rawGeneral){
|
'ownerName' => function ($rawGeneral) {
|
||||||
if($rawGeneral['npc']!=1){
|
if ($rawGeneral['npc'] != 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $rawGeneral['owner_name'];
|
return $rawGeneral['owner_name'];
|
||||||
},
|
},
|
||||||
'officerLevelText'=>function($rawGeneral)use($nationArr){
|
'officerLevelText' => function ($rawGeneral) use ($nationArr, $specialViewFilter) {
|
||||||
return getOfficerLevelText($rawGeneral['officer_level'], $nationArr['level']);
|
$level = getOfficerLevel($rawGeneral);
|
||||||
|
return getOfficerLevelText($level, $nationArr['level']);
|
||||||
},
|
},
|
||||||
'honorText'=>function($rawGeneral){
|
'honorText' => function ($rawGeneral) {
|
||||||
return getHonor($rawGeneral['experience']);
|
return getHonor($rawGeneral['experience']);
|
||||||
},
|
},
|
||||||
'dedLevelText'=>function($rawGeneral){
|
'dedLevelText' => function ($rawGeneral) {
|
||||||
return getDedLevelText($rawGeneral['dedLevel']);
|
return getDedLevelText($rawGeneral['dedLevel']);
|
||||||
},
|
},
|
||||||
'turntime'=>function($rawGeneral){
|
'turntime' => function ($rawGeneral) {
|
||||||
//'0000-00-00 11:23';
|
//'0000-00-00 11:23';
|
||||||
return substr($rawGeneral['turntime'], 11, 5);
|
return substr($rawGeneral['turntime'], 11, 5);
|
||||||
}
|
}
|
||||||
@@ -129,27 +143,27 @@ $specialViewFilter = [
|
|||||||
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
||||||
|
|
||||||
$resultColumns = [];
|
$resultColumns = [];
|
||||||
foreach($viewColumns as $column=>$reqPermission){
|
foreach ($viewColumns as $column => $reqPermission) {
|
||||||
if($reqPermission > $permission){
|
if ($reqPermission > $permission) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$resultColumns[] = $column;
|
$resultColumns[] = $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($customViewColumns as $column=>$reqPermission){
|
foreach ($customViewColumns as $column => $reqPermission) {
|
||||||
if($reqPermission > $permission){
|
if ($reqPermission > $permission) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$resultColumns[] = $column;
|
$resultColumns[] = $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($rawGeneralList as $rawGeneral){
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
//General 생성?
|
//General 생성?
|
||||||
|
|
||||||
$item = [];
|
$item = [];
|
||||||
foreach($resultColumns as $column){
|
foreach ($resultColumns as $column) {
|
||||||
$value = $rawGeneral[$column];
|
$value = $rawGeneral[$column];
|
||||||
if(key_exists($column, $specialViewFilter)){
|
if (key_exists($column, $specialViewFilter)) {
|
||||||
$value = $specialViewFilter[$column]($rawGeneral);
|
$value = $specialViewFilter[$column]($rawGeneral);
|
||||||
}
|
}
|
||||||
$item[] = $value;
|
$item[] = $value;
|
||||||
@@ -159,9 +173,9 @@ foreach($rawGeneralList as $rawGeneral){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'result'=>true,
|
'result' => true,
|
||||||
'column'=>$resultColumns,
|
'column' => $resultColumns,
|
||||||
'list'=>$generalList,
|
'list' => $generalList,
|
||||||
];
|
];
|
||||||
|
|
||||||
Json::die($result);
|
Json::die($result);
|
||||||
|
|||||||
Reference in New Issue
Block a user