15], [['start_time', 'end_time', 'apply_week'], 'string', 'max' => 10], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'create_time' => 'Create Time', 'create_user_id' => 'Create User ID', 'update_user_id' => 'Update User ID', 'update_time' => 'Update Time', 'cancel_flag' => 'Cancel Flag', 'channel_id' => 'Channel ID', 'master_hotel_id' => 'Master Hotel ID', 'sub_hotel_id' => 'Sub Hotel ID', 'hotel_id' => 'Hotel ID', 'onsale' => 'Onsale', 'start_date' => 'Start Date', 'end_date' => 'End Date', 'start_time' => 'Start Time', 'end_time' => 'End Time', 'end_time_type' => 'End Time Type', 'apply_week' => 'Apply Week', ]; } public function getBaseSupplier() { return $this->hasOne(BaseSupplier::className(), ['ID' => 'channel_id']); } public function beforeSave($insert) { if ($this->isNewRecord) { $this->create_time = date('Y-m-d H:i:s'); $this->create_user_id = Yii::$app->user->id; $this->cancel_flag = 0; } else { $this->update_time = date('Y-m-d H:i:s'); $this->update_user_id = Yii::$app->user->id; } return parent::beforeSave($insert); } /** * des:获取母物理房型 * author:guhh */ public function getMasterBasicroomList($params) { } /** * Des:获取详细 根据子酒店 ID * Name: getInfoBySubHotel * @param $params * @return array * @author 倪宗锋 */ public function getInfoBySubHotel($params) { $where = [ 'and', ['=', 'sub_hotel_id', $params['sub_hotel_id']], ['=', 'cancel_flag', 0], ]; if (empty($params['channel_id']) == false) { $where[] = ['=', 'channel_id', $params['channel_id']]; } $info = self::find() ->where($where) ->asArray() ->one(); return $info; } /** * Function Description:根据渠道和子酒店编号获取蜘蛛酒店编号 * Function Name: getHotelIdBySub * @param $channel_id * @param $sub_hotel_id * * @return mixed * * @author 娄梦宁 */ public static function getHotelIdBySub($channel_id,$sub_hotel_id){ $result=self::find()->select('hotel_id')->from(ChannelHotelMapping::tableName()) ->where(['and',['=','channel_id',$channel_id],['=','sub_hotel_id',$sub_hotel_id],['=','cancel_flag',0]]) ->asArray() ->one(); return $result['hotel_id']; } }