Beispiel #1
0
 public function view_index()
 {
     $data = WebAdStatAct::actIndex();
     $this->smarty->assign('title', '网站广告统计');
     $this->smarty->assign('key', $data['key']);
     $this->smarty->assign('type', $data['type']);
     $this->smarty->assign('adId', $data['adId']);
     $this->smarty->assign('lists', $data['lists']);
     $this->smarty->assign('adList', $data['adList']);
     $this->smarty->assign('pageStr', $data['pages']);
     $this->smarty->assign('pageStr', $data['pages']);
     $this->smarty->assign('timeNode', $data['timeNode']);
     $this->smarty->assign('startTimeValue', $data['startTime']);
     $this->smarty->assign('endTimeValue', $data['endTime']);
     $this->smarty->display('admin/webAdStat.htm');
 }
Beispiel #2
0
 /**
  * WebAdStatAct::act_webAdStat()
  * 记录网站广告点击
  * @param string $ids 广告ID
  * @return array;
  */
 public function act_webAdStat()
 {
     $ids = isset($_REQUEST["ids"]) ? post_check($_REQUEST["ids"]) : "";
     $ip = getClientIP();
     $ipNum = sprintf('%u', ip2long($ip));
     if (empty($ids) || !preg_match("/^([\\d]+,)*[\\d]\$/", $ids)) {
         self::$errCode = "广告ID参数有误!";
         self::$errMsg = 10000;
         return false;
     }
     $res = WebAdStatModel::showIpAdStat($ipNum, $ids);
     $stats = isset($res['count']) ? $res['count'] : 0;
     $times = time();
     if (empty($stats)) {
         $res = WebAdStatModel::updateStatInfo($ipNum, $ids, array("adId" => $ids, "ip" => $ip, "ipNum" => $ipNum, "count" => 1, "addTime" => $times, "lastTime" => $times));
     } else {
         $res = WebAdStatModel::updateStatInfo($ipNum, $ids, array("adId" => $ids, "ip" => $ip, "ipNum" => $ipNum, "count" => $stats + 1, "lastTime" => $times));
     }
     self::$errCode = WebAdStatModel::$errCode;
     self::$errMsg = WebAdStatModel::$errMsg;
     return $res;
 }