From c732bcddb10248f5aa33c15f3d881e487e710e61 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Mon, 16 May 2022 01:44:32 +0900 Subject: [PATCH] =?UTF-8?q?misc:=20=EC=84=A4=EB=AC=B8=20=EC=A1=B0=EC=82=AC?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A5=BC=20=EC=9D=B4=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phan/config.php | 2 - hwe/a_vote.php | 434 ------------------------------------------ hwe/c_vote.php | 91 --------- hwe/func_template.php | 2 +- hwe/ts/PageVote.vue | 2 +- 5 files changed, 2 insertions(+), 529 deletions(-) delete mode 100644 hwe/a_vote.php delete mode 100644 hwe/c_vote.php diff --git a/.phan/config.php b/.phan/config.php index 34d13f21..d7f23571 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -44,7 +44,6 @@ return [ 'hwe/a_npcList.php', 'hwe/api.php', 'hwe/a_traffic.php', - 'hwe/a_vote.php', 'hwe/battle_simulator.php', 'hwe/b_auction.php', 'hwe/b_battleCenter.php', @@ -63,7 +62,6 @@ return [ 'hwe/b_troop.php', 'hwe/c_auction.php', 'hwe/c_tournament.php', - 'hwe/c_vote.php', 'hwe/func_auction.php', 'hwe/func_command.php', 'hwe/func_converter.php', diff --git a/hwe/a_vote.php b/hwe/a_vote.php deleted file mode 100644 index e526689f..00000000 --- a/hwe/a_vote.php +++ /dev/null @@ -1,434 +0,0 @@ -setReadOnly(); -$userID = Session::getUserID(); -$db = DB::db(); -$gameStor = KVStorage::getStorage($db, 'game_env'); - -increaseRefresh("설문조사", 1); - -$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()] ?? []); -$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5; - -$me = $db->queryFirstRow('SELECT no,vote from general where owner=%i', $userID); - -$admin = $gameStor->getValues(['develcost', 'voteopen', 'vote_title', 'vote', 'votecomment']); -$vote_title = $admin['vote_title'] ?? '-'; -$vote = $admin['vote'] ?: ['-']; - -?> - - - - - <?= UniqueConst::$serverName ?>: 설문조사 - - - - - - - - - - - - - - - - - -
설 문 조 사
- - - - - - - - - - - "; - } - - $vote_title = Tag2Code($vote_title); - echo " - - - - -"; - - $voteCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote>0 AND npc<2'); - $allCount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2'); - - $percentage = round($voteCount / $allCount * 100, 1); - - $voteTypeCount = count($vote); - for ($i = 1; $i < $voteTypeCount; $i++) { - echo " - - - - - - "; - } - - echo " - -"; - if ($me['vote'] == 0 && $me['no'] > 0) { - echo " - - - "; - } else { - echo " - - "; - } - echo " - - -"; - - if ($isVoteAdmin) { - echo " - - - - - - "; - } - - if ($admin['votecomment']) { - $comment = $admin['votecomment']; - $commentCount = count($comment); - } else { - $commentCount = 0; - } - echo " -
- 설 문 조 사 (금과 추첨으로 유니크템 증정!) -
제 목 {$vote_title}
{$i}. - "; - if ($me['vote'] == 0 && $me['no'] > 0) { - echo " - - "; - } elseif ($admin['voteopen'] >= 1 || $isVoteAdmin) { - $vCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote=%i', $i); - - $per = @round($vCount / $voteCount * 100, 1); - echo "{$vCount} 표 ({$per}%)"; - } else { - echo "추후공개"; - } - $vote[$i] = Tag2Code($vote[$i]); - echo " -  {$vote[$i]}
투표결산 투표율 : {$voteCount} / {$allCount} ({$percentage} %)
- - - - -"; - for ($i = 0; $i < $commentCount; $i++) { - $cmt = $comment[$i]; - $cmt[2] = Tag2Code($cmt[2]); - $j = $i + 1; - echo " - - - - - - - "; - } - if ($me['no'] > 0) { - echo " - - - - - - "; - } - ?> -
댓 글
{$j}.{$cmt[0]}{$cmt[1]} {$cmt[2]}
-
-
- - - "; - - if ($admin['voteopen'] >= 1 || $isVoteAdmin) { - echo " - - - - - "; - } - - if ($admin['voteopen'] >= 2 || $isVoteAdmin) { - $memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=0 AND npc <2'); - if ($memCount == 0) { - $memCount = 1; - } - - if (!isset($nationVoteCount[0])) { - $nationVoteCount[0] = 0; - } - $percentage = round($nationVoteCount[0] / $memCount * 100, 1); - - echo " - - - - - "; - - foreach ($db->query('SELECT nation,color,name,gennum from nation order by gennum desc') as $i => $nation) { - $memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc<2', $nation['nation']); - - - - $voteCount = $nationVoteCount[$nation['nation']] ?? 0; - if ($memCount == 0) { - $percentage = 100; - } else { - $percentage = round($voteCount / $memCount * 100, 1); - } - - - echo " - - - - - "; - } - } - ?> - -
- - 전 체 통 계 - - - "; - } - echo " -
전 체{$voteCount} / {$allCount} ({$percentage} %) - "; - - $memCount = max(1, $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2')); - - $totalVote = []; - $nationVoteCount = []; - $nationVote = []; - - foreach ($db->query("SELECT nation, vote, count(`no`) as cnt FROM general WHERE npc<2 GROUP BY nation, vote") as $row) { - $nation = $row['nation']; - $ownVote = $row['vote']; - $cnt = $row['cnt']; - - if (!isset($totalVote[$ownVote])) { - $totalVote[$ownVote] = 0; - } - - if (!isset($nationVoteCount[$nation])) { - $nationVoteCount[$nation] = 0; - $nationVote[$nation] = []; - } - - if (!isset($nationVote[$nation][$ownVote])) { - $nationVote[$nation][$ownVote] = 0; - } - - $totalVote[$ownVote] += $cnt; - $nationVoteCount[$nation] += $cnt; - $nationVote[$nation][$ownVote] += $cnt; - } - - $totalPer = 0; - for ($i = 0; $i < $voteTypeCount; $i++) { - $per = round(($totalVote[$i] ?? 0) * 100 / $memCount, 1); - if ($i == $voteTypeCount - 1) { - $per = 100 - $totalPer; - } else { - $totalPer += $per; - } - - - // if($per < 5) { $vote['cnt'] = " "; } - ?> - - -
- -
- - -
재 야{$nationVoteCount[0]} / {$memCount} ({$percentage} %) - "; - - $totalPer = 0; - for ($i = 0; $i < $voteTypeCount; $i++) { - $per = round(Util::array_get($nationVote[0][$i], 0) / $memCount * 100, 1); - if ($i == $voteTypeCount - 1) { - $per = 100 - $totalPer; - } else { - $totalPer += $per; - } - // if($per < 5) { $vote['cnt'] = " "; } - ?> - - -
- -
- - -
{$nation['name']}{$voteCount} / {$memCount} ({$percentage} %) - "; - - $totalPer = 0; - for ($k = 0; $k < $voteTypeCount; $k++) { - if ($memCount == 0) { - $per = 0; - continue; - } - - $per = round(($nationVote[$nation['nation']][$k] ?? 0) / $memCount * 100, 1); - - if ($i == $voteTypeCount - 1) { - $per = 100 - $totalPer; - } else { - $totalPer += $per; - } - - // if($per < 5) { $vote['cnt'] = " "; } - ?> - - -
- -
- - -
- - - - - - - -
- - - - - 0) { - $type = (($type - 1) % 7) + 1; - } - - switch ($type) { - default: - case 0: - $color = "black"; - break; - case 1: - $color = "red"; - break; - case 2: - $color = "orange"; - break; - case 3: - $color = "yellow"; - break; - case 4: - $color = "green"; - break; - case 5: - $color = "blue"; - break; - case 6: - $color = "navy"; - break; - case 7: - $color = "purple"; - break; - } - - return $color; -} - -function getNewColor($type) -{ - if ($type > 0) { - $type = (($type - 1) % 7) + 1; - } - - switch ($type) { - case 2: - $color = "black"; - break; - case 3: - $color = "black"; - break; - default: - $color = "white"; - break; - } - - return $color; -} diff --git a/hwe/c_vote.php b/hwe/c_vote.php deleted file mode 100644 index bb5d6d2b..00000000 --- a/hwe/c_vote.php +++ /dev/null @@ -1,91 +0,0 @@ -setReadOnly(); -$userID = Session::getUserID(); - -$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]); -$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5; - -$db = DB::db(); -$gameStor = KVStorage::getStorage($db, 'game_env'); - -$admin = $gameStor->getValues(['develcost', 'cost', 'vote_title', 'vote', 'votecomment']); - -$generalID = Session::getGeneralID(); - -$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item','npc','imgsvr','picture','aux'], 2); - -if($btn == "투표" && $general->getVar('vote') == 0 && $sel > 0) { - $develcost = $admin['develcost'] * 5; - $db->update('general', [ - 'gold'=>$db->sqleval('gold + %i', $develcost), - 'vote'=>$sel - ], 'owner=%i', $userID); - - if(tryUniqueItemLottery($general, '설문조사')){ - $general->applyDB($db); - } -} -else if($btn == "댓글" && trim($comment) != "") { - $comment = StringUtil::neutralize($comment); - - $nation = $general->getStaticNation(); - - if(!$admin['votecomment']){ - $admin['votecomment'] = []; - } - $admin['votecomment'][] = [$nation['name'],$general->getName(),$comment]; - $gameStor->votecomment = $admin['votecomment']; -} - -if(!$isVoteAdmin){ - header('location:a_vote.php', true, 303); - die(); -} - - -if($btn == "수정") { - if($title != "") { - $gameStor->vote_title = WebUtil::htmlPurify($title); - } -} elseif($btn == "추가") { - if($str != "") { - if(!$admin['vote']){ - $admin['vote'] = []; - } - $admin['vote'][] = WebUtil::htmlPurify($str); - $gameStor->vote=$admin['vote']; - } -} elseif($btn == "리셋") { - $gameStor->voteopen=1; - $gameStor->vote=['-']; - $gameStor->vote_title = '-'; - $gameStor->votecomment=[]; - - $db->update('general', [ - 'vote'=>0 - ], true); -} elseif($btn == "알림") { - $db->update('general', [ - 'newvote'=>1 - ], 'vote=0'); -} elseif($btn == "숨김") { - $gameStor->voteopen = 0; -} elseif($btn == "전체통계만") { - $gameStor->voteopen = 1; -} elseif($btn == "전부") { - $gameStor->voteopen = 2; -} - -header('location:a_vote.php', true, 303); \ No newline at end of file diff --git a/hwe/func_template.php b/hwe/func_template.php index 784decae..26e5c7a7 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -129,7 +129,7 @@ function allButton(bool $seizeNPCMode, array $opts = []) $site = "a_npcList.php"; $call = "빙의일람"; } else { - $site = "a_vote.php"; + $site = "v_vote.php"; $call = "설문조사"; } diff --git a/hwe/ts/PageVote.vue b/hwe/ts/PageVote.vue index deee2eb7..01ba295a 100644 --- a/hwe/ts/PageVote.vue +++ b/hwe/ts/PageVote.vue @@ -122,7 +122,7 @@
- {{ voteInfo.title }} +
{{ voteInfo.title }} ({{ voteInfo.startDate }})