USE `{dataname}`;
Set names gbk;
CREATE TABLE IF NOT EXISTS `{tableprefix}ad` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `title` varchar(50) NOT NULL COMMENT '广告标题',  `content` text NOT NULL COMMENT '自定义html,或图片广告',  `starttime` int(12) NOT NULL COMMENT '广告开始时间',  `endtime` int(12) NOT NULL COMMENT '广告结束时间\r\n',  `adindex` varchar(20) NOT NULL COMMENT '唯一标志符',  PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='广告表'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}bizgroup` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `cityid` varchar(20) NOT NULL,  `bizname` varchar(30) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}catelist` (  `id` int(2) NOT NULL AUTO_INCREMENT,  `catename` varchar(32) NOT NULL,  `sortorder` int(5) NOT NULL,  `keywords` text NOT NULL,  `parentid` int(11) NOT NULL,  `recommend` tinyint(1) NOT NULL,  `css` varchar(50) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='商品分类表';
CREATE TABLE IF NOT EXISTS `{tableprefix}city` (  `cityid` int(11) NOT NULL AUTO_INCREMENT,  `cityname` varchar(32) NOT NULL,  `sortorder` int(5) NOT NULL,  `pinyin` varchar(32) NOT NULL,  `isshow` int(1) NOT NULL DEFAULT '0',  PRIMARY KEY (`cityid`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='城市表'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}dolog` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `uid` int(11) NOT NULL,  `username` char(32) NOT NULL COMMENT '用户名',  `lastdo` char(200) NOT NULL COMMENT '最后操作',  `lastip` char(32) NOT NULL COMMENT '操作ip',  `lasttime` int(11) NOT NULL COMMENT '最后时间',  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='用户操作日志'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}groups` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `subject` varchar(100) NOT NULL,  `shortsubject` varchar(32) NOT NULL,  `siteid` int(5) NOT NULL,  `groupsite` varchar(32) NOT NULL,  `url` varchar(100) NOT NULL,  `thumb` varchar(200) NOT NULL,  `oldprice` float NOT NULL,  `nowprice` float NOT NULL,  `discount` float NOT NULL,  `lasttime` int(12) NOT NULL,  `starttime` int(11) NOT NULL,  `sortorder` int(3) NOT NULL,  `cityid` char(32) NOT NULL,  `hits` int(11) NOT NULL,  `ispassed` int(11) NOT NULL,  `userid` int(5) NOT NULL,  `keyword` varchar(50) NOT NULL,  `updatetime` int(11) NOT NULL,  `cityname` varchar(32) NOT NULL,  `citysname` varchar(300) NOT NULL,  `recommend` int(1) NOT NULL,  `nowpeople` int(10) NOT NULL,  `commentcount` int(10) NOT NULL,  `favcount` int(10) NOT NULL,  `bizgroup` int(11) NOT NULL,  `bizname` char(20) NOT NULL,  `big_catelist` int(11) NOT NULL,  `small_catelist` int(11) NOT NULL,  `big_catelist_catename` char(50) NOT NULL,  `small_catelist_catename` char(50) NOT NULL,  `groupkey` char(32) NOT NULL,  `temporder` int(11) NOT NULL,  PRIMARY KEY (`id`),  UNIQUE KEY `groupkey` (`groupkey`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='商品表，最主要的'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}link` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `title` varchar(32) NOT NULL,  `url` varchar(100) NOT NULL,  `decs` varchar(200) NOT NULL,  `type` smallint(1) NOT NULL,  `thumb` varchar(50) NOT NULL,  `sortorder` int(4) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=gbk  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}othersite` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `sitename` varchar(50) NOT NULL,  `url` varchar(200) DEFAULT NULL,  `img` varchar(100) NOT NULL,  `cate` int(11) NOT NULL,  `istop` int(11) NOT NULL,  `recommend` int(11) NOT NULL,  `color` varchar(20) NOT NULL,  `font` varchar(20) NOT NULL,  `sort` int(11) NOT NULL DEFAULT '0',  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}plugins` (  `id` tinyint(4) NOT NULL AUTO_INCREMENT,  `pluginsname` varchar(300) NOT NULL,  `isok` tinyint(1) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}setting` (  `variable` varchar(32) NOT NULL,  `content` text NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='系统设置表';
CREATE TABLE IF NOT EXISTS `{tableprefix}site` (  `id` int(5) NOT NULL AUTO_INCREMENT,  `sitename` varchar(32) NOT NULL,  `siteurl` varchar(200) DEFAULT NULL,  `breakurl` varchar(200) NOT NULL,  `sitetype` int(3) NOT NULL,  `cityid` text NOT NULL,  `sort` int(4) NOT NULL,  `pinyin` char(2) NOT NULL,  `siteapi` varchar(200) NOT NULL,  `localapi` varchar(200) DEFAULT NULL,  `apikey` char(10) NOT NULL,  `apirep` varchar(500) NOT NULL,  `css` varchar(100) NOT NULL,  `recommend` int(1) NOT NULL,  `isallowed` smallint(1) NOT NULL DEFAULT '1',  `cityapi` varchar(200) NOT NULL,  `cityrep` varchar(300) NOT NULL,  `citysiteapi` varchar(200) NOT NULL,  `qq` varchar(32) NOT NULL,  `msn` varchar(32) NOT NULL,  `tel` varchar(32) NOT NULL,  `level` smallint(5) NOT NULL,  `logo` varchar(100) NOT NULL,  `email` varchar(50) NOT NULL,  `goodorder` int(11) NOT NULL,  `gather_method` char(10) DEFAULT '0',  `breaksuff` varchar(200) NOT NULL,  `limitcity` varchar(300) NOT NULL,  `limitnum` tinyint(5) NOT NULL,  `transkey` int(11) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='网站列表';
CREATE TABLE IF NOT EXISTS `{tableprefix}sitecate` (  `id` int(2) NOT NULL AUTO_INCREMENT,  `sitecatename` varchar(32) NOT NULL,  `sortorder` int(5) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='网站分类表'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}tempsite` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `subject` varchar(100) NOT NULL,  `shortsubject` varchar(32) NOT NULL,  `siteid` int(5) NOT NULL,  `groupsite` varchar(32) NOT NULL,  `url` varchar(100) NOT NULL,  `thumb` varchar(200) NOT NULL,  `oldprice` float NOT NULL,  `nowprice` float NOT NULL,  `discount` float NOT NULL,  `lasttime` int(12) DEFAULT NULL,  `starttime` int(11) DEFAULT NULL,  `sortorder` int(3) NOT NULL,  `cityid` char(32) NOT NULL,  `keyword` varchar(50) NOT NULL,  `updatetime` int(11) NOT NULL,  `cityname` varchar(32) NOT NULL,  `citysname` varchar(300) NOT NULL,  `recommend` int(1) NOT NULL,  `nowpeople` int(10) NOT NULL,  `bizgroup` int(11) NOT NULL,  `bizname` char(20) NOT NULL,  `big_catelist` int(11) NOT NULL,  `small_catelist` int(11) NOT NULL,  `big_catelist_catename` char(50) NOT NULL,  `small_catelist_catename` char(50) NOT NULL,  `groupkey` char(32) NOT NULL,  PRIMARY KEY (`id`),  UNIQUE KEY `groupkey` (`groupkey`)) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='商品表，最主要的'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}user` (  `uid` int(11) NOT NULL AUTO_INCREMENT,  `email` varchar(50) NOT NULL,  `phone` varchar(11) DEFAULT NULL,  `sex` tinyint(1) NOT NULL DEFAULT '0',  `qq` varchar(11) DEFAULT NULL,  `address` char(200) DEFAULT NULL,  `zip` varchar(10) DEFAULT NULL,  `pwd` varchar(20) NOT NULL,  `connect_user` varchar(32) NOT NULL,  `connect_content` varchar(100) NOT NULL,  `updatetime` int(11) NOT NULL,  `usertype` varchar(10) NOT NULL,  `logtime` int(11) NOT NULL,  `username` varchar(50) NOT NULL,  `allowed` smallint(1) NOT NULL,  `money` float(10,2) NOT NULL DEFAULT '0.00',  PRIMARY KEY (`uid`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='会员表，管理员表'  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}user_group` (  `groupid` int(11) NOT NULL AUTO_INCREMENT,  `groupname` varchar(20) NOT NULL,  `groupkey` varchar(32) NOT NULL,  PRIMARY KEY (`groupid`),  UNIQUE KEY `groupkey` (`groupkey`)) ENGINE=MyISAM  DEFAULT CHARSET=gbk  ;
CREATE TABLE IF NOT EXISTS `{tableprefix}user_g_r` (  `roleid` text NOT NULL,  `groupid` varchar(32) NOT NULL,  PRIMARY KEY (`groupid`)) ENGINE=MyISAM DEFAULT CHARSET=gbk;
CREATE TABLE IF NOT EXISTS `{tableprefix}user_role` (  `roleid` int(11) NOT NULL AUTO_INCREMENT,  `rolename` varchar(32) NOT NULL,  `rolekey` varchar(32) NOT NULL,  `roletype` varchar(32) NOT NULL,  PRIMARY KEY (`roleid`),  UNIQUE KEY `rolekey` (`rolekey`)) ENGINE=MyISAM DEFAULT CHARSET=gbk  ;
INSERT INTO `{tableprefix}user_group` (`groupid`, `groupname`, `groupkey`) VALUES(1, '管理员', 'adminuser'),(2, '商家', 'siteuser'),(3, '普通会员', 'normaluser');