/** * 添加用户操作日志 * @param $log 描述详细操作 * @return bool */ public static function AddOperationLog($log) { if (!empty($log)) { $operation_log = new OperationLog(); $operation_log->Description = $log; // 详细操作 $operation_log->UserId = Yii::app()->user->id; // 用户Id $operation_log->CreationDate = new CDbExpression('NOW()'); // 日志生成时间 $operation_log->save(); // 保存日志 } else { return false; } }