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.
 
 
 
 

58 lines
1.8 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. //酒店房型 添加和修改的接口
  7. require_once __DIR__.'/../Common/Mysql.php';
  8. if (ALLOW_ORIGIN)
  9. header("Access-Control-Allow-Origin:*");
  10. $method=isset($_POST['method'])?$_POST['method']:'';
  11. $prod_id=isset($_POST['prod_id'])?$_POST['prod_id']:0;
  12. $info=isset($_POST['info'])?$_POST['info']:'';
  13. $dateTime=isset($_POST['dateTime'])?$_POST['dateTime']:'';
  14. $run_id=isset($_POST['run_id'])?$_POST['run_id']:'';
  15. if ($method == ''){
  16. echo json_encode(array("errcode"=>2,"errinfo"=>"参数不能为空"));
  17. exit;
  18. }
  19. if ($method=='add' && ($prod_id==0 || $info=='' || $dateTime=='')){
  20. echo json_encode(array("errcode"=>3,"errinfo"=>"参数不能为空"));
  21. exit;
  22. }else if($method=='del' && ($prod_id=='' || $dateTime=='' )){
  23. echo json_encode(array("errcode"=>4,"errinfo"=>"参数不能为空"));
  24. exit;
  25. }
  26. $userid=getUserId();
  27. if ($userid ===false){
  28. echo json_encode(array("errcode"=>1,"errinfo"=>"用户未登录"));
  29. exit;
  30. }
  31. $pdo=conn();
  32. if ($method=='add'){
  33. if(is_object($pdo)){
  34. $sql="CALL HT_STOCK_MANAGE(".$userid.",'".$method."','".$info."','".$dateTime."',".$prod_id.")";
  35. writeLog('HT_STOCK_MANAGE::add::'.$sql);
  36. $result=$pdo->query($sql);
  37. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  38. $result->closeCursor();
  39. writeLog("hotel_stock.php method=add".$sql."::".json_encode($rowset));
  40. if (is_array($rowset[0])){
  41. echo json_encode($rowset[0]);
  42. }
  43. }
  44. exit;
  45. }else if ($method =='del'){
  46. $sql="CALL HT_STOCK_MANAGE(".$userid.",'".$method."','".$info."','".$dateTime."',".$prod_id.")";
  47. writeLog('HT_STOCK_MANAGE::del::'.$sql);
  48. $result=$pdo->query($sql);
  49. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  50. $result->closeCursor();
  51. writeLog("hotel_stock.php method=del".$sql."::".json_encode($rowset));
  52. if (is_array($rowset[0])){
  53. echo json_encode($rowset[0]);
  54. }
  55. exit;
  56. }