AboutArticle.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use app\jobs\storeSync\DiyCommon;
  9. use Yii;
  10. use yii\db\ActiveRecord;
  11. use yii\behaviors\TimestampBehavior;
  12. /**
  13. * This is the model class for table "{{%topic_type}}".
  14. *
  15. * @property int $id
  16. * @property int|null $store_id
  17. * @property string|null $name
  18. * @property string|null $desc
  19. * @property int|null $sort
  20. * @property int|null $is_delete
  21. * @property int|null $created_at 添加时间
  22. * @property int|null $updated_at 更新时间
  23. * @property int $type
  24. */
  25. class AboutArticle extends \yii\db\ActiveRecord
  26. {
  27. const IS_DELETE_YES = 1;//已删除
  28. const IS_DELETE_NO = 0;//未删除
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName()
  33. {
  34. return '{{%about_article}}';
  35. }
  36. public function behaviors()
  37. {
  38. return [
  39. [
  40. 'class' => TimestampBehavior::class,
  41. 'attributes' => [
  42. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  43. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  44. ]
  45. ]
  46. ];
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function rules()
  52. {
  53. return [
  54. [['sort', 'is_delete', 'store_id', 'created_at', 'updated_at', 'type'], 'integer'],
  55. [['name'], 'string', 'max' => 255],
  56. [['desc'], 'string']
  57. ];
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function attributeLabels()
  63. {
  64. return [
  65. 'id' => 'ID',
  66. 'name' => 'Name',
  67. 'desc' => '文章详情',
  68. 'sort' => 'Sort',
  69. 'is_delete' => 'Is Delete',
  70. 'store_id' => 'Store ID',
  71. 'created_at' => 'created_at',
  72. 'updated_at' => 'updated_at',
  73. 'type' => '文章类型'
  74. ];
  75. }
  76. public function afterSave($insert, $changedAttributes)
  77. {
  78. parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
  79. (new DiyCommon)->JobBehaviors($this->store_id, StoreSyncExtLog::TYPE_ARTICLE);
  80. }
  81. }