_user_model === null) { return $this->_user_model = new UserModel(); } return $this->_user_model; } public function login(string $host, string $id, string $password): bool|UserEntity { $user_entity = $this->getUserModel()->getEntityByID($id); // $response = $this->getWebLibrary($host)->getResponse( // $host . getenv("mangboard.login.url"), // "post", // [ // 'form_params' => [ // 'user_id' => $id, // 'password' => $password, // ], // ] // ); // if ($response->getStatusCode() == 200) { // $entity = $this->getUserModel()->getEntityByLoginCheck($id, $password); // if ($entity === null) { // throw new \Exception("{$id}는 회원이 아니거나 암호가 맞지 않습니다."); // } // } else { // throw new \Exception("연결실패:" . $response->getStatusCode()); // } log_message("notice", "{$id}로 로그인 성공"); return $user_entity; } public function yamap(string $category, string $id = "", string $debug = "false"): string { try { $id = $id == "" ? getenv("mangboard.login.default.id") : $id; $password = getenv("mangboard.login.default.password"); //1. 사이트 로그인 처리 $user_entity = $this->login(getenv("mangboard.host.url"), $id, $password); //2. 필요한 로그인한 사용자정보,Socket,Storage 정의후 Crawler에게 전달. $crawler = new YamapCrawler(getenv('yamap.host.url'), $category, $user_entity); $crawler->setDebug($debug === "true" ? true : false); $crawler->execute(intval(getenv("yamap.list.max_limit"))); return "완료되었습니다."; } catch (\Exception $e) { log_message("error", $e->getMessage()); return $e->getMessage(); } } public function yamoon(string $category, string $id = "", string $debug = "false"): string { try { $id = $id == "" ? getenv("mangboard.login.default.id") : $id; $password = getenv("mangboard.login.default.password"); //1. 사이트 로그인 처리 $user_entity = $this->login(getenv("mangboard.host.url"), $id, $password); //2. 필요한 로그인한 사용자정보,Socket,Storage 정의후 Crawler에게 전달. $crawler = new YamoonCrawler(getenv("yamoon.host.url"), $category, $user_entity); $crawler->setDebug($debug === "true" ? true : false); $crawler->execute(intval(getenv("yamap.list.max_limit"))); return "완료되었습니다."; } catch (\Exception $e) { log_message("error", $e->getMessage()); return $e->getMessage(); } } }