public static function recordAction($logid, $type, $touid, $uid = '') { $data = array('uid' => $uid != '' ? $uid : zmf::uid(), 'logid' => $logid, 'touid' => $touid, 'classify' => $type, 'cTime' => time(), 'ip' => ip2long(Yii::app()->request->userHostAddress)); $model = new UserAction(); $model->attributes = $data; if ($model->validate()) { if ($model->save()) { return true; } else { return false; } } else { return false; } }