setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB); $objDisney = new DbDisney($objDbh); echo '$cs1_array = $objDisney->getCS1Info(43)'; $cs1_array = $objDisney->getCS1Info(48); print_r($cs1_array);exit(); $cs2_array = $objDisney->getCS2Array(); $go_prod = array(); $back_prod = array(); foreach( $cs1_array as $cs1_info ) { $go_prod[$cs1_info["org_id"]] = $cs1_info; } foreach( $cs2_array as $cs2_info ) { $back_prod[$cs2_info["org_id"]] = $cs2_info; } $limit = " ORDER BY create_time ASC "; $extra_sql = false; $order_array = $objDisney->getActiceOrderCommonArray( $extra_sql, $limit ); $oneway_bus = array( 15,16,18 ); $bothway_bus = array(1,17,19); $dbothway_bus = array(2); $disney_prod = array(3,4,5,6,7,8); $lion_prod = array(9,10,11,12,13,14); foreach( $order_array as $order_info ) { $order_goods_array = $objDisney->getOrderGoodsArray( $order_info["id"] ); if( false == $order_goods_array ) { continue; } $prod_id =$order_info["prod_id"]; foreach( $order_goods_array as $order_goods_info ) { $good_id = $order_goods_info["good_id"]; $good_type = 0; if (in_array($good_id, $disney_prod)) { $good_type = 1; } else if (in_array($good_id, $lion_prod)) { $good_type = 2; } else if (in_array($good_id, $bothway_bus)) { $good_type = 3; } else if (in_array($good_id, $dbothway_bus)) { $good_type = 4; } else { $good_type = 5; } } //insert into disney2cs $str .= $order_info["order_serial_no"]."\t,".$order_info["prod_name"].$return_flag; $order_date = $order_info["start_day"]; if( mb_strlen($order_info["start_time"]) > 0 ) { $order_date .= " ".$order_info["start_time"]; } if( $order_info["prod_id"] == 1 || $order_info["prod_id"] == 2 || $order_info["prod_id"] == 18 || $order_info["prod_id"] == 16 ) { $order_date .= "-".$order_info["end_day"]." ".$order_info["end_time"]; if( mb_strlen($order_info["start_time2"]) > 0 ) { $order_date .= $return_flag.$order_info["start_day2"]." ".$order_info["start_time2"]."-".$order_info["end_day2"]." ".$order_info["end_time2"]; } } $str .= $order_date.","; $str .= $order_info["order_price"].","; $str .= $order_info["create_time"].","; if( $order_info['is_payed'] == 1 ) { $str .= $_ary_pay_type[$order_info['pay_type']].$return_flag.'支付号:'.$order_info["pay_no"] . ','; } else if( $order_info['order_user_id'] > 0 ){ $str .= '酒店代收现金,'; } else { $str .= '未支付,'; } $str .= $order_info["cus_name"].$return_flag.$order_info["cus_mobile"].$return_flag.$order_info["cus_iden"]; $order_comment = str_replace(",",",",$order_info["comment"]); $str .= ",\"".$order_comment."\""; $str .= "\n"; } exit(); ///////////////////////////////////////////////////////////////////////////////// /** * @param type $user_id 下单用户id * @param type $playdate 游玩日期 * @param type $create_time 订单创建时间 * @param type $customer_name 顾客姓名 * @param type $customer_phone 顾客电话 * @param type $customer_id_type id类型 150身份证 153 护照 * @param type $customer_id 顾客id号 * @param type $ticket 订票类型 $ticket=array( 'D'=>0,//成人票 'C'=>0,//儿童票 'O'=>0,//老人票 'D2'=>0,//成人两日票 'C2'=>0,//儿童两日票 'O2'=>0,//老人两日票 ); * @param type $return_no 外部订单号 * @param $order_from_org_id 订单对应组织id */ //addtheater('998', '111', '2122','111', '1111', '22222', '222', '2222', array( 'AA'=>1,'AB'=>1, 'BB'=>0, 'BA'=>0, 'CA'=>0,'CB'=>0), 1111,'0'); //adddisney('998', '111', '2122', '1111', '22222', '222', '2222', array('D'=>1,'C'=>0,'O'=>0,'D2'=>1,'C2'=>0,'O2'=>0), 1111,'0'); function adddisney($user_id,$playdate,$create_time,$customer_name,$customer_phone,$customer_id_type,$customer_id,$ticket,$return_no,$order_from_org_id){ $date =isset($playdate)?$playdate:'0'; $cust_name = isset($customer_name)?$customer_name:'匿名'; $cust_phone = isset($customer_phone)?$customer_phone:'0'; $id_type = isset($customer_id_type)? $customer_id_type:'150'; // 150身份证 153 护照 $customer_id = isset($customer_id)?$customer_id:'0'; $return_no = isset($return_no)? $return_no:'0'; $order_status =146; $pay_type_id_1 = 275; $pdo = conn_cs(); $sql = "select a.prod_id,a.prod_name,b.prod_price,b.prod_type_id " . "from opera_product a inner join opera_product_price b on a.prod_id = b.prod_id " . "where a.parent_id = 387267"; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $info = array(); foreach ($rowset as $v) { $info[$v['prod_id']] = $v; } $sql_p = "select prod_id,prod_name " . " from opera_product " . " where prod_id = 387267"; $result_p=$pdo->query($sql_p); $rowset_p = $result_p -> fetchAll(PDO::FETCH_ASSOC); $info_p = $rowset_p[0]; $num=0; $order_description = ""; $price=0; foreach ($ticket as $k=>$v) { $num+=$v; if($v){ switch ($k){ case 'D': $price+=$info['387538']['prod_price']*$v; $order_description.=" 标准一日票,". date('Y-m-d',time()).",".$v."|"; break; case 'C': $price+=$info['387540']['prod_price']*$v; $order_description.="儿童一日票,". date('Y-m-d',time()).",".$v."|"; break; case 'O': $price+=$info['387539']['prod_price']*$v; $order_description.="老人一日票,". date('Y-m-d',time()).",".$v."|"; break; case 'C2': $price+=$info['387543']['prod_price']*$v; $order_description.="儿童两日票,". date('Y-m-d',time()).",".$v."|"; break; case 'D2': $price+=$info['387541']['prod_price']*$v; $order_description.="标准两日票,". date('Y-m-d',time()).",".$v."|"; break; case 'O2': $price+=$info['387542']['prod_price']*$v; $order_description.="老人两日票,". date('Y-m-d',time()).",".$v."|"; break; } } } $id_p = getUniqeId(); $order_id_p = $id_p; $pay_main_id = getUniqeId(); $create_time; $update_time = $create_time; $order_pay_status = 0; //查找数据库中关于迪士尼的信息 $sql_in=" insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`,`order_description`, `order_price`,`order_prod_type`,`prod_name`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`prod_id`,`run_date`,`main_create_user_id`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`) values ('".$id_p."','" .$order_id_p."', '".$create_time."','".$update_time."','0','".$order_description."','" .$price."','258','".$info_p['prod_name']."','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."','0','0','".$info_p['prod_id']."','".$date."','".$user_id."','".$pay_main_id."','".$order_from_org_id."','".$return_no."')"; for_insert($sql_in); //插入支付方式等信息 $sql_pay="insert INTO" . " `order_pay_main`(id,CREATe_user_id,CREATE_time,update_user_id,pay_total) " . "VALUES(".$pay_main_id.",".$user_id.",'".date('Y-m-d H-i-s', time())."',".$user_id.",".$price.");" . "insert INTO `order_pay_detail` (id,CREATe_user_id,CREATE_time,update_user_id,pay_main_id,pay_type_id_1,pay_money) VALUES(".$pay_main_id.",".$user_id.",'".date('Y-m-d H-i-s', time())."',".$user_id.",".$pay_main_id.",'".$pay_type_id_1."',".$price.");"; for_insert($sql_pay); foreach ($ticket as $k => $v) { if($v){ switch ($k){ case 'D': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387538']['prod_id']."','".$info_p['prod_id']."','".$info['387538']['prod_name']."','".$info_p['prod_name']."','".$info['387538']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; case 'C': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387540']['prod_id']."','".$info_p['prod_id']."','".$info['387540']['prod_name']."','".$info_p['prod_name']."','".$info['387540']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; case 'O': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387539']['prod_id']."','".$info_p['prod_id']."','".$info['387539']['prod_name']."','".$info_p['prod_name']."','".$info['387539']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; case 'C2': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387543']['prod_id']."','".$info_p['prod_id']."','".$info['387543']['prod_name']."','".$info_p['prod_name']."','".$info['387543']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; case 'D2': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387541']['prod_id']."','".$info_p['prod_id']."','".$info['387541']['prod_name']."','".$info_p['prod_name']."','".$info['387541']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; case 'O2': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','258','".$order_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387542']['prod_id']."','".$info_p['prod_id']."','".$info['387542']['prod_name']."','".$info_p['prod_name']."','".$info['387542']['prod_price']."','".$date."','".$pay_main_id."','".$order_from_org_id."','".$return_no."','".$user_id."')"; for_insert($sql); } break; } } } } /** * * @param type $user_id 下单用户id * @param type $playdate 游玩日期 * @param type $playtime 开场时间 * @param type $create_time 订单创建时间 * @param type $customer_name 顾客姓名 * @param type $customer_phone 顾客电话 * @param type $customer_id_type id类型 150身份证 153 护照 * @param type $customer_id 顾客id号 * @param type $ticket 订票类型 $ticket=array( 'AA'=>0, 'AB'=>0, 'BB'=>0, 'BA'=>0, 'CA'=>0, 'CB'=>0, ); * @param type $return_no 外部订单号 * @param $order_from_org_id 订单对应组织id * */ function addtheater($user_id,$playdate,$playtime,$create_time,$customer_name,$customer_phone,$customer_id_type,$customer_id,$ticket,$return_no,$order_from_org_id){ $date = $playdate; $time = $playtime; $cust_name = $customer_name; $cust_phone =$customer_phone; $id_type =$customer_id_type; // 150身份证 153 护照 $customer_id = $customer_id; // $ticket=array( // 'AA'=>isset($_POST['AA'])?$_POST['AA']:0, // 'AB'=>isset($_POST['AB'])?$_POST['AB']:0, // 'BB'=>isset($_POST['BB'])?$_POST['BB']:0, // 'BA'=>isset($_POST['BA'])?$_POST['BA']:0, // 'CA'=>isset($_POST['CA'])?$_POST['CA']:0, // 'CB'=>isset($_POST['CB'])?$_POST['CB']:0, // ); $tic_buy =$return_no; $pdo = conn_cs(); $sql = "select a.prod_id,a.prod_name,b.prod_price,b.prod_type_id " . "from opera_product a inner join opera_product_price b on a.prod_id = b.prod_id " . "where a.parent_id = 387544"; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $info = array(); foreach ($rowset as $v) { $info[$v['prod_id']] = $v; } $sql_p = "select prod_id,prod_name " . " from opera_product " . " where prod_id = 387544"; $result_p=$pdo->query($sql_p); $rowset_p = $result_p -> fetchAll(PDO::FETCH_ASSOC); $info_p = $rowset_p[0]; $num=0; $order_description = ""; $price=0; $return_info=''; //var_dump($info);die; foreach ($ticket as $k=>$v) { $num+=$v; if($v){ switch ($k){ case 'AA': $price+=$info['387545']['prod_price']*$v; $return_info.=' AA区 × '.$v; $order_description.="迪士尼剧场AA区,". date('Y-m-d',time()).",".$v."|"; break; case 'AB': $price+=$info['387546']['prod_price']*$v; $return_info.=' AB区 × '.$v; $order_description.="迪士尼剧场AB区,". date('Y-m-d',time()).",".$v."|"; break; case 'BB': $price+=$info['387547']['prod_price']*$v; $return_info.=' BB区 × '.$v; $order_description.="迪士尼剧场BB区,". date('Y-m-d',time()).",".$v."|"; break; case 'BA': $price+=$info['387548']['prod_price']*$v; $return_info.=' BA区 × '.$v; $order_description.="迪士尼剧场BA区,". date('Y-m-d',time()).",".$v."|"; break; case 'CA': $price+=$info['387549']['prod_price']*$v; $return_info.=' CA区 × '.$v; $order_description.="迪士尼剧场CA区,". date('Y-m-d',time()).",".$v."|"; break; case 'CB': $price+=$info['387550']['prod_price']*$v; $return_info.=' CB区 × '.$v; $order_description.="迪士尼剧场CB区,". date('Y-m-d',time()).",".$v."|"; break; } } } $pay_status =146; $pay_type_id_1 = 275; $id_p = $order_id_p = getUniqeId(); $pay_main_id = getUniqeId(); $update_time =$create_time; $order_pay_status = 0; //查找数据库中关于迪士尼的信息 $sql_in=" insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`,`order_description`, `order_price`,`order_prod_type`,`prod_name`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`prod_id`,`run_date`,`run_time`,`main_create_user_id`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`) values ('".$id_p."','" .$order_id_p."', '".$create_time."','".$update_time."','0','".$order_description."','" .$price."','259','".$info_p['prod_name']."','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."','1','0','".$info_p['prod_id']."','".$date."','".$time."','".$user_id."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."')"; for_insert($sql_in); $sql_pay="insert INTO" . " `order_pay_main`(id,CREATe_user_id,CREATE_time,update_user_id,pay_total) " . "VALUES(".$pay_main_id.",".$user_id.",'".date('Y-m-d H-i-s', time())."',".$user_id.",".$price.");" . "insert INTO `order_pay_detail` (id,CREATe_user_id,CREATE_time,update_user_id,pay_main_id,pay_type_id_1,pay_money) VALUES(".$pay_main_id.",".$user_id.",'".date('Y-m-d H-i-s', time())."',".$user_id.",".$pay_main_id.",".$pay_type_id_1.",".$price.");"; for_insert($sql_pay); foreach ($ticket as $k => $v) { if($v){ switch ($k){ case 'AA': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387545']['prod_id']."','".$info_p['prod_id']."','".$info['387545']['prod_name']."','".$info_p['prod_name']."','".$info['387545']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; case 'AB': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387546']['prod_id']."','".$info_p['prod_id']."','".$info['387546']['prod_name']."','".$info_p['prod_name']."','".$info['387546']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; case 'BB': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387547']['prod_id']."','".$info_p['prod_id']."','".$info['387547']['prod_name']."','".$info_p['prod_name']."','".$info['387547']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; case 'BA': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387548']['prod_id']."','".$info_p['prod_id']."','".$info['387548']['prod_name']."','".$info_p['prod_name']."','".$info['387548']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; case 'CA': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387549']['prod_id']."','".$info_p['prod_id']."','".$info['387549']['prod_name']."','".$info_p['prod_name']."','".$info['387549']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; case 'CB': for($i=1;$i<=$v;$i++){ $id =$order_id =getUniqeId(); $sql = " insert into order_main (`id`, `order_id`, `create_time`,`update_time`, `order_pay_status`, `order_prod_type`,`order_status`, `customer_name`,`customer_mobile`,`customer_id_type`,`customer_id_no`, `order_book_status`,`PROD_START_STATION_TIME_MINUTES`,`parent_order_id`,`prod_id`,`parent_prod_id`,`prod_name`,`parent_prod_name`,`order_price`,`run_date`,`run_time`,`order_pay_main_id`,`outside_sale_org_id`,`outside_order_no`,`main_create_user_id`) values ('".$id."','" .$order_id."', '".$create_time."','".$update_time."', '0','259','".$pay_status."',' ".$cust_name."','".$cust_phone."','".$id_type."','".$customer_id."', '0','0','".$id_p."','".$info['387550']['prod_id']."','".$info_p['prod_id']."','".$info['387550']['prod_name']."','".$info_p['prod_name']."','".$info['387550']['prod_price']."','".$date."','".$time."','".$pay_main_id."','".$order_from_org_id."','".$tic_buy."','".$user_id."')"; for_insert($sql); } break; } }} } function for_insert($sql){ $pdo = conn_cs(); $re = $pdo->exec($sql); if($re==0){ echo $sql; exit ; } } function conn_cs() { if(empty($_SERVER['APPLICATION_ENV']) || $_SERVER['APPLICATION_ENV']=='production') { defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production'); } else { defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'dev'); } $getDbConfig = require './config/dbConfig/db.'.APPLICATION_ENV.'.config.php'; $config = $getDbConfig['CST']; $port = $config['port']; $host = $config['host']; $dbname = $config['db']; $dbuser = $config['user']; $dbpassword = $config['pwd']; try { $pdo=new PDO("mysql:host=".$host.";port=".$port.";dbname=".$dbname, $dbuser, $dbpassword,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8")); return $pdo; }catch (PDOException $e){ writeLog('new PDO failed:'.$e->getMessage()); } }