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

echo '<b>升级为南京后台</b><br/>';
if($do!='start') {
    echo '<a href="http://esfadmin.house365.com/module/init/growth_nj/update_nanjing.php?do=start">开始升级</a>';
    exit;
}
//房豆设置修改
echo '修改<b>房豆</b>获取方式for南京<br/>';
$growthCreditWay = new GrowthCreditWay();
//显示标签条数开通设置
$arrField = array("is_display"=>1,"description"=>'首次开通奖励，每个标签奖励10个房豆');
$strWhere = "alias = 'openTagNumPackage'";
$growthCreditWay->update($arrField,$strWhere);
echo '标签条数开通设置已改为显示<br/>';

//优质房源设置不显示
$arrField = array("is_display"=>0);
$strWhere = "alias = 'pQualityHouse'";
$growthCreditWay->update($arrField,$strWhere);
echo '优质房源设置已改为不显示<br/>';

//贡献 增加 问答获取途径
$fields = array();
$fields[] = array('type'=>'400','name'=>'问答回答已有人回答过的问题','alias' => 'questionA1','is_display'=>'1','description'=>'信息审核通过奖励相应房豆','repeatable'=>'0');
$fields[] = array('type'=>'400','name'=>'问答回答没有人回答过的问题','alias' => 'questionA2','is_display'=>'1','description'=>'信息审核通过奖励相应房豆','repeatable'=>'0');
$fields[] = array('type'=>'400','name'=>'被选为最佳答案','alias' => 'questionA3','is_display'=>'1','description'=>'信息审核通过奖励相应房豆','repeatable'=>'0');
foreach ($fields as $value) {
    $growthCreditWay->insert($value);
}
echo '增加3条<b>问答</b>获取途径<br/>';

//增加求购求租匹配消耗分值
$fields = array();
$fields[] = array('type'=>'1500','name'=>'求购匹配','alias' => 'matchBuy','is_display'=>'1','description'=>'消耗房豆','repeatable'=>'0');
$fields[] = array('type'=>'1500','name'=>'求租匹配','alias' => 'matchRent','is_display'=>'1','description'=>'消耗房豆','repeatable'=>'0');
foreach ($fields as $value) {
    $growthCreditWay->insert($value);
}
echo '增加2条<b>求购求租匹配</b>消耗分值设置<br/>';

echo '修改<b>房豆</b>获取方式for南京完成<br/>';
echo '-----------------------------------<br/>';
exit;
//修改成长值设置
echo '修改<b>成长值</b>获取方式for南京<br/>';
$growthExpWay = new GrowthExpWay();
//显示标签条数开通设置
$arrField = array("is_display"=>1);
$strWhere = "alias = 'openTagNumPackage'";
$growthExpWay->update($arrField,$strWhere);
echo '<b>标签条数开通</b>设置已改为显示<br/>';

//优质房源设置不显示
$arrField = array("is_display"=>0);
$strWhere = "alias = 'pQualityHouse'";
$growthExpWay->update($arrField,$strWhere);
echo '优质房源设置已改为不显示<br/>';

//贡献 增加 问答获取途径
$fields = array();
$fields[] = array('type'=>'400','name'=>'问答回答已有人回答过的问题','alias' => 'questionA1','is_display'=>'1','description'=>'可多次奖励','repeatable'=>'0');
$fields[] = array('type'=>'400','name'=>'问答回答没有人回答过的问题','alias' => 'questionA2','is_display'=>'1','description'=>'可多次奖励','repeatable'=>'0');
$fields[] = array('type'=>'400','name'=>'被选为最佳答案','alias' => 'questionA3','is_display'=>'1','description'=>'可多次奖励','repeatable'=>'0');
foreach ($fields as $value) {
    $growthExpWay->initData($value);
}
echo '增加3条<b>问答</b>获取途径<br/>';
echo '修改<b>成长值</b>获取方式for南京完成<br/>';
echo '-----------------------------------<br/>';
/*
//峰值设置 增加每日送房豆修改房源条数
echo '<b>峰值设置</b>增加<b>每日送房豆修改房源条数</b><br/>';
$growthExpControll = new GrowthExpControll();
$fields = array();
$fields[] = array('type' => 1, 'name'=>'每日送房豆修改房源条数', 'is_display'=>'1', 'alias' => 'dayModifyHouseNum');
foreach($fields as $key => $value) {
    $growthExpControll->initData($value);
}
echo '增加3条<b>每日送房豆修改房源条数</b>峰值设置<br/>';
echo '-----------------------------------<br/>';
*/

//等级对应权限 增加2条 求购匹配和求租匹配的权限
$arrPermissionWay = array();
$arrPermissionWay[] = array('name' => '求购匹配', 'way_alias' => 'matchBuy', 'is_display' => 1, 'type' => 2, 'subclass' => 1);
$arrPermissionWay[] = array('name' => '求租匹配', 'way_alias' => 'matchRent', 'is_display' => 1, 'type' => 2, 'subclass' => 1);
$glwp = new GrowthLevelWayPermission();
echo '添加<b>求购匹配,求租匹配</b>权限配置<br/>';
foreach($arrPermissionWay as $key => $value) {
    $glwp->initData($value);
}
echo '添加完成</br>';
echo '-----------------------------------<br/>';
?>