--
-- 数据库: `analytics`
--

-- --------------------------------------------------------

--
-- 表的结构 `analytics_historys`
--

CREATE TABLE IF NOT EXISTS `analytics_historys` (
  `h_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `h_visit_id` int(10) unsigned NOT NULL COMMENT '访客ID',
  `h_page_id` int(10) unsigned NOT NULL COMMENT '页面ID',
  `h_page_referer` varchar(255) DEFAULT NULL COMMENT '来路URL',
  `h_datetime` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`h_id`),
  KEY `lv_id` (`h_visit_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;

-- --------------------------------------------------------

--
-- 表的结构 `analytics_pages`
--

CREATE TABLE IF NOT EXISTS `analytics_pages` (
  `p_id` int(11) NOT NULL AUTO_INCREMENT,
  `p_site_code` varchar(30) DEFAULT NULL COMMENT '站点ID',
  `p_title` varchar(255) DEFAULT NULL COMMENT '页面标题',
  `p_url` varchar(255) DEFAULT NULL COMMENT '页面URL',
  `p_author` varchar(30) DEFAULT NULL COMMENT '作者',
  `p_hits` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击数',
  `p_datetime` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`p_id`),
  KEY `page_url` (`p_url`),
  KEY `page_hits` (`p_hits`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;

-- --------------------------------------------------------

--
-- 表的结构 `analytics_visits`
--

CREATE TABLE IF NOT EXISTS `analytics_visits` (
  `v_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `v_site_code` varchar(30) DEFAULT NULL COMMENT '站点ID',
  `v_user_ip` varchar(15) DEFAULT NULL COMMENT 'IP地址',
  `v_first_page_id` int(10) unsigned NOT NULL COMMENT '第一次访问的页面ID',
  `v_page_author` varchar(30) DEFAULT NULL,
  `v_leave_page_id` int(10) unsigned NOT NULL DEFAULT '0',
  `v_referer_url` text COMMENT '外部来路URL',
  `v_order_num` varchar(50) NOT NULL DEFAULT '0' COMMENT '订单号',
  `v_order_type` varchar(15) DEFAULT NULL,
  `v_datetime` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`v_id`),
  KEY `lv_order_num` (`v_order_num`),
  KEY `lv_page_author` (`v_page_author`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;