<?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';
require_once 'function_crontab.php';
$container = Container::getInstance();
$dbback = $container->get('dbback');

$startTime = '2014-03-24 10:00:00';
$endTime = '2014-03-24 22:00:00';
$tgStartTime = '2014-03-25 00:00:00';
$tgEndTime = '2014-03-29 23:59:59';
createNextBidHouse($startTime,$endTime,$tgStartTime,$tgEndTime);
//更新兑投房源的最低等级
updateBidHouseLowLevel();

//更新竞投小区词和热搜词时的等级
updateBidHouseLevel();
exit;
/*
$growthBidPeriods = new GrowthBidPeriods();
$growthBid = new GrowthBidHouse();
//竞投小区词期次
$fieldData = array(
    'type' => 2,
    'name' => '房源竞投',
    'start_time'=>'2014-03-12 10:00:00',
    'end_time'=>'2014-03-12 22:00:00',
    'tg_start_time'=>'2014-03-13 00:00:00',
    'tg_end_time'=>'2014-03-14 23:59:59');
$bidPeriodsId = $growthBidPeriods->insert($fieldData);
if($bidPeriodsId) {
    echo "创建小区词竞投期次，id=".$bidPeriodsId."。"."时间：".$fieldData['tg_start_time']."到".$fieldData['tg_end_time'];
    echo "<br/>";
} else {
    echo "创建小区词竞投期次，失败";
}

//小区id和等级
$blockLevelHeat = new BlockLevelHeat();
$blocks = $blockLevelHeat->findAll();

//起拍积分，参与等级
$growthBidStartSetting = new GrowthBidStartSetting();
$data_info = $growthBidStartSetting->getData();
$data_info1 = array();
foreach ($data_info as $key => $value) {
    $data_info1[$value['alias']] = $value; 
}
if($blocks) {
    foreach ($blocks as $key => $value) {
        $temp = array();
        $temp['bid_periods_id'] = $bidPeriodsId;
        $temp['type'] = 1;
        $temp['block_id'] = $value['id'];
        $temp['block_level'] = $value['level'];
        $temp['broker_level'] = $data_info1['bidHouseBlockWord']['levelnames'];
        $temp['min_score'] = $data_info1['bidHouseBlockWord']['start_credit'];
        $temp['valid'] = 1;
        $temp['max_win_number'] = 4;
        $temp['ctime'] = date("Y-m-d H:i:s");
        $inid = $growthBid->insert($temp);
        if($inid) {
            echo "创建小区竞投成功，id=".$inid."。小区id为".$value['id'];
        } else {
            echo "失败，小区id为".$value['id'];
        }
        echo "<br/>";
    }
}


//热搜词
$growBidHotSearchSet = new GrowthBidHotSearchSet();
$arrSearchWords = $growBidHotSearchSet->findWords();
if($arrSearchWords) {
    foreach ($arrSearchWords as $key => $value) {
        $temp = array();
        $temp['bid_periods_id'] = $bidPeriodsId;
        $temp['type'] = 2;
        $temp['keyword'] = $value['words'];
        $temp['broker_level'] = $data_info1['bidHouseBlockWord']['levelnames'];
        $temp['min_score'] = $data_info1['bidHouseBlockWord']['start_credit'];
        $temp['valid'] = 1;
        $temp['max_win_number'] = 4;
        $temp['ctime'] = date("Y-m-d H:i:s");
        $inid = $growthBid->insert($temp);
        if($inid) {
            echo "创建热搜词竞投成功，id=".$inid."。热搜词为".$value['words'];
        } else {
            echo "失败，热搜词为".$value;
        }
        echo "<br/>";
    }
}
 * 
 */
?>
