public function beforeValidate()
{
$this->update_time = new CDbExpression('NOW()');
if ($this->isNewRecord) {
$this->create_time = $this->update_time;
$this->ip = Yii::app()->getRequest()->userHostAddress;
if (!$this->type) {
$this->type = self::TYPE_DEFAULT;
}
}
return parent::beforeValidate();
}