mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 21:29:58 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1211 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
970339b7d8
commit
76f599c69b
30 changed files with 456 additions and 32 deletions
|
|
@ -3,5 +3,6 @@
|
|||
<grants />
|
||||
<actions>
|
||||
<action name="dispCounterAdminIndex" type="view" admin_index="true" standalone="true" />
|
||||
<action name="procCounterExecute" type="controller" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,14 @@
|
|||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('counter', 'view', 'dispCounterAdminIndex');
|
||||
|
||||
$oCounterController = &getController('counter');
|
||||
|
||||
// 00000000000000 일자로 기록될 전체 방문 기록 row 추가
|
||||
$oCounterController->insertTodayStatus('00000000000000');
|
||||
|
||||
// 오늘자 row입력
|
||||
$oCounterController->insertTodayStatus();
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,18 +14,71 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 로그 등록
|
||||
* @brief 카운터 기록
|
||||
**/
|
||||
function insertLog() {
|
||||
return executeQuery('counter.insertCounterLog');
|
||||
function procCounterExecute() {
|
||||
// 로그를 검사
|
||||
$oCounterModel = &getModel('counter');
|
||||
|
||||
// 오늘자 row가 있는지 체크하여 없으면 등록
|
||||
if(!$oCounterModel->isInsertedTodayStatus()) {
|
||||
$this->insertTodayStatus();
|
||||
|
||||
// 기존 row가 있으면 사용자 체크
|
||||
} else {
|
||||
|
||||
// 등록되어 있지 않은 아이피일 경우
|
||||
if(!$oCounterModel->isLogged()) {
|
||||
// 로그 등록
|
||||
$this->insertLog();
|
||||
|
||||
// unique 및 pageview 등록
|
||||
$this->insertUniqueVisitor();
|
||||
} else {
|
||||
// pageview 등록
|
||||
$this->insertPageView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 현황 등록
|
||||
* @brief 로그 등록
|
||||
**/
|
||||
function insertStatus() {
|
||||
return executeQuery('counter.insertCounterStatus');
|
||||
function insertLog() {
|
||||
$args->regdate = date("YmdHis");
|
||||
$args->user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
return executeQuery('counter.insertCounterLog', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief unique visitor 등록
|
||||
**/
|
||||
function insertUniqueVisitor() {
|
||||
$args->regdate = date("Ymd000000");
|
||||
return executeQuery('counter.updateCounterUnique', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief pageview 등록
|
||||
**/
|
||||
function insertPageView() {
|
||||
$args->regdate = date("Ymd000000");
|
||||
return executeQuery('counter.updateCounterPageview', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 오늘자 카운터 status 추가
|
||||
**/
|
||||
function insertTodayStatus($regdate = 0) {
|
||||
if($regdate) $args->regdate = $regdate;
|
||||
else $args->regdate = date("Ymd000000");
|
||||
executeQuery('counter.insertTodayStatus', $args);
|
||||
|
||||
// 로그 등록
|
||||
$this->insertLog();
|
||||
|
||||
// unique 및 pageview 등록
|
||||
$this->insertUniqueVisitor();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,17 @@
|
|||
* @brief 로그 검사
|
||||
**/
|
||||
function isLogged() {
|
||||
$output = executeQuery('counter.getCounterLog');
|
||||
$args->regdate = date("Ymd");
|
||||
$output = executeQuery('counter.getCounterLog', $args);
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 오늘자 카운터 현황 row 있는지 체크
|
||||
**/
|
||||
function isInsertedTodayStatus() {
|
||||
$args->regdate = date("Ymd000000");
|
||||
$output = executeQuery('counter.getTodayStatus', $args);
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +35,19 @@
|
|||
* @brief 특정 일의 접속 통계를 가져옴
|
||||
**/
|
||||
function getStatus($regdate) {
|
||||
$args->regdate = $regdate;
|
||||
// 여러개의 날자 로그를 가져올 경우
|
||||
if(is_array($regdate)) {
|
||||
$date_count = count($regdate);
|
||||
for($i=0;$i<$date_count;$i++) {
|
||||
if(strlen($regdate[$i])==8) $regdate[$i] = $regdate[$i].'000000';
|
||||
$args->regdate = "'".implode("','",$regdate)."'";
|
||||
}
|
||||
// 단일 날자의 로그를 가져올 경우
|
||||
} else {
|
||||
if(strlen($regdate)==8) $regdate = $regdate.'000000';
|
||||
$args->regdate = $regdate;
|
||||
}
|
||||
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
return $output->data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<column name="count(*)" alias="count"/>
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="regdate" var="regdate" default="curdate()" notnull="notnull" />
|
||||
<condition operation="equal" column="ipaddress" var="ipaddress" default="ipaddress()" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="ipaddress" var="ipaddress" default="ipaddress()" notnull="notnull" />
|
||||
<condition operation="like_tail" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<query id="getCounterStatus.xml" action="select">
|
||||
<query id="getCounterStatus" action="select">
|
||||
<tables>
|
||||
<table name="counter_status" />
|
||||
</tables>
|
||||
|
|
@ -6,6 +6,6 @@
|
|||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" />
|
||||
<condition operation="in" column="regdate" var="regdate" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<table name="counter_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
<column name="regdate" var="regdate" default="curdate()" notnull="notnull"/>
|
||||
<column name="ipaddress" var="ipaddress" notnull="notnull" default="ipaddress()" />
|
||||
<column name="user_agent" var="user_agent" />
|
||||
</columns>
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<query id="insertCounterStatus" action="insert">
|
||||
<tables>
|
||||
<table name="counter_status" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
</columns>
|
||||
</query>
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<query id="updateCounterPageView" action="update">
|
||||
<query id="updateCounterPageview" action="update">
|
||||
<tables>
|
||||
<table name="counter_status" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="unique_visitor" default="plus(1)" />
|
||||
<column name="pageview" default="plus(1)" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="regdate" default="00000000000000" />
|
||||
<condition operation="equal" column="regdate" default="curdate()" pipe="or" />
|
||||
<condition operation="equal" column="regdate" notnull="notnull" default="00000000000000" />
|
||||
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="or" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<query id="updateCounterUnique" action="update">
|
||||
<tables>
|
||||
<table name="documents" />
|
||||
<table name="counter_status" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="unique_visitor" default="plus(1)" />
|
||||
<column name="pageview" default="plus(1)" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="regdate" default="00000000000000" />
|
||||
<condition operation="equal" column="regdate" default="curdate()" pipe="or" />
|
||||
<condition operation="equal" column="regdate" notnull="notnull" default="00000000000000" />
|
||||
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="or" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<table name="counter_log">
|
||||
<column name="regdate" type="date" index="idx_counter_log" />
|
||||
<column name="ipaddress" type="varchar" size="250" notnull="notnull" index="idx_counter_log" />
|
||||
<column name="regdate" type="date" index="idx_counter_log" />
|
||||
<column name="user_agent" type="varchar" size="250" />
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue