setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB); $objDisney = new DbDisney($objDbh); $good_info=$objDisney->getGoodInfoFromId($_POST["gid"]); $order_serial_no = date("ymdHis").sprintf("%06d",rand( 1, 999999)); $org_id = 0; $order_user_id = 0; $base_org_info = false; //get orgid from cookie if( $is_smartphone == true ) { if (isset($_COOKIE["companycode"]) && mb_strlen($_COOKIE["companycode"]) > 0) { $base_org_info = $objDisney->getBaseOrgInfoFromCode($_COOKIE["companycode"]); if ($base_org_info != false) { $org_id = $base_org_info["org_id"]; } } } else { if (isset($_COOKIE["opera_user_id"]) && mb_strlen($_COOKIE["opera_user_id"]) > 0) { $order_user_id = $_COOKIE["opera_user_id"]; $account_info = $objDisney->getAccountInfoFromId($order_user_id); $org_id = false == $account_info ? 0 : $account_info["org_id"]; $base_org_info = $objDisney->getBaseOrgInfoFromId($org_id); } } $insert_order_array = array( "order_serial_no" => $order_serial_no,//test "org_id" => $org_id,//test "status" => 0, "is_payed" => 0, "pay_type" => 0, "pay_no" => "", "prod_id" =>$_POST["gid"], "prod_name" =>$good_info["good_name"]."×".$_POST["good_num"], "order_user_id" => $order_user_id, "create_time" => date('Y-m-d H:i:s'), "order_price" => $good_info["good_price"] * $_POST["good_num"], "afli_price" => 0, "comment" => "", "start_time" => $_POST["start_date"], "end_time" => $_POST["end_date"], "cus_name" => $_POST["cus_name"], "cus_mobile" => $_POST["cus_mobile"], "cus_iden" => $_POST["cus_iden"] ); $insert_result = $objDisney->insertNewOrder($insert_order_array); if( false == $insert_result ) { echo "预定失败";exit(); } $last_order_info = $objDisney->getOrderInfoFromSN($order_serial_no); $insert_order_id = $last_order_info['id']; $insert_order_goods_array = array(); $insert_order_goods_array[] = array( "order_id" => $insert_order_id, "good_id" => $_POST["gid"], "good_name" => $good_info["good_name"], "subtype" => 0,//test "good_per_price" => $good_info["good_price"], "good_num" => $_POST["good_num"], "all_price" => $good_info["good_price"] * $_POST["good_num"], "afli_price" => 0, "start_time" => $_POST["start_date"], "end_time" => $_POST["end_date"] ); $objDisney->insertOrderGoods($insert_order_goods_array); if( $is_smartphone == true ) { header("Location: http://wx.zhizhuchuxing.com/wechat/WxPay/realpay/onlinePay.php?orderid=" . $order_serial_no . "&disney=1"); exit(); } else { $org_address = $base_org_info == false ? "" : $base_org_info["org_address"]; $send_message = getSendMessage( $good_info["good_type"], $_POST["cus_name"], $_POST["start_date"], $good_info["good_name"], $org_address ); sendTelMessage($_POST["cus_mobile"], $_POST["cus_name"], $send_message,$order_serial_no); header("Location: http://wx.zhizhuchuxing.com/pay_success.php?order_id=".$order_serial_no); exit(); } ?>