<?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-04-14 10:00:00';
$endTime = '2014-04-14 22:00:00';
$tgStartTime = '2014-04-15 00:00:00';
$tgEndTime = '2014-04-21 23:59:59';
createNextBidBlockExpert($startTime,$endTime,$tgStartTime,$tgEndTime);

//更新竞投小区专家的最低等级
updateBidBlockExpertLowLevel();
/*
$growthBidPeriods = new GrowthBidPeriods();
$growthBid = new GrowthBidBlockExpert();
//竞投小区专家期次
$fieldData = array(
    'type' => 1,
    'name' => '小区专家竞投',
    'start_time'=>'2014-03-24 10:00:00',
    'end_time'=>'2014-03-24 22:00:00',
    'tg_start_time'=>'2014-03-25 00:00:00',
    'tg_end_time'=>'2014-03-29 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; 
}
$bidData = array();
if($blocks) {
    foreach ($blocks as $key => $value) {
        $temp = array();
        $temp['bid_periods_id'] = $bidPeriodsId;
        $temp['block_id'] = $value['id'];
        $temp['block_level'] = $value['level'];
        $temp['broker_level'] = $data_info1['bid'.$value['level'].'Experts']['levelnames'];
        $temp['min_score'] = $data_info1['bid'.$value['level'].'Experts']['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/>";
    }
}
*/

?>
