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.

SetBaseRoomModel.php 2.1 KiB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. require_once __DIR__.'/../HotelLib.php';
  3. /**
  4. * Created by PhpStorm.
  5. * User: gaohan
  6. * Date: 2016/11/24
  7. * Time: 16:11
  8. */
  9. class SetBaseRoomModel extends HotelLib
  10. {
  11. //修改基础房型的库存
  12. function BaseRoomSet($user_id,$hotel_id,$room_info){
  13. // var_dump($room_info);exit();
  14. $room_info_arr=array_filter(explode('}',$room_info));
  15. $desc='';
  16. $room_type='';
  17. $room_name='';
  18. foreach ($room_info_arr as $v){
  19. $res=explode(',',$v);
  20. $room_type=ltrim($res[0],'{');
  21. $obj=$this->DBTool->queryBySql("select res_name from base_resource where id=$room_type");
  22. $room_name=isset($obj['rowset'][0]['res_name'])?$obj['rowset'][0]['res_name']:'';
  23. if ($res[4]==228){
  24. $desc.=$res[1].'到'.$res[2].'买断房库存为'.$res[5].' ';
  25. }elseif ($res[4]==229){
  26. $desc.=$res[1].'到'.$res[2].'保留房库存为'.$res[5].' ';
  27. }elseif ($res[4]==230){
  28. $desc.=$res[1].'到'.$res[2].'现询房库存为'.$res[5].' ';
  29. }
  30. }
  31. $sql="call ht_run_room_save({$user_id},{$hotel_id},'{$room_info}')";
  32. writeLog(__FUNCTION__." sql= ".$sql);
  33. $rowset=$this->DBTool->execProcedure($sql);
  34. $data=array();
  35. $data_r=array();
  36. $data_r['code']=$rowset['code'];
  37. $data_r['info']=$rowset['info'];
  38. $data_r['rowset']=isset($rowset['rowset'][0])?$rowset['rowset'][0]:array();
  39. if($data_r['code']!="0"){
  40. $data['code']=$data_r['code'];
  41. $data['info']=$data_r['info'];
  42. return $data;
  43. }
  44. if($data_r['rowset'][0]['errcode']=="0"){
  45. $model=array(
  46. "user_id"=>$user_id,
  47. "log_type"=>2,
  48. "hotel_id"=>$hotel_id,
  49. "room_type"=>$room_type,
  50. "log_desc"=>"修改".$room_name.$desc
  51. );
  52. $this->DBLog->insertLog($model,'修改基础房型库存');
  53. }
  54. $data['code']=$data_r['rowset'][0]['errcode'];
  55. $data['info']=$data_r['rowset'][0]['errinfo'];
  56. return $data;
  57. }
  58. }