<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>正在为您跳转到支付页面，请稍候...</title>
	<style type="text/css">
body{margin:0;padding:0}
p{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:bold 16px/30px "宋体",Arial;text-indent:40px;border:1px solid #c5d0dc}
#waiting{font-family:Arial}
	</style>
</head>
<body>

<?php
include_once("../../common/init.php");
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
check_loginuser();
$_POST['price']=isset($_GET['price'])?$_GET['price']:$_POST['price'];
if(!$_POST){goBakMsg("请输入金额");die;}

$row = db_get_row("select * from yajin where userid='". $_SESSION["studentid"] ."'");
if ($row["id"]) {  //有过充值记录
    if($_POST["price"]+$row["price"]<300){
        goBakMsg("预存款不能少于300元");
        die;
    }
}else{    //新户开号
    if($_POST["price"]<300){
        goBakMsg("预存款不能少于300元");
        die;
    }
}

$notify_url = "http://danche.web-dev.nia.ink/admin/student/notify_url.php";
$return_url = "http://danche.web-dev.nia.ink/admin/student/return_url.php";
$db_data123=array();
$db_data123['orderid'] =date("YmdHis").rand(10000,99999);
$db_data123['money']=$_POST["price"];
$db_data123['uid']=$_SESSION["studentid"];
db_add("payorder",$db_data123);


$parameter = array(
	"pid" => $epay_config['pid'],
	"type" => "alipay",
	"notify_url" => $notify_url,
	"return_url" => $return_url,
	"out_trade_no" => $db_data123['orderid'],
	"name" => "预存款支付",
	"money"	=> $db_data123['money'],
);

$epay = new EpayCore($epay_config);
$html_text = $epay->pagePay($parameter);
echo $html_text;
?>
<p>正在为您跳转到支付页面，请稍候...</p>
</body>
</html>













