<?php
$conf_basedir = "../../../"; //相对主目录的位置
$conf_where = "admin"; //选择调用相应模块
$directory = basename(dirname(__FILE__)); //定义当前所在的目录，引入模块公用函数
include_once($conf_basedir . "base.inc.php");
include_once WEB_MODULE . '/growth/base.inc.php';

$sql = "
--
-- 表的结构 `block_level_heat`
--

CREATE TABLE IF NOT EXISTS `block_level_heat` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `block_id` int(10) unsigned NOT NULL default '0' COMMENT '小区id',
  `level` enum('A','B','C','D') NOT NULL COMMENT '小区热度等级，对应小区热度设置表level字段',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `block_id` (`block_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区热度等级表' ;

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

--
-- 表的结构 `block_level_heat_copy`
--

CREATE TABLE IF NOT EXISTS `block_level_heat_copy` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `block_id` int(10) unsigned NOT NULL default '0' COMMENT '小区id',
  `level` enum('A','B','C','D') NOT NULL COMMENT '小区热度等级，对应小区热度设置表level字段',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `block_id` (`block_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区热度等级表';

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

--
-- 表的结构 `block_level_heat_setting`
--

CREATE TABLE IF NOT EXISTS `block_level_heat_setting` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `level` enum('A','B','C','D') default NULL COMMENT '小区热度等级',
  `pv` bigint(20) unsigned NOT NULL default '0' COMMENT '小区pv值',
  `house_number` int(10) unsigned NOT NULL default '0' COMMENT '小区房源量',
  `credit_way_alias` varchar(50) NOT NULL COMMENT '积分获取途径别名',
  `exp_way_alias` varchar(50) NOT NULL COMMENT '成长值获取方式别名',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='按热度（pv和房源量）分小区等级的设置表';

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

--
-- 表的结构 `block_level_info_full`
--

CREATE TABLE IF NOT EXISTS `block_level_info_full` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `block_id` int(10) unsigned NOT NULL default '0' COMMENT '小区id',
  `level` enum('★','★★','★★★','★★★★') NOT NULL COMMENT '小区资料完善度等级，对应小区完善度设置表level字段',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区完善度等级表' ;

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

--
-- 表的结构 `block_level_info_full_copy`
--

CREATE TABLE IF NOT EXISTS `block_level_info_full_copy` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `block_id` int(10) unsigned NOT NULL default '0' COMMENT '小区id',
  `level` enum('★','★★','★★★','★★★★') NOT NULL COMMENT '小区资料完善度等级，对应小区完善度设置表level字段',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区完善度等级表' ;

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

--
-- 表的结构 `block_level_info_full_setting`
--

CREATE TABLE IF NOT EXISTS `block_level_info_full_setting` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `level` enum('★','★★','★★★','★★★★') default NULL COMMENT '小区资料完善度等级',
  `not_filled_items_number` tinyint(3) unsigned NOT NULL default '0' COMMENT '未完善项数量',
  `image_number` int(10) unsigned NOT NULL default '0' COMMENT '小区图片数量',
  `credit_way_alias` varchar(50) NOT NULL COMMENT '积分获取途径别名',
  `exp_way_alias` varchar(50) NOT NULL COMMENT '成长值获取方式别名',
  `type` tinyint(3) unsigned NOT NULL default '1' COMMENT '1,完善小区资料，2完善小区图片',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `l_t` USING BTREE (`level`,`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='按资料完善度（未完善项和小区图片数量）分小区等级的设置表' ;

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

--
-- 表的结构 `growth_activity_promot`
--

CREATE TABLE IF NOT EXISTS `growth_activity_promot` (
  `id` int(3) NOT NULL auto_increment,
  `uid` int(10) NOT NULL,
  `username` varchar(30) NOT NULL,
  `createtime` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='预热活动名单' ;

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

--
-- 表的结构 `growth_bid_attention`
--

CREATE TABLE IF NOT EXISTS `growth_bid_attention` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '期次',
  `type` tinyint(3) unsigned NOT NULL default '1' COMMENT '1，小区专家竞投；2,房源竞投',
  `target_id` int(11) NOT NULL COMMENT '竞投id',
  `house_id` int(11) NOT NULL COMMENT '房源编号',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`target_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='关注竞投表' ;

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

--
-- 表的结构 `growth_bid_block_expert`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期数id',
  `block_id` int(11) default NULL COMMENT '如果是小区专家这里是小区id',
  `block_level` varchar(2) default NULL COMMENT '小区等级A,B,C,D',
  `broker_level` varchar(100) default NULL COMMENT '可以参与的经纪人等级',
  `valid` tinyint(4) default NULL COMMENT '是否停止（有效，没效）',
  `number` int(10) unsigned NOT NULL default '0' COMMENT '参与的人数',
  `min_score` int(10) unsigned NOT NULL default '0' COMMENT '最低参与积分',
  `max_win_number` tinyint(4) default NULL COMMENT '最多取多少竞投成功人数',
  `ctime` timestamp NULL default NULL COMMENT '创建时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='小区专家竞投表' ;

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

--
-- 表的结构 `growth_bid_block_expert_bak`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert_bak` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期数id',
  `block_id` int(11) default NULL COMMENT '如果是小区专家这里是小区id',
  `block_level` varchar(2) default NULL COMMENT '小区等级A,B,C,D',
  `broker_level` varchar(100) default NULL COMMENT '可以参与的经纪人等级',
  `valid` tinyint(4) default NULL COMMENT '是否停止（有效，没效）',
  `number` int(10) unsigned NOT NULL default '0' COMMENT '参与的人数',
  `min_score` int(10) unsigned NOT NULL default '0' COMMENT '最低参与积分',
  `max_win_number` tinyint(4) default NULL COMMENT '最多取多少竞投成功人数',
  `ctime` timestamp NULL default NULL COMMENT '创建时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='小区专家竞投表' ;

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

--
-- 表的结构 `growth_bid_block_expert_record_finish`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert_record_finish` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `block_id` int(11) NOT NULL COMMENT '小区的id',
  `block_name` varchar(30) NOT NULL COMMENT '小区名称',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `tg_start_time` datetime NOT NULL COMMENT '推广开始时间',
  `tg_end_time` datetime NOT NULL COMMENT '推广的结束时间',
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`block_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投小区专家成功记录' ;

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

--
-- 表的结构 `growth_bid_block_expert_record_history`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert_record_history` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期次id',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `block_id` int(11) NOT NULL COMMENT '小区id',
  `block_name` varchar(30) NOT NULL COMMENT '小区名称',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '1' COMMENT '0,竞投中时根据名次判断,1,成功，-1,失败，',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `b_b_h` (`broker_id`,`bid_id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`bid_id`),
  KEY `b_s` (`bid_id`,`score`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投中小区专家记录' ;

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

--
-- 表的结构 `growth_bid_block_expert_record_history_bak`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert_record_history_bak` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期次id',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `block_id` int(11) NOT NULL COMMENT '小区id',
  `block_name` varchar(30) NOT NULL COMMENT '小区名称',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '1' COMMENT '0,竞投中时根据名次判断,1,成功，-1,失败，',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `b_b_h` (`broker_id`,`bid_id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`bid_id`),
  KEY `b_s` (`bid_id`,`score`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投中小区专家记录' ;

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

--
-- 表的结构 `growth_bid_block_expert_record_on`
--

CREATE TABLE IF NOT EXISTS `growth_bid_block_expert_record_on` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期次id',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `block_id` int(11) NOT NULL COMMENT '小区id',
  `block_name` varchar(30) NOT NULL COMMENT '小区名称',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '1' COMMENT '0,竞投中时根据名次判断,1,成功，-1,失败，',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `b_b_h` (`broker_id`,`bid_id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`bid_id`),
  KEY `b_s` (`bid_id`,`score`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投中小区专家记录' ;

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

--
-- 表的结构 `growth_bid_broker_user`
--

CREATE TABLE IF NOT EXISTS `growth_bid_broker_user` (
  `id` int(11) NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投类型1,小区专家，2房源竞投',
  `broker_id` int(11) NOT NULL COMMENT '经纪人编号',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '最后一次竞投时间',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `type` (`type`,`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='记录有哪些经纪人参加过竞投' ;

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

--
-- 表的结构 `growth_bid_follow`
--

CREATE TABLE IF NOT EXISTS `growth_bid_follow` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `type` tinyint(3) unsigned NOT NULL default '1' COMMENT '1，小区专家竞投；2,房源竞投',
  `target_id` int(11) NOT NULL COMMENT '竞投id',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`target_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='关注竞投表' ;

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

--
-- 表的结构 `growth_bid_hotsearch_set`
--

CREATE TABLE IF NOT EXISTS `growth_bid_hotsearch_set` (
  `id` int(11) NOT NULL auto_increment,
  `type` tinyint(6) NOT NULL default '1' COMMENT '1表示sell, 2表示出租',
  `words` varchar(50) NOT NULL COMMENT '热搜词',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '修改热搜词的时间',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `type` (`type`,`words`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='设置竞投热词表' ;

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

--
-- 表的结构 `growth_bid_house`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT '1,小区词，2,热搜词，3,板块词',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期数id',
  `block_id` int(11) default NULL COMMENT '如果是小区专家这里是小区id',
  `block_level` varchar(2) default NULL COMMENT '小区等级A,B,C,D',
  `keyword` varchar(50) default NULL COMMENT '热搜词',
  `broker_level` varchar(100) default NULL COMMENT '可以参与的经纪人等级',
  `valid` tinyint(4) default NULL COMMENT '是否停止（有效，没效）',
  `number` int(10) unsigned NOT NULL default '0' COMMENT '参与的人数',
  `min_score` int(10) unsigned NOT NULL default '0' COMMENT '最低参与积分',
  `max_win_number` tinyint(4) default NULL COMMENT '最多取多少竞投成功人数',
  `ctime` timestamp NULL default NULL COMMENT '创建时间',
  PRIMARY KEY  (`id`),
  KEY `type` (`type`,`bid_periods_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='房源竞投表' ;

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

--
-- 表的结构 `growth_bid_house_bak`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_bak` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT '1,小区词，2,热搜词，3,板块词',
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期数id',
  `block_id` int(11) default NULL COMMENT '如果是小区专家这里是小区id',
  `block_level` varchar(2) default NULL COMMENT '小区等级A,B,C,D',
  `keyword` varchar(50) default NULL COMMENT '热搜词',
  `broker_level` varchar(100) default NULL COMMENT '可以参与的经纪人等级',
  `valid` tinyint(4) default NULL COMMENT '是否停止（有效，没效）',
  `number` int(10) unsigned NOT NULL default '0' COMMENT '参与的人数',
  `min_score` int(10) unsigned NOT NULL default '0' COMMENT '最低参与积分',
  `max_win_number` tinyint(4) default NULL COMMENT '最多取多少竞投成功人数',
  `ctime` timestamp NULL default NULL COMMENT '创建时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='房源竞投表' ;

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

--
-- 表的结构 `growth_bid_house_level`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_level` (
  `id` int(11) NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 房源竞投类型1,小区词，2,热搜词',
  `levels` varchar(250) NOT NULL COMMENT '等级',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `type` (`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='房源竞投操作权限表' ;

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

--
-- 表的结构 `growth_bid_house_record_finish`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_record_finish` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投词类型 1小区词，2热搜词，3板块词',
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `house_id` int(11) NOT NULL COMMENT '参与竞投的房源编号',
  `keyword` varchar(50) NOT NULL COMMENT '竞投的词语',
  `tg_start_time` datetime NOT NULL COMMENT '推广开始时间',
  `tg_end_time` datetime NOT NULL COMMENT '推广结束时间',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`),
  KEY `ktt` (`keyword`,`tg_start_time`,`tg_end_time`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投房源成功记录' ;

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

--
-- 表的结构 `growth_bid_house_record_history`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_record_history` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(11) NOT NULL COMMENT '竞投期数id',
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投词类型 1小区词，2热搜词，3板块词',
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `house_id` int(11) NOT NULL COMMENT '参与竞投的房源编号',
  `content` varchar(255) NOT NULL COMMENT '房源的基本信息',
  `blockname` varchar(255) NOT NULL COMMENT '小区名称',
  `infotype` smallint(6) NOT NULL COMMENT '物业类型',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '0' COMMENT '1,竞投成功，-1,竞投失败',
  PRIMARY KEY  (`id`),
  KEY `bid_id` (`bid_id`),
  KEY `bbh` (`bid_periods_id`,`bid_id`,`house_id`),
  KEY `bb` (`bid_periods_id`,`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投房源历史记录' ;

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

--
-- 表的结构 `growth_bid_house_record_history_bak`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_record_history_bak` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(11) NOT NULL COMMENT '竞投期数id',
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投词类型 1小区词，2热搜词，3板块词',
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `house_id` int(11) NOT NULL COMMENT '参与竞投的房源编号',
  `content` varchar(255) NOT NULL COMMENT '房源的基本信息',
  `blockname` varchar(255) NOT NULL COMMENT '小区名称',
  `infotype` smallint(6) NOT NULL COMMENT '物业类型',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '0' COMMENT '1,竞投成功，-1,竞投失败',
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`),
  KEY `bid_id` (`bid_id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='竞投房源历史记录' ;

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

--
-- 表的结构 `growth_bid_house_record_on`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_record_on` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(11) NOT NULL COMMENT '竞投期数id',
  `type` tinyint(4) NOT NULL COMMENT '1,小区词，2,热搜词，3,板块词',
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `house_id` int(11) NOT NULL COMMENT '参与竞投的房源编号',
  `content` varchar(255) NOT NULL COMMENT '房源编号为houseid下房源的信息',
  `blockname` varchar(255) NOT NULL COMMENT '小区名称',
  `infotype` tinyint(4) NOT NULL COMMENT '物业类型',
  `bid_id` int(11) NOT NULL COMMENT '竞投的id',
  `score` int(11) NOT NULL COMMENT '投入的分数',
  `utime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(4) NOT NULL default '1' COMMENT '0,竞投中时根据名次判断,1,成功，-1,失败，',
  PRIMARY KEY  (`id`),
  KEY `bid_id` (`bid_id`),
  KEY `bbh` (`bid_periods_id`,`broker_id`,`house_id`),
  KEY `bb` (`bid_periods_id`,`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='房源竞投中记录' ;

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

--
-- 表的结构 `growth_bid_house_street`
--

CREATE TABLE IF NOT EXISTS `growth_bid_house_street` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `bid_periods_id` int(10) unsigned NOT NULL COMMENT '竞投期数id',
  `street_id` int(11) default NULL COMMENT '如果是小区专家这里是小区id',
  `broker_level` varchar(100) default NULL COMMENT '可以参与的经纪人等级',
  `valid` tinyint(4) default NULL COMMENT '是否停止（有效，没效）',
  `number` int(10) unsigned NOT NULL default '0' COMMENT '参与的人数',
  `min_score` int(10) unsigned NOT NULL default '0' COMMENT '最低参与积分',
  `max_win_number` tinyint(4) default NULL COMMENT '最多取多少竞投成功人数',
  `ctime` timestamp NULL default NULL COMMENT '创建时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='竞投板块词' ;

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

--
-- 表的结构 `growth_bid_low_level`
--

CREATE TABLE IF NOT EXISTS `growth_bid_low_level` (
  `id` int(11) NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投类型1,小区专家，2,房源竞投',
  `level` varchar(20) NOT NULL COMMENT '等级',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `type` (`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投最低操作权限表' ;

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

--
-- 表的结构 `growth_bid_message`
--

CREATE TABLE IF NOT EXISTS `growth_bid_message` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) unsigned NOT NULL COMMENT '经纪人id',
  `type` tinyint(4) NOT NULL COMMENT '1,成功消息，2失败消息，3被超过消息',
  `message` blob NOT NULL COMMENT '消息主体',
  `readflag` tinyint(4) NOT NULL default '0' COMMENT '是否读过，1读过，2未读',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '消息时间',
  PRIMARY KEY  (`id`),
  KEY `broker_id` (`broker_id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='竞投消息表' ;

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

--
-- 表的结构 `growth_bid_periods`
--

CREATE TABLE IF NOT EXISTS `growth_bid_periods` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投类型1,小区专家，2,房源竞投',
  `name` varchar(20) default '0' COMMENT '第几期竞投，或者其他描述',
  `start_time` datetime NOT NULL COMMENT '投票开始时间',
  `end_time` datetime NOT NULL COMMENT '投票结束时间',
  `tg_start_time` datetime NOT NULL COMMENT '推广开始时间',
  `tg_end_time` datetime NOT NULL COMMENT '推广结束时间',
  `valid` tinyint(4) NOT NULL default '1' COMMENT '是否停止（有效，没效）1,有效，0无效',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY  (`id`),
  KEY `type` (`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='竞投期次信息' ;

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

--
-- 表的结构 `growth_bid_periods_bak`
--

CREATE TABLE IF NOT EXISTS `growth_bid_periods_bak` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) NOT NULL COMMENT 'type 竞投类型1,小区专家，2,房源竞投',
  `name` varchar(20) default '0' COMMENT '第几期竞投，或者其他描述',
  `start_time` datetime NOT NULL COMMENT '投票开始时间',
  `end_time` datetime NOT NULL COMMENT '投票结束时间',
  `tg_start_time` datetime NOT NULL COMMENT '推广开始时间',
  `tg_end_time` datetime NOT NULL COMMENT '推广结束时间',
  `valid` tinyint(4) NOT NULL default '1' COMMENT '是否停止（有效，没效）1,有效，0无效',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT='竞投期次信息' ;

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

--
-- 表的结构 `growth_bid_start`
--

CREATE TABLE IF NOT EXISTS `growth_bid_start` (
  `id` int(11) NOT NULL auto_increment,
  `way_alias` varchar(20) NOT NULL COMMENT '竞投方式的别名',
  `start_credit` int(11) NOT NULL COMMENT '竞投的起拍积分值',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `way_alias` (`way_alias`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='竞投的起拍分值表' ;

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

--
-- 表的结构 `growth_block_attr`
--

CREATE TABLE IF NOT EXISTS `growth_block_attr` (
  `id` smallint(5) unsigned NOT NULL auto_increment COMMENT '主键',
  `name` varchar(50) NOT NULL COMMENT '小区属性名称',
  `name_field` varchar(30) NOT NULL COMMENT '属性字段标识',
  `del_flag` tinyint(4) NOT NULL default '0' COMMENT '删除标识（0未删除，1删除）',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区属性表' ;

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

--
-- 表的结构 `growth_block_attr_lock`
--

CREATE TABLE IF NOT EXISTS `growth_block_attr_lock` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT '主键',
  `block_id` int(10) unsigned NOT NULL COMMENT '小区id',
  `attr_name` varchar(30) NOT NULL COMMENT '小区属性字段名称',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '添加时间',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `block_id` (`block_id`,`attr_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区属性锁定表' ;

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

--
-- 表的结构 `growth_block_improve_audit`
--

CREATE TABLE IF NOT EXISTS `growth_block_improve_audit` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT '主键',
  `block_id` int(11) NOT NULL COMMENT '小区id',
  `broker_id` int(11) NOT NULL COMMENT '经纪人id',
  `attr_field` varchar(30) NOT NULL COMMENT '小区属性字段名称',
  `attr_info` text NOT NULL COMMENT '小区完善内容',
  `credit_score` smallint(6) NOT NULL COMMENT '增加的积分值',
  `exp_score` smallint(6) NOT NULL COMMENT '增加的成长值',
  `status` tinyint(4) NOT NULL COMMENT '状态（0审核中，1审核通过，2审核未通过）',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '添加时间',
  PRIMARY KEY  (`id`),
  KEY `block_id` (`block_id`,`broker_id`),
  KEY `block_id_2` (`block_id`,`attr_field`),
  KEY `status` (`status`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='小区完善审核表' ;

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

--
-- 表的结构 `growth_certificate_log`
--

CREATE TABLE IF NOT EXISTS `growth_certificate_log` (
  `id` int(10) NOT NULL auto_increment,
  `uid` int(11) NOT NULL COMMENT '经纪人ID',
  `avatar_credit` tinyint(1) NOT NULL default '0' COMMENT '头像积分(0未认证,1认证)',
  `avatar_exp` tinyint(1) NOT NULL default '0' COMMENT '头像成长值(0未认证,1认证)',
  `id_credit` tinyint(1) NOT NULL default '0' COMMENT '身份证积分(0未认证,1认证)',
  `id_exp` tinyint(1) NOT NULL default '0' COMMENT '身份证成长值(0未认证,1认证)',
  `bcard_credit` tinyint(1) NOT NULL default '0' COMMENT '名片积分(0未认证,1认证)',
  `bcard_exp` tinyint(1) NOT NULL default '0' COMMENT '名片成长值(0未认证,1认证)',
  `broker_credit` tinyint(1) NOT NULL default '0' COMMENT '证书积分(0未认证,1认证)',
  `broker_exp` tinyint(1) NOT NULL default '0' COMMENT '证书成长值(0未认证,1认证)',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='记录经纪人领取证书增送成长值和积分关系表' ;

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

--
-- 表的结构 `growth_credit`
--

CREATE TABLE IF NOT EXISTS `growth_credit` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) NOT NULL COMMENT '经纪人id',
  `credit` int(10) unsigned NOT NULL default '0',
  `frozen` int(10) unsigned NOT NULL default '0' COMMENT '冻结的积分',
  `status` tinyint(4) NOT NULL default '1' COMMENT '是否有效，0或1；0无效，1有效',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `brokerId` (`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='积分表' ;

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

--
-- 表的结构 `growth_credit_day_count`
--

CREATE TABLE IF NOT EXISTS `growth_credit_day_count` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ctime` date NOT NULL COMMENT '时间日期',
  `way_alias` varchar(20) NOT NULL default '1' COMMENT '获取积分方式的别名，growth_credit_way表主键',
  `broker_id` int(11) NOT NULL COMMENT '经纪人id',
  `day_credit` int(11) NOT NULL default '0' COMMENT '当天获取的积分',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `cwb` USING BTREE (`ctime`,`way_alias`,`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='当天通过各种方式获取积分的累计。' ;

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

--
-- 表的结构 `growth_credit_reward`
--

CREATE TABLE IF NOT EXISTS `growth_credit_reward` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `event` varchar(64) character set gbk NOT NULL COMMENT '活动名称',
  `score` int(11) NOT NULL COMMENT '赠送的分数',
  `number` int(11) NOT NULL COMMENT '赠送积分的人数',
  `falsenumber` int(5) NOT NULL default '0' COMMENT '插入错误数量',
  `file` varchar(255) NOT NULL COMMENT '文件地址',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '赠送积分的时间',
  `operator` varchar(32) character set gbk NOT NULL COMMENT '操作人',
  `status` tinyint(2) NOT NULL COMMENT '状态（有无赠送）',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='赠送积分记录' ;

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

--
-- 表的结构 `growth_credit_reward_false`
--

CREATE TABLE IF NOT EXISTS `growth_credit_reward_false` (
  `id` int(6) NOT NULL auto_increment,
  `uid` varchar(30) NOT NULL COMMENT '经纪人帐号',
  `activityid` int(6) NOT NULL COMMENT '活动id',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='积分赠送失败经纪人名单' ;

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

--
-- 表的结构 `growth_credit_way`
--

CREATE TABLE IF NOT EXISTS `growth_credit_way` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` int(11) NOT NULL COMMENT '大类，1套餐，100认证，200活跃度，300房源，400贡献，500系统赠送，1000竞投，1500兑换礼品，2000违规',
  `name` varchar(50) character set gbk default NULL COMMENT '获取途径的名字',
  `alias` varchar(30) NOT NULL COMMENT '途径别名',
  `is_display` tinyint(4) NOT NULL default '1' COMMENT '是否展示在后台1,展示，0不展示',
  `description` varchar(256) character set gbk default NULL COMMENT '获取（或扣除）途径的描述',
  `repeatable` int(10) unsigned NOT NULL default '0' COMMENT '是否可以重复获取（或扣除）积分。默认0,无限；大于0的数字代表具体次数',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `alias` (`alias`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='积分获取，消耗（或扣除）途径' ;

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

--
-- 表的结构 `growth_credit_way_package`
--

CREATE TABLE IF NOT EXISTS `growth_credit_way_package` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `way_alias` varchar(20) character set gbk NOT NULL COMMENT '获取途径别名',
  `package_id` int(11) NOT NULL COMMENT '套餐类型ID',
  `score` int(11) NOT NULL COMMENT '分值，大于0表示加分，小于0表示减分',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `w_p` USING BTREE (`way_alias`,`package_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='套餐和获取途径对应的积分值' ;

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

--
-- 表的结构 `growth_exp`
--

CREATE TABLE IF NOT EXISTS `growth_exp` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `broker_id` int(11) NOT NULL COMMENT '经纪人id',
  `exp` int(10) unsigned NOT NULL default '0',
  `status` tinyint(4) NOT NULL default '1' COMMENT '是否有效，0或1；0无效，1有效',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `brokerId` (`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='成长值表' ;

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

--
-- 表的结构 `growth_exp_controll_package`
--

CREATE TABLE IF NOT EXISTS `growth_exp_controll_package` (
  `id` int(11) NOT NULL auto_increment,
  `way_alias` varchar(20) NOT NULL COMMENT '获取途径别名',
  `package_id` int(11) NOT NULL COMMENT ' 套餐类型ID',
  `score` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `w_p` (`way_alias`,`package_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='途径和套餐所对应的峰值' ;

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

--
-- 表的结构 `growth_exp_controll_way`
--

CREATE TABLE IF NOT EXISTS `growth_exp_controll_way` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) NOT NULL COMMENT '大类，预留字段',
  `name` varchar(50) NOT NULL COMMENT '名称',
  `alias` varchar(20) NOT NULL COMMENT '别名',
  `is_display` tinyint(4) NOT NULL default '1' COMMENT '1表示展示， 0表示不展示',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='峰值途径表' ;

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

--
-- 表的结构 `growth_exp_day_count`
--

CREATE TABLE IF NOT EXISTS `growth_exp_day_count` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ctime` date NOT NULL COMMENT '时间日期',
  `way_alias` varchar(20) NOT NULL default '1' COMMENT '获取成长值方式的别名，growth_level_way表主键',
  `broker_id` int(11) NOT NULL COMMENT '经纪人id',
  `day_exp` int(11) NOT NULL default '0' COMMENT '当天获取的成长值',
  PRIMARY KEY  (`id`),
  KEY `cwb` (`ctime`,`way_alias`,`broker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='当天通过各种方式获取成长值的累计。' ;

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

--
-- 表的结构 `growth_exp_level`
--

CREATE TABLE IF NOT EXISTS `growth_exp_level` (
  `level_id` int(11) NOT NULL auto_increment COMMENT '等级编号',
  `name` varchar(20) NOT NULL COMMENT '等级名称',
  `down_exp` int(11) default NULL COMMENT '成长值介于下限边值',
  `up_exp` int(11) default NULL COMMENT '成长值介于上限边值',
  PRIMARY KEY  (`level_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='成长值等级名称'  ;

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

--
-- 表的结构 `growth_exp_reward`
--

CREATE TABLE IF NOT EXISTS `growth_exp_reward` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `event` varchar(64) character set gbk NOT NULL COMMENT '活动名称',
  `score` int(11) NOT NULL COMMENT '赠送的分数',
  `number` int(11) NOT NULL COMMENT '赠送成长值的人数',
  `file` varchar(255) NOT NULL COMMENT '上传文件地址',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP COMMENT '赠送成长值的时间',
  `operator` varchar(32) character set gbk NOT NULL COMMENT '操作人',
  `status` tinyint(2) NOT NULL COMMENT '操作状态（有无赠送）',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='赠送成长值记录' ;

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

--
-- 表的结构 `growth_exp_reward_false`
--

CREATE TABLE IF NOT EXISTS `growth_exp_reward_false` (
  `id` int(6) NOT NULL auto_increment,
  `uid` varchar(100) NOT NULL COMMENT '经纪人帐号',
  `activityid` int(6) NOT NULL COMMENT '活动id',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk COMMENT='赠送成长值失败经济人名单' ;

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

--
-- 表的结构 `growth_exp_way`
--

CREATE TABLE IF NOT EXISTS `growth_exp_way` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` int(11) NOT NULL COMMENT '大类，1套餐，100认证，200活跃度，300房源，400贡献，500系统赠送，1000竞投，1500兑换礼品',
  `name` varchar(50) character set gbk default NULL COMMENT '获取途径的名字',
  `alias` varchar(20) character set gbk NOT NULL COMMENT '途迳别名',
  `is_display` tinyint(4) NOT NULL default '1' COMMENT '是否展示在后台设置，1展示，0，不展示',
  `description` varchar(256) character set gbk default NULL COMMENT '获取（或扣除）途径的描述',
  `repeatable` int(10) unsigned NOT NULL default '0' COMMENT '是否可以重复获取（或扣除）成长值。默认0,无限；大于0的数字代表具体次数',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `alias` (`alias`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='成长值获取，消耗（或扣除）途径' ;

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

--
-- 表的结构 `growth_exp_way_package`
--

CREATE TABLE IF NOT EXISTS `growth_exp_way_package` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `way_alias` varchar(20) character set gbk NOT NULL COMMENT '获取途径别名',
  `package_id` int(11) NOT NULL COMMENT '套餐类型ID',
  `score` int(11) NOT NULL COMMENT '分值，大于0表示加分，小于0表示减分',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `w_p` (`way_alias`,`package_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='套餐和获取途径对应的成长分值' ;

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

--
-- 表的结构 `growth_gift`
--

CREATE TABLE IF NOT EXISTS `growth_gift` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT '主键',
  `uname` varchar(30) NOT NULL COMMENT '操作用户名',
  `name` varchar(30) NOT NULL COMMENT '礼品名称',
  `num` smallint(6) NOT NULL COMMENT '礼品数量',
  `exchange_num` smallint(6) NOT NULL default '0' COMMENT '已经参与兑换数量',
  `pic` varchar(255) NOT NULL COMMENT '礼品图片地址',
  `credit_score` int(10) NOT NULL COMMENT '所需积分',
  `open_flag` tinyint(4) NOT NULL default '0' COMMENT '开始状态（0：未开启，1:已开启）',
  `del_flag` tinyint(4) NOT NULL default '0' COMMENT '删除标识（0：未删除，1：已删除）',
  `broker_level` varchar(255) NOT NULL COMMENT '可参与的经纪人等级',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '添加时间',
  `etime` timestamp NOT NULL default '0000-00-00 00:00:00' COMMENT '礼品兑换结束时间',
  PRIMARY KEY  (`id`),
  KEY `open_flag` (`open_flag`),
  KEY `del_flag` (`del_flag`),
  KEY `etime` (`etime`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='兑换礼品表' ;

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

--
-- 表的结构 `growth_gift_exchange`
--

CREATE TABLE IF NOT EXISTS `growth_gift_exchange` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT '主键',
  `bid` int(10) unsigned NOT NULL COMMENT '经纪人id',
  `gid` int(10) unsigned NOT NULL COMMENT '礼品id',
  `ctime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '兑换时间',
  `status` tinyint(4) NOT NULL default '0' COMMENT '状态（0：未兑换，1：已兑换）',
  PRIMARY KEY  (`id`),
  KEY `bid` (`bid`),
  KEY `gid` (`gid`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='礼品兑换记录表' ;

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

--
-- 表的结构 `growth_give_upload_log`
--

CREATE TABLE IF NOT EXISTS `growth_give_upload_log` (
  `id` int(7) NOT NULL auto_increment,
  `activity` varchar(40) NOT NULL COMMENT '活动名',
  `type` tinyint(2) NOT NULL COMMENT '赠送类型',
  `score` int(5) NOT NULL COMMENT '赠送分数',
  `number` int(6) NOT NULL COMMENT '赠送人数',
  `operator` varchar(30) NOT NULL COMMENT '操作人',
  `dateline` int(10) NOT NULL COMMENT '时间',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk ;

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

--
-- 表的结构 `growth_house_log`
--

CREATE TABLE IF NOT EXISTS `growth_house_log` (
  `id` int(10) NOT NULL auto_increment,
  `tbl` varchar(4) NOT NULL COMMENT '表名(sell、rent)',
  `house_id` int(11) NOT NULL COMMENT '房源号',
  `grade` tinyint(2) default NULL COMMENT '房源等级(1是非多图，2是多图，3是优质)',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='发布积分赠送控制记录' ;

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

--
-- 表的结构 `growth_level_permission`
--

CREATE TABLE IF NOT EXISTS `growth_level_permission` (
  `id` int(11) NOT NULL auto_increment,
  `way_id` int(20) NOT NULL COMMENT '设置权限途径id',
  `level_id` int(11) NOT NULL,
  `status` smallint(6) NOT NULL default '0' COMMENT '状态 1选择， 0未选择',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `w_l` (`way_id`,`level_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='权限和等级关系表' ;

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

--
-- 表的结构 `growth_level_way_permission`
--

CREATE TABLE IF NOT EXISTS `growth_level_way_permission` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) NOT NULL COMMENT '大类 1是房源竞投别名  2其它别名（备选）',
  `subclass` int(11) NOT NULL COMMENT '1,小区竞投，2,房源竞投',
  `name` varchar(50) NOT NULL COMMENT '权限名称和成长值权限名称一致',
  `way_alias` varchar(20) NOT NULL COMMENT '设置权限途径别名（别名绑定成长值表中way）',
  `is_display` tinyint(4) NOT NULL COMMENT '是否在页面上展示 1表示显示 0表示不显示',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `t_a` (`way_alias`,`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk ;

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

--
-- 表的结构 `growth_pic_check_log`
--

CREATE TABLE IF NOT EXISTS `growth_pic_check_log` (
  `id` int(11) NOT NULL auto_increment,
  `sid` int(11) NOT NULL COMMENT '对应entry审核表ID',
  `uid` int(11) NOT NULL COMMENT '经纪人ID',
  `blockid` int(11) NOT NULL COMMENT '小区ID',
  `blockname` varchar(30) NOT NULL COMMENT '小区名',
  `pic_type` tinyint(2) NOT NULL COMMENT '图片类型',
  `room` tinyint(1) NOT NULL COMMENT '室',
  `hall` tinyint(1) NOT NULL COMMENT '厅',
  `pic_url` varchar(255) NOT NULL COMMENT '图片路径',
  `add_time` int(10) NOT NULL COMMENT '时间戳',
  `pic_status` tinyint(1) NOT NULL default '0' COMMENT '审核状态(0未审核，1通过，2未通过)',
  `exp_score` tinyint(4) NOT NULL COMMENT '经验值',
  `credit_score` tinyint(4) NOT NULL COMMENT '积分',
  PRIMARY KEY  (`id`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM  DEFAULT CHARSET=gbk COMMENT='外景图审核记录' ;


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

--
-- 小区表block添加相关字段
--

alter table block  add  `lock_flag` tinyint(4) NOT NULL DEFAULT '1' COMMENT '锁定标识（小区完善模块：0未锁定，1锁定）',
add  `lock_opennum` tinyint(4) NOT NULL COMMENT '小区属性未锁定数量', 
add  `lock_layout` tinyint(1) NOT NULL COMMENT '户型图锁定标识(1锁定,0未锁定)',
add  `lock_outside` tinyint(1) NOT NULL COMMENT '外景图锁定标识(1锁定,0未锁定)',
add  index lock_opennum (`lock_opennum`);

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

--
-- XXX
--

ALTER TABLE  `broker_group` ADD  `exp_status` TINYINT( 4 ) NOT NULL DEFAULT  '1' COMMENT  '成长值开关',
ADD  `credit_status` TINYINT( 4 ) NOT NULL DEFAULT  '1' COMMENT  '经验值开关';

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

--
-- XXX
--
ALTER TABLE  `block_lock` ADD  `flag2` TINYINT( 1 ) NOT NULL COMMENT  '外景图锁定标识'; 

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

--
-- 图片入库审核表admin_pic_entry添加相应字段
--
ALTER TABLE  `admin_pic_entry` ADD  `flag` TINYINT( 1 ) NOT NULL COMMENT  '图片来源';
ALTER TABLE  `admin_pic_entry` ADD  `uid` INT( 10 ) NOT NULL COMMENT  '经纪人id' AFTER  `houseid` ;
";


/*
注意：
1 . 新增56张表
2 .
	growth_credit_record_
	growth_exp_record_
	以上面开头的表通过定时脚本创建，详见：\module\init\growthinit_broker_record.php
	如：growth_credit_record_20140605  /  growth_exp_record_20140605

*/

die('关闭');

//开始创建表结构
$container = Container::getInstance();
$db = $container->get('db');
$db->Execute($sql);
if($db->Affected_Rows()){
	echo "经纪人成长体系数据表创建成功";
}else{
	echo "经纪人成长体系数据表创建失败";
}

die;

?>