DB 스키마 정리, diplomacy 테이블 정리, 코드 정리

This commit is contained in:
2019-01-16 01:59:07 +09:00
parent 8ee2def02a
commit 3cf9d39cf2
8 changed files with 17 additions and 124 deletions
+1 -9
View File
@@ -73,7 +73,6 @@ class DiplomaticMessage extends Message{
protected function noAggression(){
$year = Util::array_get($this->msgOption['year']);
$option = Util::array_get($this->msgOption['option'])??'';
if($year < 1 || $year > 30){
return [self::INVALID, '올바르지 않은 불가침 서신입니다.'];
}
@@ -81,7 +80,7 @@ class DiplomaticMessage extends Message{
$this->diplomacyDetail = "{$year}";
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
$chk = $helper->noAggression($year, $option);
$chk = $helper->noAggression($year);
if($chk[0] !== self::ACCEPTED){
return $chk;
}
@@ -284,13 +283,6 @@ class DiplomaticMessage extends Message{
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
$db->update('diplomacy', [
'reserved'=>'',
'showing'=>null
], '(me=%s AND you=%s) OR (you=%s AND me=%s)',
$this->src->nationID, $this->dest->nationID,
$this->src->nationID, $this->dest->nationID
);
if($result !== self::ACCEPTED){
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
if($result === self::DECLINED){
+8 -15
View File
@@ -273,7 +273,7 @@ class Diplomacy{
return $prev;
}
public function noAggression(int $when, string $option){
public function noAggression(int $when){
$chk = $this->checkValidNation();
$chk = $this->checkNotWar($chk);
$chk = $this->checkAlreadyMerging($chk);
@@ -286,8 +286,7 @@ class Diplomacy{
$db = DB::db();
$db->update('diplomacy',[
'state'=>7,
'term'=>$when*12,
'fixed'=>$option
'term'=>$when*12
],
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
$this->srcNation['nation'], $this->destNation['nation'],
@@ -308,8 +307,7 @@ class Diplomacy{
$db = DB::db();
$db->update('diplomacy',[
'state'=>2,
'term'=>0,
'fixed'=>''
'term'=>0
],
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
$this->srcNation['nation'], $this->destNation['nation'],
@@ -330,8 +328,7 @@ class Diplomacy{
$db = DB::db();
$db->update('diplomacy',[
'state'=>2,
'term'=>0,
'fixed'=>''
'term'=>0
],
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
$this->srcNation['nation'], $this->destNation['nation'],
@@ -356,16 +353,14 @@ class Diplomacy{
$db = DB::db();
$db->update('diplomacy',[
'state'=>4,
'term'=>24,
'fixed'=>''
'term'=>24
],
'me=%i AND you=%i',
$this->srcNation['nation'], $this->destNation['nation']);
$db->update('diplomacy',[
'state'=>3,
'term'=>24,
'fixed'=>''
'term'=>24
],
'you=%i AND me=%i',
$this->srcNation['nation'], $this->destNation['nation']);
@@ -389,16 +384,14 @@ class Diplomacy{
$db = DB::db();
$db->update('diplomacy',[
'state'=>6,
'term'=>24,
'fixed'=>''
'term'=>24
],
'me=%i AND you=%i',
$this->srcNation['nation'], $this->destNation['nation']);
$db->update('diplomacy',[
'state'=>5,
'term'=>24,
'fixed'=>''
'term'=>24
],
'you=%i AND me=%i',
$this->srcNation['nation'], $this->destNation['nation']);