TimestampBehavior::class, 'value' => time() ] ]; } /** * @inheritdoc */ public function rules() { return [ [['goods_id', 'store_id', 'cat_id', 'is_delete'], 'integer'], [['is_delete'], 'default', 'value' => 0] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'goods_id' => 'Goods ID', 'store_id' => 'Store ID', 'cat_id' => '分类id 多个分类用英文逗号隔开', 'is_delete' => 'Is Delete', ]; } // 关联商品表 public function getGoods() { return $this->hasOne(Goods::className(), ['id'=>'goods_id']); } public function getCat() { return $this->hasOne(Cat::className(), ['id' => 'cat_id']); } }