<?php
/**
 * 公共设置
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author zhaoh <1070309178@qq.com>
 */
namespace Home\Controller;
use Think\Controller;
class PublicController extends BaseController {
	/**
     * 访问量
     */
	public function count(){
		$getdata=I('get.');
        if(!$getdata['name'] || !$getdata['id'])return false;
        $countdiv=!empty($getdata['div'])?$getdata['div']:'';
        $ip = get_client_ip();
        $sessionname=md5($ip.$getdata['name'].$getdata['id']);
        $session=session();
        $value=session($sessionname);
        if(!$value){
           $mod=M($getdata['name']);
           $where['id']=$getdata['id'];
           $mod->where($where)->setInc('count');
           $valueinfo= $mod->where($where)->field('count')->find();
           $value=$valueinfo['count'];
           session($sessionname,$value);
        }
		if($countdiv){
            $str="$('.".$countdiv."').html(".$value.")";
            format_js($str);
        }
	}
    /** 后台主页*/
    public function map(){
        $this->assign(I('param.'));
        $this->display();
	}
}