|
- <?php
- require_once __DIR__.'/../HotelLib.php';
- /**
- * Created by PhpStorm.
- * User: gaohan
- * Date: 2016/11/24
- * Time: 16:11
- */
- class SetBaseRoomModel extends HotelLib
- {
- //修改基础房型的库存
- function BaseRoomSet($user_id,$hotel_id,$room_info){
- // var_dump($room_info);exit();
- $room_info_arr=array_filter(explode('}',$room_info));
- $desc='';
- $room_type='';
- $room_name='';
- foreach ($room_info_arr as $v){
- $res=explode(',',$v);
- $room_type=ltrim($res[0],'{');
- $obj=$this->DBTool->queryBySql("select res_name from base_resource where id=$room_type");
- $room_name=isset($obj['rowset'][0]['res_name'])?$obj['rowset'][0]['res_name']:'';
- if ($res[4]==228){
- $desc.=$res[1].'到'.$res[2].'买断房库存为'.$res[5].' ';
- }elseif ($res[4]==229){
- $desc.=$res[1].'到'.$res[2].'保留房库存为'.$res[5].' ';
- }elseif ($res[4]==230){
- $desc.=$res[1].'到'.$res[2].'现询房库存为'.$res[5].' ';
- }
- }
- $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"){
- $model=array(
- "user_id"=>$user_id,
- "log_type"=>2,
- "hotel_id"=>$hotel_id,
- "room_type"=>$room_type,
- "log_desc"=>"修改".$room_name.$desc
- );
- $this->DBLog->insertLog($model,'修改基础房型库存');
- }
- $data['code']=$data_r['rowset'][0]['errcode'];
- $data['info']=$data_r['rowset'][0]['errinfo'];
- return $data;
- }
- }
|