You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

89 lines
3.2 KiB

  1. <?php
  2. require_once './php_include/Config.php';
  3. require_once './php_include/class.db.inc';
  4. require_once './php_include/disney.inc';
  5. $is_smartphone = isMobile();
  6. if( !isset($_POST["gid"]) ) {
  7. echo "没有产品信息";
  8. exit();
  9. }
  10. //DB
  11. $objDbh = new Db;
  12. $objDbh->setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
  13. $objDisney = new DbDisney($objDbh);
  14. $good_info=$objDisney->getGoodInfoFromId($_POST["gid"]);
  15. $order_serial_no = date("ymdHis").sprintf("%06d",rand( 1, 999999));
  16. $org_id = 0;
  17. $order_user_id = 0;
  18. $base_org_info = false;
  19. //get orgid from cookie
  20. if( $is_smartphone == true ) {
  21. if (isset($_COOKIE["companycode"]) && mb_strlen($_COOKIE["companycode"]) > 0) {
  22. $base_org_info = $objDisney->getBaseOrgInfoFromCode($_COOKIE["companycode"]);
  23. if ($base_org_info != false) {
  24. $org_id = $base_org_info["org_id"];
  25. }
  26. }
  27. } else {
  28. if (isset($_COOKIE["opera_user_id"]) && mb_strlen($_COOKIE["opera_user_id"]) > 0) {
  29. $order_user_id = $_COOKIE["opera_user_id"];
  30. $account_info = $objDisney->getAccountInfoFromId($order_user_id);
  31. $org_id = false == $account_info ? 0 : $account_info["org_id"];
  32. $base_org_info = $objDisney->getBaseOrgInfoFromId($org_id);
  33. }
  34. }
  35. $insert_order_array = array(
  36. "order_serial_no" => $order_serial_no,//test
  37. "org_id" => $org_id,//test
  38. "status" => 0,
  39. "is_payed" => 0,
  40. "pay_type" => 0,
  41. "pay_no" => "",
  42. "prod_id" =>$_POST["gid"],
  43. "prod_name" =>$good_info["good_name"]."×".$_POST["good_num"],
  44. "order_user_id" => $order_user_id,
  45. "create_time" => date('Y-m-d H:i:s'),
  46. "order_price" => $good_info["good_price"] * $_POST["good_num"],
  47. "afli_price" => 0,
  48. "comment" => "",
  49. "start_time" => $_POST["start_date"],
  50. "end_time" => $_POST["end_date"],
  51. "cus_name" => $_POST["cus_name"],
  52. "cus_mobile" => $_POST["cus_mobile"],
  53. "cus_iden" => $_POST["cus_iden"]
  54. );
  55. $insert_result = $objDisney->insertNewOrder($insert_order_array);
  56. if( false == $insert_result ) {
  57. echo "预定失败";exit();
  58. }
  59. $last_order_info = $objDisney->getOrderInfoFromSN($order_serial_no);
  60. $insert_order_id = $last_order_info['id'];
  61. $insert_order_goods_array = array();
  62. $insert_order_goods_array[] = array(
  63. "order_id" => $insert_order_id,
  64. "good_id" => $_POST["gid"],
  65. "good_name" => $good_info["good_name"],
  66. "subtype" => 0,//test
  67. "good_per_price" => $good_info["good_price"],
  68. "good_num" => $_POST["good_num"],
  69. "all_price" => $good_info["good_price"] * $_POST["good_num"],
  70. "afli_price" => 0,
  71. "start_time" => $_POST["start_date"],
  72. "end_time" => $_POST["end_date"]
  73. );
  74. $objDisney->insertOrderGoods($insert_order_goods_array);
  75. if( $is_smartphone == true ) {
  76. header("Location: http://xmwxc.zhizhuchuxing.cn/wechat/WxPay/realpay/onlinePay.php?orderid=" . $order_serial_no . "&disney=1");
  77. exit();
  78. } else {
  79. $org_address = $base_org_info == false ? "" : $base_org_info["org_address"];
  80. $send_message = getSendMessage( $good_info["good_type"], $_POST["cus_name"], $_POST["start_date"], $good_info["good_name"], $org_address );
  81. sendTelMessage($_POST["cus_mobile"], $_POST["cus_name"], $send_message,$order_serial_no);
  82. header("Location: http://xmwxc.zhizhuchuxing.cn/pay_success.php?order_id=".$order_serial_no);
  83. exit();
  84. }
  85. ?>