You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.7 KiB

  1. <?php
  2. namespace common\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_goods_attr".
  7. *
  8. * @property int $id
  9. * @property int $goods_id 商品id
  10. * @property int $attr_id 属性id
  11. * @property string $attr_value 属性名
  12. * @property int $is_delete 是否删除,1为已删除
  13. * @property int $created_at 创建时间
  14. * @property int $updated_at 更新时间
  15. */
  16. class GoodsAttr extends \yii\db\ActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return 'ats_goods_attr';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['goods_id', 'attr_id', 'is_delete'], 'integer'],
  32. [['attr_value'], 'string', 'max' => 50],
  33. ];
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => 'id',
  42. 'goods_id' => '商品id',
  43. 'attr_id' => '属性id',
  44. 'attr_value' => '属性名',
  45. 'is_delete' => '是否删除,1为已删除',
  46. 'created_at' => '创建时间',
  47. 'updated_at' => '更新时间',
  48. ];
  49. }
  50. /**
  51. * @author linyao
  52. * @email 602604991@qq.com
  53. * @created Nov 8, 2019
  54. *
  55. * 行为存储创建时间和更新时间
  56. */
  57. public function behaviors()
  58. {
  59. return [
  60. [
  61. 'class' => TimestampBehavior::className(),
  62. 'createdAtAttribute' => 'created_at',
  63. 'updatedAtAttribute' => 'updated_at',
  64. 'value' => function() {
  65. return time();
  66. },
  67. ],
  68. ];
  69. }
  70. }