DBTool->execSql($sql); if($result['code']=="0"){ $model=array( "user_id"=>$user_id, "log_type"=>1, "hotel_id"=>$hotel_id, "room_type"=>0, "log_desc"=>"添加基础房型".$room_type_sale ); $this->DBLog->insertLog($model,'添加基础房型'); } $data['code']=$result['code']; $data['info']=$result['info']; return $data; } //得到酒店列表 function getHotelList($user_id,$current,$page_size,$area_id,$hotel_name,$hotel_status){ $sql="CALL ht_hotel_product_list({$user_id},".$area_id.",".$hotel_status.",'".$hotel_name."',".$current.",".$page_size.")"; writeLog(__FUNCTION__." sql=".$sql); $data=array(); $rowset=$this->DBTool->execProcedure($sql); $data['code']=$rowset['code']; $data['info']=$rowset['info']; $data['hotel_list']=isset($rowset['rowset'][0])?$rowset['rowset'][0]:array(); return $data; } // 修改基础房型 function updateBaseRoom($Model){ $user_id=$Model['user_id']; $stock_type=$Model['stock_type']; $base_price=$Model['base_price']; $total_count=$Model['total_count']; $run_date=$Model['run_date']; $room_type=$Model['room_type']; $hotel_id=$Model['hotel_id']; foreach ($Model as $k => $v) { if(empty($v)){ $data['code']="16"; $data['info']="参数错误"; return $data; break; } } $sqlArr=array(); $sql="update run_hotel set update_user_id={$user_id},stock_type={$stock_type},base_price={$base_price},total_count={$total_count} where run_date='".$run_date."' and room_type={$room_type} and hotel_id={$hotel_id} and saled_count<={$total_count};"; writeLog(__FUNCTION__." sql1= ".$sql); $sqlArr[]=$sql; $sql="update run_hotel set update_user_id={$user_id},stock_type={$stock_type},total_count={$total_count} where run_date='".$run_date."' and parent_room_type={$room_type} and hotel_id={$hotel_id} and saled_count<={$total_count};"; writeLog(__FUNCTION__." sql2= ".$sql); $sqlArr[]=$sql; $rowset=$this->DBTool->execSqlArr($sqlArr); if($rowset['code']=="0"){ $model=array( "user_id"=>$user_id, "log_type"=>2, "hotel_id"=>$hotel_id, "room_type"=>$room_type, "log_desc"=>"修改基础房型" ); $this->DBLog->insertLog($model,'修改基础房型'); } $data['code']=$rowset['code']; $data['info']=$rowset['info']; return $data; } // 修改价格库存 function updateStockPrice($user_id,$hotel_id,$room_info){ $sql="call ht_run_room_save({$user_id},{$hotel_id},'{$room_info}')"; writeLog(__FUNCTION__." sql= ".$sql); $rowset=$this->DBTool->execProcedure($sql); $data=array(); $data_r=array(); $data_r['code']=$rowset['code']; $data_r['info']=$rowset['info']; $data_r['rowset']=isset($rowset['rowset'][0])?$rowset['rowset'][0]:array(); if($data_r['code']!="0"){ $data['code']=$data_r['code']; $data['info']=$data_r['info']; return $data; } if($data_r['rowset'][0]['errcode']=="0"){ $room_arr=explode(',',$room_info); $room_str=str_replace('{','',$room_arr); $model=array( "user_id"=>$user_id, "log_type"=>2, "hotel_id"=>$hotel_id, "room_type"=>(int)$room_str, "log_desc"=>"修改价格库存" ); $this->DBLog->insertLog($model,'修改价格库存'); } $data['code']=$data_r['rowset'][0]['errcode']; $data['info']=$data_r['rowset'][0]['errinfo']; return $data; } } ?>