1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * [WeEngine System] Copyright (c) 2014 WE7.CC
- * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
- */
- defined('IN_IA') or exit('Access Denied');
- function visit_update_today($type, $module_name = '') {
- global $_W;
- $module_name = trim($module_name);
- $type = trim($type);
- if (empty($type) || !in_array($type, array('app', 'web', 'api'))) {
- return false;
- }
- if ($type == 'app' && empty($module_name)) {
- return false;
- }
- $today = date('Ymd');
- $today_exist = pdo_get('stat_visit', array('date' => $today, 'uniacid' => $_W['uniacid'], 'module' => $module_name, 'type' => $type));
- if (empty($today_exist)) {
- $insert_data = array(
- 'uniacid' => $_W['uniacid'],
- 'module' => $module_name,
- 'type' => $type,
- 'date' => $today,
- 'count' => 1
- );
- pdo_insert('stat_visit', $insert_data);
- } else {
- $data = array('count' => $today_exist['count'] + 1);
- pdo_update('stat_visit' , $data, array('id' => $today_exist['id']));
- }
- return true;
- }
|