2,"errinfo"=>"参数不能为空")); exit; } if ($method=='add' && ($prod_id==0 || $info=='' || $dateTime=='')){ echo json_encode(array("errcode"=>3,"errinfo"=>"参数不能为空")); exit; }else if($method=='del' && ($prod_id=='' || $dateTime=='' )){ echo json_encode(array("errcode"=>4,"errinfo"=>"参数不能为空")); exit; } $userid=getUserId(); if ($userid ===false){ echo json_encode(array("errcode"=>1,"errinfo"=>"用户未登录")); exit; } $pdo=conn(); if ($method=='add'){ if(is_object($pdo)){ $sql="CALL HT_STOCK_MANAGE(".$userid.",'".$method."','".$info."','".$dateTime."',".$prod_id.")"; writeLog('HT_STOCK_MANAGE::add::'.$sql); $result=$pdo->query($sql); $rowset=$result->fetchAll(PDO::FETCH_ASSOC); $result->closeCursor(); writeLog("hotel_stock.php method=add".$sql."::".json_encode($rowset)); if (is_array($rowset[0])){ echo json_encode($rowset[0]); } } exit; }else if ($method =='del'){ $sql="CALL HT_STOCK_MANAGE(".$userid.",'".$method."','".$info."','".$dateTime."',".$prod_id.")"; writeLog('HT_STOCK_MANAGE::del::'.$sql); $result=$pdo->query($sql); $rowset=$result->fetchAll(PDO::FETCH_ASSOC); $result->closeCursor(); writeLog("hotel_stock.php method=del".$sql."::".json_encode($rowset)); if (is_array($rowset[0])){ echo json_encode($rowset[0]); } exit; }