NewDiyTemplate.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. /**
  11. * This is the model class for table "{{%new_diy_template}}".
  12. *
  13. * @property integer $id
  14. * @property integer $store_id
  15. * @property string $name
  16. * @property string $template
  17. * @property integer $is_delete
  18. * @property integer $addtime
  19. * @property integer $index
  20. * @property string $type
  21. */
  22. class NewDiyTemplate extends \yii\db\ActiveRecord
  23. {
  24. /**
  25. * @inheritdoc
  26. */
  27. public static function tableName()
  28. {
  29. return '{{%new_diy_template}}';
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['store_id', 'template', 'addtime'], 'required'],
  38. [['store_id', 'is_delete', 'addtime', 'is_index', 'type'], 'integer'],
  39. [['template'], 'string'],
  40. [['name'], 'string', 'max' => 45],
  41. ];
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'ID',
  50. 'store_id' => 'Store ID',
  51. 'name' => 'Name',
  52. 'template' => 'Template',
  53. 'is_delete' => 'Is Delete',
  54. 'addtime' => 'Addtime',
  55. 'type' => '类型 index 首页,user 用户中心,goods 商品详情',
  56. 'is_index' => '是否设为首页'
  57. ];
  58. }
  59. public function afterSave($insert, $changedAttributes)
  60. {
  61. parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
  62. (new DiyCommon)->JobBehaviors($this->store_id, StoreSyncExtLog::TYPE_DIY, [$this->id]);
  63. }
  64. }