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.

71 lines
1.4 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_collection".
  7. *
  8. * @property int $id
  9. * @property int $user_id 用户id
  10. * @property int $goods_id 商品id
  11. * @property int $updated_at 更新时间
  12. * @property int $created_at 创建时间
  13. */
  14. class Collection extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return 'ats_collection';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['user_id', 'goods_id'], 'integer'],
  30. ];
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function attributeLabels()
  36. {
  37. return [
  38. 'id' => 'id',
  39. 'user_id' => '用户id',
  40. 'goods_id' => '商品id',
  41. 'updated_at' => '更新时间',
  42. 'created_at' => '创建时间',
  43. ];
  44. }
  45. /**
  46. * @author linyao
  47. * @email 602604991@qq.com
  48. * @created Nov 8, 2019
  49. *
  50. * 行为存储创建时间和更新时间
  51. */
  52. public function behaviors()
  53. {
  54. return [
  55. [
  56. 'class' => TimestampBehavior::className(),
  57. 'createdAtAttribute' => 'created_at',
  58. 'updatedAtAttribute' => 'updated_at',
  59. 'value' => function() {
  60. return time();
  61. },
  62. ],
  63. ];
  64. }
  65. }