<?php

namespace frontend\controllers;

use common\models\UserLogT;
use common\libs\MyLib;

class UserBaseController extends \frontend\controllers\BaseController
{
    public function addUserLog($user_id, $content = '')
    {
        $row = new UserLogT();

        $row->user_id = $user_id;
        $row->content = $content;
        $row->ip = MyLib::getIP();

        if(!$row->save())
            throw new \Exception('添加操作记录失败');
    }
}