Notice.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%notice}}".
  6. *
  7. * @property string $id
  8. * @property string $title
  9. * @property integer $sid
  10. * @property integer $created_at
  11. * @property integer $release_time
  12. * @property integer $status
  13. * @property integer $updated_at
  14. */
  15. class Notice extends \yii\db\ActiveRecord
  16. {
  17. /**
  18. * @inheritdoc
  19. */
  20. const STATUS_DELETED = 0;
  21. const STATUS_ACTIVE = 10;
  22. public static function tableName()
  23. {
  24. return '{{%notice}}';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['sid', 'created_at', 'release_time', 'status', 'updated_at'], 'required'],
  33. [['sid', 'created_at', 'release_time','over_time', 'status', 'updated_at'], 'integer'],
  34. ];
  35. }
  36. /**
  37. * @inheritdoc
  38. */
  39. public function attributeLabels()
  40. {
  41. return [
  42. 'id' => 'ID',
  43. 'sid' => 'Sid',
  44. 'created_at' => '创建时间',
  45. 'release_time' => 'Release Time',
  46. 'status' => 'Status',
  47. 'updated_at' => 'Updated At',
  48. 'over_time'=>'结束时间',
  49. ];
  50. }
  51. //公告信息
  52. public function getInformation(){
  53. return $this->hasOne(Information::className(),['id'=>'sid']);
  54. }
  55. }