[G5.3버전용]코로나19 현황 플러그인 v1.2.5 정보
[G5.3버전용]코로나19 현황 플러그인 v1.2.5관련링크
첨부파일
본문
/*=======================================================================
코로나 확진자수 표시 그누보드 플러그인 v1.2.5
그누보드 5.3버전 용
제작 : 예아넷 ( https://ye-ah.net/ )
코로나 조심하시고 모두 건강하세요
이 플러그인이 필요없어질 날이 다가오길 기원합니다.
======================================================================*/
적용 방법 - 꼭 순서를 지켜 적용시켜주시길 바랍니다.
1. https://www.data.go.kr/tcs/dss/selectApiDataDetailView.do?publicDataPk=15043376
공공데이터 포털에 접속하여 로그인 후 "보건복지부_코로나19 감염_현황" 활용 신청을 해주세요
ㄴ 활용 신청 후 "일반 인증키(UTF-8)"가 발급됩니다
ㄴ 발급후 최소 "1~2시간"뒤 사용가능 합니다(라고 적혀있는데 전혀 아니고 다음날 사용 가능합니다.... 허허..)
ㄴ 인증키 재발급하시면 거기서 다시 또 승인대기해야합니다... 되도록이면 그냥 기다려주세요
ㄴ 활용신청 상세기능정보에서 미리보기하여 데이터가 뜬다면 다음으로 진행해주세요
2. 게시판 ID "corona19"로 게시판을 생성하여주세요
3. 압축파일을 풀어주시고 파일을 그대로 루트에 업로드해주세요
4. plugin/corona19/corona19.php에서 151번째줄에 "서비스키"라고 되어있는 부분에 일반 인증키를 넣어주세요
인증키를 정상적으로 넣었다면 > $queryParams = '?' . urlencode('ServiceKey') . '=FDSOOOQWRS...'; /*Service Key*/
5. tail.sub.php에서 3번째줄에
include_once(G5_PLUGIN_PATH.'/corona19/corona19.php');
입력하여주세요
6. 코로나 게시판을 접속하면 상세현황이 사용자 정보 밑에 코로나 간단현황이 표기되는걸 확인할 수 있습니다.
7. 트래픽제한으로 인해 1시간마다 갱신할 수 있도록 제한을 걸어두었습니다.
코로나가 종식되어 이 플러그인이 무참히 버려질날을 기원합니다.
모두 건강하세요
미리보기 > https://ye-ah.net/corona19
원본글 > https://ye-ah.net/coding/75
=====================================================================
업데이트 내역
[20.11.20_v1.1] 관리자 화면에서 동작하지 않도록 수정
[20.11.20_v1.1] 데이터 요청 결과가 없다면 반영하지 않도록 수정
[20.11.20_v1.2] 감염현황판 표기 위치 변경 : 기존-제목 밑 > 변경-리스트 위 (글쓰기시에도 출력되어 불편함)
[20.11.20_v1.2] 감염 현황 데이터 호출식 함수화
[20.11.20_v1.2.1] 갱신일 값이 없을때(초기세팅시) 버그 수정
[20.11.20_v1.2.2] 게시판 출력 위치가 정상적이지 않던 버그 수정
[20.11.25_v1.2.3] 증감수치가 마이너스일때 오류 수정
[20.11.25_v1.2.4] 오늘자, 어제자 확진자수 데이터를 정확하게 가져오도록 수정, 데이터 변수 정리
[20.12.09_v1.2.5] 저장기준날짜가 작성(수정)날짜로 되어있던 오류 수정(기준일로 수정)
======================================================================
11
댓글 전체
5.4용은 안되던데..
감사합니다. 잘 사용하겠습니다.
그럼 hook쪽 문제인데 한번 다시 테스트해봐야겠네요
감사합니다 오류가있으면 언제든 알려주세요
corona_status_embed_fn_script 함수에서 스크립트부분에 출력 스크립트가 있는데 여기부분을 아미나 출력값에 맞추면 될꺼에요
확인방법은 마이페이지>오픈API>개발계정>감염현황>미리보기 를 통해서
데이터를 불러오는지 확인해주세요
데이터를 불러오지못해 출력할 데이터가없어서 발생하는 오류입니다
오류가 있네요 number_format을 모두 제거하면 foreach 관련 이슈가 있네요
5.3.3.3.1 아미나입니다
number_format을 제거한다고 아무런 문제가 되지않습니다. 오히려 썼을때 문제가되어야하는데요 허헣..
corona_status_embed_fn_script 함수에서 스크립트부분에 출력 스크립트가 있는데 여기부분을 아미나 출력값에 맞추면 될꺼에요
이부분은 무슨 말인지. 이해를 못해서. 좀더 흰트를 주시면.. 다시 도전해 보고 싶습니다.
가능하면.. 메인페이지에 출력을 하고 싶은데.. 방법을 조금만 부탁 드려봐도 될런지요.
그렇기에 해당코드 82번째줄부터 출력 스크립트가있습니다
'#bo_list' , '#<?php echo $aside_id; ?>'
차례대로 게시판상단출력, 오른쪽유저바출력 입니다
'.corona_view_link'은 안건드셔도 되구요
이부분을 아미나에 맞는 클래스 혹은 아이디값으로 해주시면되는데 아미나의 경우 위치값이 아이디값이 있는것이없고 모두다 클래스로 되어있어서..... 직접 넣고자하는 부분의 id값을 만들고 위에 말씀드린 부분에다가 위치를 넣어주셔야합니다
이미 잡혀있는 클래스로 해도되긴한데 클래스라서... 어디든 붙을수있다는게 단점이네요 그래서 id값으로 확실하게 여기 붙이겠다 선언해주시는게 좋아보입니다
하시다가 막히시면 언제든지 말씀해주세요
이제.. 위치값 잡는것에 도전중입니다. 감사합니다.
--------------------▼ 도움받은 내용 ▼---------------------
1. 대강 보니 해당 자료 자체가 게시판 아이디가 corona19 인 경우에만 작동하도록 되어 있네요. 그러니 게시판 아이디가 corona19 인 게시판은 반드시 존재해야 하고...
2. 게시판이 아니라 메인 등에서 따로 지정하고 싶으면 $bo_table 값과 출력된 곳의 id를 bo_list 와 <?php echo $aside_id; ?> 로 지정해 줘야 하네요. 이 아이디 앞뒤로 결과값이 붙도록 되어 있어서...
3. 그러니 메인에 넣고 싶으면 아래처럼 되어야 할 듯...
<?php
$bo_table = 'corona19'; //게시판 지정
include_once(G5_PATH.'/plugin/corona19/corona19.php');
//결과 출력
?>
<div id="bo_list"></div>
4. 그리고 사이드쪽에 출력될 곳도 <div id="임의아이디"></div> 라고 해 주고, 지정한 아이디로 설정해 주면 될 듯...
Warning: Invalid argument supplied for foreach() in /host/home4/tstock/html/plugin/corona19/corona19.php on line 171
확진자수
foreach ($data['body']['items']['item'] as $row){
공공데이터 포털에서 데이터를 못가져오는것같은데
흠... 테스트할때는 한시간 정도 텀이면 트래픽 충분했는데 트래픽이 꽤 잘걸리나보네요
공공데이터포털에서 데이터가안뜬다면 트래픽 제한에 걸린거니 활용신청을 해주시거나 109번째줄에 "+1 hours"을 2나3으로해서 두시간 세시간 텀으로 바꿔주셔야할것같아요
어제는 잘되던데..ㅠ.ㅠ
미리보기할때 날짜는 어제~오늘날짜로 해주시고 미리보기눌러서 데이터가 떠야합니다
잘 해결되었습니다. 감사합니다.
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'examCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCompCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'resutlNegCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 176
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 183
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'examCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCompCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'resutlNegCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 176
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 183
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'examCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCompCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'resutlNegCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 176
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 183
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'examCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCompCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'resutlNegCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 176
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 183
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 173
Warning: Illegal string offset 'accExamCnt' in /host/home
값이없을때 예외처리를 했었어야했는데 빼먹었네요
if($row['stateDt'] == $startCreateDt){
if( empty($row) ) continue;
$data_row['yesterday'][$yesterday]['decideCnt'] = $row['decideCnt'];
$data_row['yesterday'][$yesterday]['data'] = $Data;
$yesterday++;
}
이렇게 넣었는데 12시 좀 넘으니 또 우르르 에러가 나오네요
if( empty($row) ) continue;
이렇게 넣어도 안되네요
이렇게 넣으니까 절반은 줄어들었네요..
Warning: Illegal string offset 'decideCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'deathCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'clearCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'careCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'accExamCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'examCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'accExamCompCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'resutlNegCnt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 174
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 177
Warning: Illegal string offset 'stateDt' in /host/home4/tstock/html/plugin/corona19/corona19.php on line 184
이렇게 나옴
//확진자, 사망자, 격리해제, 치료중, 총검사자, 검사중, 총검사완료, 결과음성
// $Data = $row['decideCnt'].'|'.$row['deathCnt'].'|'.$row['clearCnt'].'|'.$row['careCnt'].'|'.$row['accExamCnt'].'|'.$row['examCnt'].'|'.$row['accExamCompCnt'].'|'.$row['resutlNegCnt'];
//어제 날짜와 같은경우
// if($row['stateDt'] == $startCreateDt) {
// $data_row['yesterday'][$yesterday]['decideCnt'] = $row['decideCnt'];
// $data_row['yesterday'][$yesterday]['data'] = $Data;
// $yesterday++;
// }
//오늘 날짜와 같은경우
// if($row['stateDt'] == $endCreateDt) {
// $data_row['today'][$today]['decideCnt'] = $row['decideCnt'];
// $data_row['today'][$today]['data'] = $Data;
// $today++;
// }
이렇게 한번해보세요 foreach문을 if($data['body']['items']['item'][0]['decideCnt'] !== '')로 감싸주세요
업데이트가 안되는건아니고 12시쯤 데이터가 없을때 빈값배열에 대한 오류니까 발생하는것같네요
한번만 봐주세요..
<response>
<header>
<resultCode>00</resultCode>
<resultMsg>NORMAL SERVICE.</resultMsg>
</header>
<body>
<items>
<item>
<accDefRate>1.5098498054</accDefRate>
<accExamCnt>4689616</accExamCnt>
<accExamCompCnt>4503693</accExamCompCnt>
<careCnt>17575</careCnt>
<clearCnt>49324</clearCnt>
<createDt>2021-01-09 09:41:10.876</createDt>
<deathCnt>1100</deathCnt>
<decideCnt>67999</decideCnt>
<examCnt>185923</examCnt>
<resutlNegCnt>4435694</resutlNegCnt>
<seq>380</seq>
<stateDt>20210109</stateDt>
<stateTime>00:00</stateTime>
<updateDt>null</updateDt>
</item>
</items>
<numOfRows>10</numOfRows>
<pageNo>1</pageNo>
<totalCount>1</totalCount>
</body>
</response>
$xml = is_array($response);
이렇게 수정후 그아래줄에
foreach문을
if(!empty($data['body']['items']['item'])){
감싸주세요 그럼 php5.4버전에서 일어나는 오류는 잡아집니다
공공데이터포털에서 주말동안의 21.04.24 ~ 21.04.25 자료가 넘어오질 않아서 현재 날짜의 정보가업데이트가 안되고있습니다....
내일 되면 정상적으로 노출이 될껍니다
해당 오류를 고쳐서 업로드하고자했으나.. 이전날짜 정보가 없으면 어차피 안맞는건 똑같으므로 그냥 두었습니다 참고하시길 바랍니다.