NewIntegralCat.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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\behaviors\TimestampBehavior;
  11. use yii\db\ActiveRecord;
  12. /**
  13. * This is the model class for table "{{%saas_integral_cat}}".
  14. *
  15. * @property integer $id
  16. * @property string $name
  17. * @property integer $store_id
  18. * @property integer $is_enable
  19. * @property integer $is_delete
  20. * @property integer $created_at
  21. * @property integer $updated_at
  22. */
  23. class NewIntegralCat extends \yii\db\ActiveRecord
  24. {
  25. /**
  26. * 删除状态:已删除
  27. */
  28. const DELETE_STATUS_TRUE = 1;
  29. /**
  30. * 删除状态:未删除
  31. */
  32. const DELETE_STATUS_FALSE = 0;
  33. /**
  34. * 禁用状态:已禁用
  35. */
  36. const IS_ENABLE_FALSE = 0;
  37. /**
  38. * 禁用状态:未禁用
  39. */
  40. const IS_ENABLE_TRUE= 1;
  41. /**
  42. * @inheritdoc
  43. */
  44. public static function tableName()
  45. {
  46. return '{{%new_integral_cat}}';
  47. }
  48. /**
  49. * @inheritdoc
  50. */
  51. public function rules()
  52. {
  53. return [
  54. [['is_delete', 'is_enable', 'store_id'], 'integer'],
  55. [['name'], 'string', 'max' => 32],
  56. ];
  57. }
  58. public function behaviors()
  59. {
  60. return [
  61. [
  62. 'class' => TimestampBehavior::class,
  63. 'attributes' => [
  64. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  65. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  66. ]
  67. ]
  68. ];
  69. }
  70. /**
  71. * @inheritdoc
  72. */
  73. public function attributeLabels()
  74. {
  75. return [
  76. 'id' => '分类ID',
  77. 'store_id' => '商城id',
  78. 'name' => '分类名称',
  79. 'is_delete' => 'Is Delete',
  80. 'is_enable' => '状态',
  81. 'created_at' => '创建时间',
  82. 'updated_at' => '更新时间',
  83. 'sort' => '排序'
  84. ];
  85. }
  86. public function afterSave($insert, $changedAttributes)
  87. {
  88. parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
  89. (new DiyCommon)->JobBehaviors($this->store_id, StoreSyncExtLog::TYPE_INTEGRAL_STORE);
  90. }
  91. }