public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); //更新slug if (trim($this->slug) == '') { $this->slug = $this->cid; Content::updateAll(['slug' => $this->cid], ['cid' => $this->cid]); } }