120], [['user_name', 'resources_name', 'phpsessid', 'user_agent', 'last_login'], 'string', 'max' => 255], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Title', 'memo' => 'Memo', 'uid' => 'Uid', 'user_type' => 'User Type', 'user_name' => 'User Name', 'resources_id' => 'Resources ID', 'resources_type' => 'Resources Type', 'resources_name' => 'Resources Name', 'phpsessid' => 'Phpsessid', 'user_agent' => 'User Agent', 'create_time' => 'Crate Time', 'last_login' => 'last_login' ]; } /** * Des:添加新记录 * Name: addNew * @param $title string 标题 * @param $memo string 内容 * @param $user_info array 用户信息 * @param $sourceInfo array 资源信息 * @return bool * @author 倪宗锋 */ public function addNew($title, $memo, $user_info, $sourceInfo) { $data = [ 'id' => 'ID', 'title' => $title, 'memo' => $memo, 'uid' => $user_info['uid'], 'user_type' => $user_info['user_type'], 'user_name' => $user_info['user_name'], 'last_login' => $user_info['last_login'], 'resources_id' => $sourceInfo['resources_id'], 'resources_type' => $sourceInfo['resources_type'], 'resources_name' => $sourceInfo['resources_name'], 'phpsessid' => session_id(), 'user_agent' => empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'], ]; $this->setAttributes($data); $insertFlag = $this->insert(); $msg = $this->getErrors(); return $insertFlag; } }