<?php
$obj_tab_pay_type=new cls_tab_pay_type();
$arr_type_class=$obj_tab_pay_type->type_class;

(!isset($get_pay_money)) ? $get_pay_money=0 : $get_pay_money=(int)$get_pay_money;


$arr_open_type=array();
$obj_result=$obj_db->query("select * from ".DB_PRE."pay_type");
while($obj_rs=$obj_db->fetch_array($obj_result)){
	$arr_open_type[]=$obj_rs;
}

$this_score=$obj_ctl_user->get_score();
$this_err="";
$this_pay_url="";
if(isset($get_pay_method) && $get_pay_method!=""){
	require_once(SYS_ROOT.'/cls_tab/tab.pay.order.php');
	$arr_payclass=$obj_tab_pay_type->type_class;
	if(isset($arr_payclass[$get_pay_method])){
		$str_paymethod=$arr_payclass[$get_pay_method];
	}else{
		$str_paymethod="";
	}
	$str_beta="在线充值";
	$arr_fields=array(
		"order_user_id"=>$obj_ctl_user->id,
		"order_money"=>$get_pay_money,
		"order_beta"=>$str_beta,
		"order_paymethod"=>$str_paymethod
	);
	$obj_pay_order=new cls_tab_pay_order();
	$arr_return_order=$obj_pay_order->on_save($arr_fields);
	if($arr_return_order["err"]==""){
		$arr_fields=array();
		$arr_fields["type_class"]=$get_pay_method;
		$arr_fields["subject"]=$str_beta;
		$arr_fields["orderid"]=$arr_return_order["order_number"];
		$arr_fields["price"]=$get_pay_money;
		$arr_fields["detail"]=$str_beta;
		$arr_return=$obj_tab_pay_type->on_pay($arr_fields);
		if($arr_return["err"]==""){
			if(isset($arr_return["pay_id"]) && $arr_return["pay_id"]!=""){
				$str_msg=$obj_db->execute("update ".DB_PRE."pay_order set order_pay_id='".$arr_return["pay_id"]."' where order_id='".$arr_return_order["id"]."'");
				if($str_msg=="" && $obj_db->affected_rows()>0){
					$this_pay_url=$arr_return["url"];
				}else{
					$obj_msg->alert("生成订单时发生错误！");
				}
			}else{
				$this_pay_url=$arr_return["url"];
			}
		}
	}else{
		$obj_msg->alert("生成订单时发生错误！");
	}
}
?>