|
- <?php
-
- namespace backend\modules\api\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * This is the model class for table "opera_hotel_room".
- *
- * @property integer $ID
- * @property integer $CANCEL_FLAG
- * @property integer $CREATE_USER_ID
- * @property string $CREATE_TIME
- * @property integer $UPDATE_USER_ID
- * @property string $UPDATE_TIME
- * @property integer $HOTEL_ID
- * @property integer $PARENT_ROOM_TYPE
- * @property integer $ROOM_TYPE
- * @property string $ROOM_NAME
- * @property integer $OCCUPANCY_LIMIT
- * @property integer $BREAKFAST_INCLUDE
- * @property integer $IS_ONSALE
- */
- class OperaHotelRoom extends ActiveRecord
- {
- const ROOM_TYPE_STATUS_ON = 1; //子房型在售
- const ROOM_TYPE_STATUS_DOWN = 0; //子房型停售
-
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'opera_hotel_room';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'HOTEL_ID', 'PARENT_ROOM_TYPE', 'ROOM_TYPE', 'OCCUPANCY_LIMIT', 'BREAKFAST_INCLUDE', 'IS_ONSALE'], 'integer'],
- [['UPDATE_TIME'], 'safe'],
- [['CREATE_TIME'], 'string', 'max' => 20],
- [['ROOM_NAME'], 'string', 'max' => 100],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'CANCEL_FLAG' => 'Cancel Flag',
- 'CREATE_USER_ID' => '记录创建用户ID',
- 'CREATE_TIME' => '记录创建时间',
- 'UPDATE_USER_ID' => '记录最后更新用户ID',
- 'UPDATE_TIME' => '记录最后更新时间',
- 'HOTEL_ID' => '酒店ID,对应opera_hotel.hotel_id',
- 'PARENT_ROOM_TYPE' => '基础房型,对应base_resource.res_id',
- 'ROOM_TYPE' => '子房型ID',
- 'ROOM_NAME' => '子房型名称',
- 'OCCUPANCY_LIMIT' => '入住人数限制 0:无限制',
- 'BREAKFAST_INCLUDE' => '是否含早,对应dict_type.id',
- 'IS_ONSALE' => '该子房型是否上线 1为上线 0为下线',
- ];
- }
-
- /**
- * Function Description:判断该酒店子房型是否上线
- * Function Name: getOperaHotelRoomOne
- * @param $model
- *
- * @return static
- *
- * @author LUOCJ
- */
- public static function getOperaHotelRoomOne($model)
- {
- $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]);
- return $res;
- }
- }
|