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.
 
 
 

73 lines
1.5 KiB

<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_collection".
*
* @property int $id
* @property int $user_id 用户id
* @property int $goods_id 商品id
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class Collection extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_collection';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'goods_id'], 'required'],
[['user_id', 'goods_id'], 'integer'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'user_id' => '用户id',
'goods_id' => '商品id',
'updated_at' => '更新时间',
'created_at' => '创建时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}