|
- <?php
-
- namespace backend\modules\hotel\models;
-
- use Yii;
-
- /**
- * This is the model class for table "test_channel_hotel_relation".
- *
- * 数据表所属数据库IP:101.37.36.30,数据库名称:python
- * 用于同步酒店比价同步数据用
- *
- * @property integer $CancelFlag
- * @property string $ChannelHotelId
- * @property integer $HotelId
- * @property integer $ChannelId
- */
- class SyncPriceComparedHotel extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'channel_hotel_relation';
- }
-
- /**
- * @return \yii\db\Connection the database connection used by this AR class.
- */
- public static function getDb()
- {
- return Yii::$app->get('db2');
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['CancelFlag', 'HotelId', 'ChannelId'], 'integer'],
- [['ChannelHotelId', 'HotelId', 'ChannelId'], 'required'],
- [['ChannelHotelId'], 'string', 'max' => 20],
- [['HotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['HotelId', 'ChannelId'], 'message' => 'The combination of 本地酒店ID and 渠道ID 1:携程 has already been taken.'],
- [['ChannelHotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['ChannelHotelId', 'ChannelId'], 'message' => 'The combination of 渠道酒店ID and 渠道ID 1:携程 has already been taken.'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'CancelFlag' => 'Cancel Flag',
- 'ChannelHotelId' => '渠道酒店ID',
- 'HotelId' => '本地酒店ID',
- 'ChannelId' => '渠道ID 1:携程',
- ];
- }
-
- /**
- * 更新数据
- */
- public function beforeSave($insert)
- {
- if($this -> isNewRecord)
- {
- $this -> CancelFlag = 0;
- }
- return parent::beforeSave($insert);
- }
- }
|