VideoGoods.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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\db\ActiveRecord;
  10. use yii\behaviors\TimestampBehavior;
  11. use Yii;
  12. /**
  13. * This is the model class for table "{{%video_goods}}".
  14. *
  15. * @property int $id
  16. * @property int $store_id
  17. * @property int $goods_id 商品id
  18. * @property int $is_delete 是否删除
  19. * @property int $status 状态
  20. * @property int created_at 创建时间
  21. * @property int updated_at 更新时间
  22. */
  23. class VideoGoods extends \yii\db\ActiveRecord
  24. {
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public static function tableName()
  29. {
  30. return '{{%video_goods}}';
  31. }
  32. public function behaviors()
  33. {
  34. return [
  35. [
  36. 'class' => TimestampBehavior::class,
  37. 'attributes' => [
  38. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  39. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  40. ]
  41. ]
  42. ];
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function rules()
  48. {
  49. return [
  50. [['store_id', 'goods_id', 'is_delete', 'status', 'created_at', 'updated_at'], 'integer'],
  51. ];
  52. }
  53. public function afterSave($insert, $changedAttributes)
  54. {
  55. parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
  56. (new DiyCommon)->JobBehaviors($this->store_id, StoreSyncExtLog::TYPE_VIDEO_GOODS);
  57. }
  58. }