<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
//checkAuth('78');	//判断登录和权限
function sendResult($status, $message, $url) {
    if ($status == 0) {
        echo '<script type="text/javascript">alert("' . $message 
                . '");history.go(-1);</script>';
    } else if ($status == 1) {
        echo '<script type="text/javascript">alert("' . $message 
                . '");location.href="' . $url . '";</script>';
    }
}
$payRechargeActive = new PayRechargeActive();
if ($action == '') {
    $action = 'add';
}
if ($action == 'add') {
    
    
} else if ($action == 'insert') {
    if ($num == '') {
        sendResult(0, '房豆数量不能为空');
        die();
    }
    if ($setActive == 1) {
        if ($price == '' || $stime == '' || $etime == '') {
            sendResult(0, '价格或日期参数不合法');
            die();
        } 
    }
    $operator = $_SESSION[$web_auth]["username"];
    $status = $payRechargeActive->insert($num, $operator, $setActive, $price, 
            $stime, $etime);
    $message = $status ? '添加活动成功' : '添加活动失败';
    sendResult(1, $message, 'housebean_setting_manage.php');
} else if ($action == 'modify') {
    
} else if ($action == 'update') {
    
} else if ($action == 'stop') {
    $operator = $_SESSION[$web_auth]["username"];
    $status = $payRechargeActive->setStatus($id, 1, $operator);
    echo $status;
}
$title = '房豆充值设置';
include_once(Template("header"));
include_once(Template("pay/housebean_setting_modify"));
include_once(Template("footer"));