* @since 1.0 */ class SystemLog extends ActiveRecord { /** * @inheritdoc */ # 设置table public static function tableName() { return '{{%system_log}}'; } /** * @inheritdoc */ # 设置 status 默认 ,以及取值的区间 public function rules() { return [ ]; } public function beforeSave($insert) { if (parent::beforeSave($insert)) { if($insert == self::EVENT_BEFORE_INSERT){ $user = Yii::$app->user->identity; $account = $user['username']; $this->created_person = $account; $this->created_at = CDate::getCurrentDateTime(); }else{ } $this->updated_at = CDate::getCurrentDateTime(); return true; } else { return false; } } }