connectUserId != $userId) { $database = get_db_connect($this->table, $userId); $this->setTable($database['table']); $this->connect($database); $this->sequence('id'); $this->connectUserId = $userId; } return $this; } /** * @param array|mixed $userId * @param bool $bookId * @param bool $insertType * @param int $chapterId * @param int $idx * @return int|string */ public function insert($userId, $bookId, $insertType, $chapterId = 0, $idx = 0) { $data = [ 'user_id' => $userId, 'book_id' => $bookId, 'insert_type' => $insertType, 'chapter_id' => $chapterId, 'idx' => $idx, 'createtime' => time(), 'updatetime' => time(), ]; $res = parent::insert($data); return $res; } }