Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

75 rindas
1.9 KiB

  1. <?php
  2. namespace backend\modules\hotel\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "test_channel_hotel_relation".
  6. *
  7. * 数据表所属数据库IP:101.37.36.30,数据库名称:python
  8. * 用于同步酒店比价同步数据用
  9. *
  10. * @property integer $CancelFlag
  11. * @property string $ChannelHotelId
  12. * @property integer $HotelId
  13. * @property integer $ChannelId
  14. */
  15. class SyncPriceComparedHotel extends \yii\db\ActiveRecord
  16. {
  17. /**
  18. * @inheritdoc
  19. */
  20. public static function tableName()
  21. {
  22. return 'channel_hotel_relation';
  23. }
  24. /**
  25. * @return \yii\db\Connection the database connection used by this AR class.
  26. */
  27. public static function getDb()
  28. {
  29. return Yii::$app->get('db2');
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['CancelFlag', 'HotelId', 'ChannelId'], 'integer'],
  38. [['ChannelHotelId', 'HotelId', 'ChannelId'], 'required'],
  39. [['ChannelHotelId'], 'string', 'max' => 20],
  40. [['HotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['HotelId', 'ChannelId'], 'message' => 'The combination of 本地酒店ID and 渠道ID 1:携程 has already been taken.'],
  41. [['ChannelHotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['ChannelHotelId', 'ChannelId'], 'message' => 'The combination of 渠道酒店ID and 渠道ID 1:携程 has already been taken.'],
  42. ];
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'CancelFlag' => 'Cancel Flag',
  51. 'ChannelHotelId' => '渠道酒店ID',
  52. 'HotelId' => '本地酒店ID',
  53. 'ChannelId' => '渠道ID 1:携程',
  54. ];
  55. }
  56. /**
  57. * 更新数据
  58. */
  59. public function beforeSave($insert)
  60. {
  61. if($this -> isNewRecord)
  62. {
  63. $this -> CancelFlag = 0;
  64. }
  65. return parent::beforeSave($insert);
  66. }
  67. }