|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
- //Author:fuhc
- //Date:20160908
- //基础房型
- require_once __DIR__.'/../HotelLib.php';
-
- class HTBaseRoom extends HotelLib{
- // 添加基础房型
- function addBaseRoom($user_id,$room_type_sale,$hotel_id){
- $sql="update opera_hotel set update_user_id=".$user_id.",
- update_time=now(),
- room_type_sale='".$room_type_sale."'
- where hotel_id=".$hotel_id." and cancel_flag=0";
- writeLog(__FUNCTION__." sql= ".$sql);
- $result=$this->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;
- }
-
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ?>
-
-
-
|