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.

79 lines
1.8 KiB

  1. <?php
  2. namespace backend\modules\shop\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. * @property string $goods_name 商品名称
  14. * @property int $goods_img 商品图片
  15. * @property int $goods_price 商品价格
  16. */
  17. class Collection extends \yii\db\ActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return 'ats_collection';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['user_id', 'goods_id', 'goods_img', 'goods_price'], 'integer'],
  33. [['goods_name'], 'string', 'max' => 120],
  34. ];
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function attributeLabels()
  40. {
  41. return [
  42. 'id' => 'id',
  43. 'user_id' => '用户id',
  44. 'goods_id' => '商品id',
  45. 'updated_at' => '更新时间',
  46. 'created_at' => '创建时间',
  47. 'goods_name' => '商品名称',
  48. 'goods_img' => '商品图片',
  49. 'goods_price' => '商品价格',
  50. ];
  51. }
  52. /**
  53. * @author linyao
  54. * @email 602604991@qq.com
  55. * @created Nov 8, 2019
  56. *
  57. * 行为存储创建时间和更新时间
  58. */
  59. public function behaviors()
  60. {
  61. return [
  62. [
  63. 'class' => TimestampBehavior::className(),
  64. 'createdAtAttribute' => 'created_at',
  65. 'updatedAtAttribute' => 'updated_at',
  66. 'value' => function() {
  67. return time();
  68. },
  69. ],
  70. ];
  71. }
  72. }