Activity.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace addons\LsActivity\common\models;
  3. use common\helpers\StringHelper;
  4. use Yii;
  5. /**
  6. * This is the model class for table "rf_addon_activity_notice".
  7. *
  8. * @property int $id 序号
  9. * @property string|null $title 标题
  10. * @property string|null $cover 封面
  11. * @property string|null $seo_content seo内容
  12. * @property string|null $description 描述
  13. * @property string|null $seo_key seo关键字
  14. * @property string|null $content 文章内容
  15. * @property int|null $view 浏览量
  16. * @property int|null $sort 优先级
  17. * @property int|null $check_max 报名人数限制
  18. * @property int|null $check 已报名人数
  19. * @property string|null $author 作者
  20. * @property int|null $status 状态
  21. * @property string|null $created_at 创建时间
  22. * @property string|null $updated_at 更新时间
  23. */
  24. class Activity extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return 'rf_addon_activity_notice';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['view', 'sort', 'check_max', 'check', 'status'], 'integer'],
  40. [['created_at', 'updated_at'], 'safe'],
  41. [['title'], 'string', 'max' => 30],
  42. [['cover'], 'string', 'max' => 100],
  43. [['seo_content'], 'string', 'max' => 1000],
  44. [['description', 'content', 'author'], 'string', 'max' => 255],
  45. [['seo_key'], 'string', 'max' => 50],
  46. ];
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function attributeLabels()
  52. {
  53. return [
  54. 'id' => '序号',
  55. 'title' => '标题',
  56. 'cover' => '封面',
  57. 'seo_content' => 'seo内容',
  58. 'description' => '描述',
  59. 'seo_key' => 'seo关键字',
  60. 'content' => '文章内容',
  61. 'view' => '浏览量',
  62. 'sort' => '优先级',
  63. 'check_max' => '报名人数限制',
  64. 'check' => '已报名人数',
  65. 'author' => '作者',
  66. 'status' => '状态',
  67. 'created_at' => '创建时间',
  68. 'updated_at' => '更新时间',
  69. ];
  70. }
  71. /**
  72. * @param bool $insert
  73. * @return bool
  74. */
  75. public function beforeSave($insert)
  76. {
  77. // 推荐位
  78. // $this->position = $this->getPosition();
  79. $this->created_at = StringHelper::dateToInt($this->created_at);
  80. $this->updated_at = time();
  81. return parent::beforeSave($insert);
  82. }
  83. }
粤ICP备19079148号