Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

87 строки
2.6 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "opera_hotel_room".
  6. *
  7. * @property integer $ID
  8. * @property integer $CANCEL_FLAG
  9. * @property integer $CREATE_USER_ID
  10. * @property string $CREATE_TIME
  11. * @property integer $UPDATE_USER_ID
  12. * @property string $UPDATE_TIME
  13. * @property integer $HOTEL_ID
  14. * @property integer $PARENT_ROOM_TYPE
  15. * @property integer $ROOM_TYPE
  16. * @property string $ROOM_NAME
  17. * @property integer $OCCUPANCY_LIMIT
  18. * @property integer $BREAKFAST_INCLUDE
  19. * @property integer $IS_ONSALE
  20. */
  21. class OperaHotelRoom extends ActiveRecord
  22. {
  23. const ROOM_TYPE_STATUS_ON = 1; //子房型在售
  24. const ROOM_TYPE_STATUS_DOWN = 0; //子房型停售
  25. /**
  26. * @inheritdoc
  27. */
  28. public static function tableName()
  29. {
  30. return 'opera_hotel_room';
  31. }
  32. /**
  33. * @inheritdoc
  34. */
  35. public function rules()
  36. {
  37. return [
  38. [['CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'HOTEL_ID', 'PARENT_ROOM_TYPE', 'ROOM_TYPE', 'OCCUPANCY_LIMIT', 'BREAKFAST_INCLUDE', 'IS_ONSALE'], 'integer'],
  39. [['UPDATE_TIME'], 'safe'],
  40. [['CREATE_TIME'], 'string', 'max' => 20],
  41. [['ROOM_NAME'], 'string', 'max' => 100],
  42. ];
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'ID' => 'ID',
  51. 'CANCEL_FLAG' => 'Cancel Flag',
  52. 'CREATE_USER_ID' => '记录创建用户ID',
  53. 'CREATE_TIME' => '记录创建时间',
  54. 'UPDATE_USER_ID' => '记录最后更新用户ID',
  55. 'UPDATE_TIME' => '记录最后更新时间',
  56. 'HOTEL_ID' => '酒店ID,对应opera_hotel.hotel_id',
  57. 'PARENT_ROOM_TYPE' => '基础房型,对应base_resource.res_id',
  58. 'ROOM_TYPE' => '子房型ID',
  59. 'ROOM_NAME' => '子房型名称',
  60. 'OCCUPANCY_LIMIT' => '入住人数限制 0:无限制',
  61. 'BREAKFAST_INCLUDE' => '是否含早,对应dict_type.id',
  62. 'IS_ONSALE' => '该子房型是否上线 1为上线 0为下线',
  63. ];
  64. }
  65. /**
  66. * Function Description:判断该酒店子房型是否上线
  67. * Function Name: getOperaHotelRoomOne
  68. * @param $model
  69. *
  70. * @return static
  71. *
  72. * @author LUOCJ
  73. */
  74. public static function getOperaHotelRoomOne($model)
  75. {
  76. $res = OperaHotelRoom::findOne(['cancel_flag' => 0, 'hotel_id' => $model->extra_res_info, 'parent_room_type' => $model->top_res_id, 'room_type' => $model->sub_res_id, 'is_onsale' => OperaHotelRoom::ROOM_TYPE_STATUS_ON]);
  77. return $res;
  78. }
  79. }