Commit be0cdaed authored by baesangjune's avatar baesangjune
Browse files

.

parent df06ba88
[{"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js":"3","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js":"5","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js":"6"},{"size":1133,"mtime":1610956158273,"results":"7","hashOfConfig":"8"},{"size":375,"mtime":1610931750280,"results":"9","hashOfConfig":"8"},{"size":1553,"mtime":1610931750241,"results":"10","hashOfConfig":"8"},{"size":11584,"mtime":1610956268248,"results":"11","hashOfConfig":"8"},{"size":5413,"mtime":1610956277089,"results":"12","hashOfConfig":"8"},{"size":2199,"mtime":1610931750239,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1hwnshv",{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"20","messages":"21","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"22","messages":"23","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js",[],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js",["27","28","29"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js",["30","31","32","33"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js",["34","35","36","37","38","39"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js",[],["40","41"],{"ruleId":"42","severity":1,"message":"43","line":1,"column":17,"nodeType":"44","messageId":"45","endLine":1,"endColumn":26},{"ruleId":"42","severity":1,"message":"46","line":2,"column":10,"nodeType":"44","messageId":"45","endLine":2,"endColumn":14},{"ruleId":"42","severity":1,"message":"47","line":4,"column":64,"nodeType":"44","messageId":"45","endLine":4,"endColumn":75},{"ruleId":"42","severity":1,"message":"48","line":5,"column":83,"nodeType":"44","messageId":"45","endLine":5,"endColumn":93},{"ruleId":"42","severity":1,"message":"49","line":15,"column":12,"nodeType":"44","messageId":"45","endLine":15,"endColumn":18},{"ruleId":"50","severity":1,"message":"51","line":51,"column":8,"nodeType":"52","endLine":51,"endColumn":10,"suggestions":"53"},{"ruleId":"54","severity":1,"message":"55","line":115,"column":35,"nodeType":"56","endLine":115,"endColumn":76},{"ruleId":"42","severity":1,"message":"57","line":3,"column":33,"nodeType":"44","messageId":"45","endLine":3,"endColumn":36},{"ruleId":"42","severity":1,"message":"58","line":3,"column":46,"nodeType":"44","messageId":"45","endLine":3,"endColumn":51},{"ruleId":"42","severity":1,"message":"59","line":3,"column":53,"nodeType":"44","messageId":"45","endLine":3,"endColumn":57},{"ruleId":"42","severity":1,"message":"60","line":3,"column":59,"nodeType":"44","messageId":"45","endLine":3,"endColumn":68},{"ruleId":"42","severity":1,"message":"61","line":3,"column":70,"nodeType":"44","messageId":"45","endLine":3,"endColumn":78},{"ruleId":"50","severity":1,"message":"62","line":20,"column":6,"nodeType":"52","endLine":20,"endColumn":8,"suggestions":"63"},{"ruleId":"64","replacedBy":"65"},{"ruleId":"66","replacedBy":"67"},"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'Link' is defined but never used.","'FormControl' is defined but never used.","'Pagination' is defined but never used.","'mobile' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'getImg' and 'getPlace'. Either include them or remove the dependency array.","ArrayExpression",["68"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'Col' is defined but never used.","'Badge' is defined but never used.","'Card' is defined but never used.","'Accordion' is defined but never used.","'Carousel' is defined but never used.","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["69"],"no-native-reassign",["70"],"no-negated-in-lhs",["71"],{"desc":"72","fix":"73"},{"desc":"74","fix":"75"},"no-global-assign","no-unsafe-negation","Update the dependencies array to be: [getImg, getPlace]",{"range":"76","text":"77"},"Update the dependencies array to be: [getReview]",{"range":"78","text":"79"},[1678,1680],"[getImg, getPlace]",[560,562],"[getReview]"] [{"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js":"3","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js":"5","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js":"6"},{"size":1133,"mtime":1610956158273,"results":"7","hashOfConfig":"8"},{"size":375,"mtime":1610931750280,"results":"9","hashOfConfig":"8"},{"size":1553,"mtime":1610931750241,"results":"10","hashOfConfig":"8"},{"size":8468,"mtime":1611085803712,"results":"11","hashOfConfig":"8"},{"size":1608,"mtime":1611080275421,"results":"12","hashOfConfig":"8"},{"size":2199,"mtime":1610931750239,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"1hwnshv",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"21","usedDeprecatedRules":"16"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"26","usedDeprecatedRules":"16"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"16"},"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\index.js",[],["29","30"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\App.js",["31","32","33"],"import React, { useEffect, useState } from 'react';\r\nimport { Link, Redirect } from 'react-router-dom';\r\nimport ohuh from '../ohuh.PNG';\r\nimport { Container, Row, Form, Image, InputGroup, Button, Col, FormControl } from 'react-bootstrap';\r\n\r\nfunction App() {\r\n const [state, setState] = useState(false);\r\n const [search, setSearch] = useState(\"\");\r\n\r\n if (state !== false) {\r\n return <Redirect to={{\r\n pathname: `/search/${search}`,\r\n state: { id: search },\r\n }} />;\r\n }\r\n\r\n const handleChange = (e) => {\r\n setSearch(e.target.value);\r\n }\r\n\r\n const handleSubmit = () => {\r\n setState(true);\r\n }\r\n\r\n return (\r\n <Container className=\"vh-100 d-flex justify-content-md-center align-items-center\">\r\n <Col md={6} lassName=\" d-flex justify-content-center\">\r\n <Row style={{marginBottom:20}}>\r\n <Image src={ohuh} />\r\n </Row>\r\n <Row style={{marginBottom:500}}>\r\n <Form className=\"vw-100\" onSubmit={handleSubmit}>\r\n <InputGroup>\r\n <Form.Control\r\n size=\"lg\"\r\n placeholder=\"검색어를 입력하세요.\"\r\n aria-label=\"Large\"\r\n aria-describedby=\"inputGroup-sizing-sm\"\r\n onChange={handleChange}\r\n />\r\n <InputGroup.Append>\r\n <Button type='submit' variant=\"outline-secondary\">검색</Button>\r\n </InputGroup.Append>\r\n </InputGroup>\r\n </Form>\r\n </Row>\r\n </Col>\r\n </Container>\r\n );\r\n}\r\n\r\nexport default App;","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Pages\\Search.js",["34","35","36","37"],"C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Place.js",["38","39","40","41","42","43"],"import axios from 'axios';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { Modal, Container, Row, Col, Button, Badge, Card, Accordion, Carousel } from 'react-bootstrap';\r\n\r\nfunction Place(props) {\r\n const [reviews, setReviews] = useState([])\r\n const getReview = () => {\r\n axios.get(`/api/review/${props.search.name}`)\r\n .then(res => {\r\n console.log(\"place res.data\", res.data)\r\n setReviews(res.data)\r\n })\r\n .catch(err => {\r\n console.log(err)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n getReview();\r\n }, [])\r\n\r\n\r\n return (\r\n <Modal {...props}\r\n size=\"xl\"\r\n keyboard=\"true\"\r\n variant=\"backdrop.in\"\r\n // show={lgShow}\r\n // onHide={() => setLgShow(false)}\r\n aria-labelledby=\"example-modal-sizes-title-lg\">\r\n <Modal.Header closeButton>\r\n <Modal.Title id=\"contained-modal-title-vcenter\" style={{ fontSize: '40px' }}>\r\n {props.index + 1}. {props.search.name}\r\n </Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body className=\"show-grid\">\r\n <Container style={{ fontSize: '40px' }}>\r\n {reviews.map((review, index) => {\r\n return (\r\n <Row className=\"mt-4\">\r\n <a href={review.link}>{review.title}</a>\r\n <div>{review.summary}</div>\r\n <div>{review.content}</div>\r\n </Row>\r\n )\r\n })}\r\n </Container>\r\n\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button block onClick={props.onHide}>Close</Button>\r\n </Modal.Footer>\r\n </Modal>\r\n );\r\n}\r\n\r\nexport default Place;\r\n","C:\\Users\\노트북펜\\Desktop\\2021winter\\search-page\\client\\src\\Components\\Paginations.js",[],{"ruleId":"44","replacedBy":"45"},{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","severity":1,"message":"49","line":1,"column":17,"nodeType":"50","messageId":"51","endLine":1,"endColumn":26},{"ruleId":"48","severity":1,"message":"52","line":2,"column":10,"nodeType":"50","messageId":"51","endLine":2,"endColumn":14},{"ruleId":"48","severity":1,"message":"53","line":4,"column":64,"nodeType":"50","messageId":"51","endLine":4,"endColumn":75},{"ruleId":"48","severity":1,"message":"54","line":5,"column":83,"nodeType":"50","messageId":"51","endLine":5,"endColumn":93},{"ruleId":"48","severity":1,"message":"55","line":15,"column":12,"nodeType":"50","messageId":"51","endLine":15,"endColumn":18},{"ruleId":"56","severity":1,"message":"57","line":51,"column":8,"nodeType":"58","endLine":51,"endColumn":10,"suggestions":"59"},{"ruleId":"60","severity":1,"message":"61","line":124,"column":35,"nodeType":"62","endLine":124,"endColumn":76},{"ruleId":"48","severity":1,"message":"63","line":3,"column":33,"nodeType":"50","messageId":"51","endLine":3,"endColumn":36},{"ruleId":"48","severity":1,"message":"64","line":3,"column":46,"nodeType":"50","messageId":"51","endLine":3,"endColumn":51},{"ruleId":"48","severity":1,"message":"65","line":3,"column":53,"nodeType":"50","messageId":"51","endLine":3,"endColumn":57},{"ruleId":"48","severity":1,"message":"66","line":3,"column":59,"nodeType":"50","messageId":"51","endLine":3,"endColumn":68},{"ruleId":"48","severity":1,"message":"67","line":3,"column":70,"nodeType":"50","messageId":"51","endLine":3,"endColumn":78},{"ruleId":"56","severity":1,"message":"68","line":20,"column":6,"nodeType":"58","endLine":20,"endColumn":8,"suggestions":"69"},"no-native-reassign",["70"],"no-negated-in-lhs",["71"],"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'Link' is defined but never used.","'FormControl' is defined but never used.","'Pagination' is defined but never used.","'mobile' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'getImg' and 'getPlace'. Either include them or remove the dependency array.","ArrayExpression",["72"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'Col' is defined but never used.","'Badge' is defined but never used.","'Card' is defined but never used.","'Accordion' is defined but never used.","'Carousel' is defined but never used.","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["73"],"no-global-assign","no-unsafe-negation",{"desc":"74","fix":"75"},{"desc":"76","fix":"77"},"Update the dependencies array to be: [getImg, getPlace]",{"range":"78","text":"79"},"Update the dependencies array to be: [getReview]",{"range":"80","text":"81"},[1683,1685],"[getImg, getPlace]",[560,562],"[getReview]"]
\ No newline at end of file \ No newline at end of file
...@@ -46,48 +46,6 @@ function Place(props) { ...@@ -46,48 +46,6 @@ function Place(props) {
})} })}
</Container> </Container>
{/* <Accordion defaultActiveKey="0">
<Accordion.Toggle as={Button} variant="link" eventKey="0">
<a className="mb-2">다음의 블로그 보기</a>
</Accordion.Toggle>
<Accordion.Collapse eventKey="0">
<Card.Body><div>주도 전역을 지배하는 한라산은 남한에서 가장 높은 산으로 높이는 1,947.3m이다. 한라산이라는 이름은 산이 높아 산정에 서면 은하수를 잡아당길 수 있다는 뜻이며, 부악·원산·선산·두무악·영주산·부라산·혈망봉·여장군 등으로도 불려왔다.</div></Card.Body>
</Accordion.Collapse>
<Row>
<Accordion.Toggle as={Button} variant="link" eventKey="1">
<a className="mb-2">네이버의 블로그 보기</a>
</Accordion.Toggle>
<Accordion.Collapse eventKey="1">
<Card.Body><div>한라산은 1966년 한라산 천연보호구역으로, 1970년 국립공원으로 지정되었다. 그리고 2002년에는 유네스코 생물권보전지역으로 지정되었으며 2007년에는 유네스코 세계자연유산으로 등재되었다. 2008년에는 물장오리오름 산정화구호 습지가 람사르 습지로 등록되어 보호 관리되고 있다</div></Card.Body>
</Accordion.Collapse>
</Row>
<Row>
<Accordion.Toggle as={Button} variant="link" eventKey="2">
<a className="mb-2">구글의 블로그 보기</a>
</Accordion.Toggle>
<Accordion.Collapse eventKey="2">
<Card.Body><div>한라산은 제주도에 있는 해발 1,947.06m, 면적 약 1,820km²의 화산으로, 제주도의 면적 대부분을 차지하고 있다. 정상에 백록담이라는 화산호가 있는데, 백록담이라는 이름은 흰 사슴이 물을 먹는 곳이라는 뜻에서 왔다고 전해진다.</div></Card.Body>
</Accordion.Collapse>
</Row>
</Accordion>
<Row style={{ color: 'white' }}>
<a href="https://www.daum.net/" className="mb-2">다음</a><a href="https://www.naver.com/" className="mb-2">네이버</a><a href="https://www.google.com/" className="mb-2">구글</a>
</Row>
// </Container>
<Carousel>
<Carousel.Item interval={1000}>
<h3>다음 블로그</h3>
<div>주도 전역을 지배하는 한라산은 남한에서 가장 높은 산으로 높이는 1,947.3m이다. 한라산이라는 이름은 산이 높아 산정에 서면 은하수를 잡아당길 수 있다는 뜻이며, 부악·원산·선산·두무악·영주산·부라산·혈망봉·여장군 등으로도 불려왔다.</div>
</Carousel.Item>
<Carousel.Item interval={1000}>
<h3>네이버 블로그</h3>
<div>한라산은 1966년 한라산 천연보호구역으로, 1970년 국립공원으로 지정되었다. 그리고 2002년에는 유네스코 생물권보전지역으로 지정되었으며 2007년에는 유네스코 세계자연유산으로 등재되었다. 2008년에는 물장오리오름 산정화구호 습지가 람사르 습지로 등록되어 보호 관리되고 있다</div>
</Carousel.Item>
<Carousel.Item interval={1000}>
<h3>구글 블로그</h3>
<div>한라산은 제주도에 있는 해발 1,947.06m, 면적 약 1,820km²의 화산으로, 제주도의 면적 대부분을 차지하고 있다. 정상에 백록담이라는 화산호가 있는데, 백록담이라는 이름은 흰 사슴이 물을 먹는 곳이라는 뜻에서 왔다고 전해진다.</div>
</Carousel.Item>
</Carousel> */}
</Modal.Body> </Modal.Body>
<Modal.Footer> <Modal.Footer>
<Button block onClick={props.onHide}>Close</Button> <Button block onClick={props.onHide}>Close</Button>
......
...@@ -13,7 +13,7 @@ function Search(props) { ...@@ -13,7 +13,7 @@ function Search(props) {
const [showSet, setShowSet] = useState([false, false, false, false]); const [showSet, setShowSet] = useState([false, false, false, false]);
const [search, setSearch] = useState(props.location.state.id); const [search, setSearch] = useState(props.location.state.id);
const [mobile, setMobile] = useState(); const [mobile, setMobile] = useState();
const [place, setPlace] = useState([{name:"", category:"", address:""}]) const [place, setPlace] = useState([{ name: "", category: "", address: "" }])
const [imgUrl, setImgUrl] = useState([]) const [imgUrl, setImgUrl] = useState([])
const getImg = () => { const getImg = () => {
...@@ -41,8 +41,8 @@ function Search(props) { ...@@ -41,8 +41,8 @@ function Search(props) {
useEffect(() => { useEffect(() => {
getImg()
getPlace() getPlace()
getImg()
if (window.innerWidth < 960) { if (window.innerWidth < 960) {
setMobile(true) setMobile(true)
} else { } else {
...@@ -58,24 +58,23 @@ function Search(props) { ...@@ -58,24 +58,23 @@ function Search(props) {
const places = [{ const places = [{
name: "한라산(hallasan)", name: "한라산(hallasan)",
address: "제주 서귀포시 토평동 산15-1", address: "제주 서귀포시 토평동 산15-1",
img: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOUAAADcCAMAAAC4YpZBAAAAkFBMVEX4ugAAAAD8vQD/vwD/wQAAAAP9vQD2uQCwhAO9jgVAMAbmrANTPwYQDAONaQDQmwN2WQG3iwMyJwZAMACofgMKCAZOOwTHlgGFYwfwtAKYcgYpHwHXoQXepgTorgTxtQJjSgCgeAUgGANwVAUZEwJeRgOKaAR8XQRbRAcnHgQ3KgZPOwGrgQJINQZrUQYeFwOi9fVkAAAIi0lEQVR4nO2b2XaCSBCG6WpaRFTcIoKAIuJu8v5vN72BoOiYnEzEM/XdJEBD+Omllq4YBoIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgvwpIXv0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4AgLw1XK61zlXKXtBoVKQwxjdk5CB0Buzg5mkrTHmlDQLVWewziOnRjUFjtXuZMq+Sqj1w6LcYEPVYIzE6sqm/cjEEP6QjMSPyWvQMFVyu0tkxUFAVxl8lgln4ORt+XLLxk51CZkO9NsX186ISjbSwlXKdWZBzLVIzYUM/VxX8oSHzOaMbI0uXMRy3lJG5MxuKuSr5s9telhcouwMB6ptJKtysLzJetsmkzXskM4m0V/rKeeuyohZGQr/s8SvJUoc65Vaeg1NiPZQu4edcmO0j5ZxfJoU/6vv1dyV6Vh9Qn5tEM3WZNRBA/7Uiw4Wy8MvUDuzDsHMpp4obthpN0M50essVWVc60SfG4F2WjFo2uRDaCsULlSKlNRN0E7cvXhVvfj0PnifoXw3V3u3H0dVkX92suxguO2Mqro5zH/RzxqL4+jTjaTmRLYHU/yp3tcqs8SHCf8cHCUxsLOxqPROBtKXwesGT8cL5thLAX0uhKNXsrMwLRCJ7+en4fqCX0aIA7DuIgwKXXCBpXn/xvfqVy7Crh/+U0QBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEEQBEGQ/yH/ALoViVlZW8doAAAAAElFTkSuQmCC", img: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg?size=200x200",
// img: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg?size=200x200", }, {
// }, { name: "성산일출봉(sungsan)",
// name: "성산일출봉(sungsan)", address: "제주 서귀포시 성산읍 성산리 1",
// address: "제주 서귀포시 성산읍 성산리 1", img: "https://www.jeju.go.kr/pub/site/geopark/images/sub/sub03/02%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84%EC%9D%B4%EC%95%BC%EA%B8%B0/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84_%EC%84%B1%EC%82%B0%EC%9D%BC%EC%B6%9C%EB%B4%89/1412402261.jpg?400/400",
// img: "https://www.jeju.go.kr/pub/site/geopark/images/sub/sub03/02%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84%EC%9D%B4%EC%95%BC%EA%B8%B0/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84/%EC%A7%80%EC%A7%88%EB%A7%88%EC%9D%84_%EC%84%B1%EC%82%B0%EC%9D%BC%EC%B6%9C%EB%B4%89/1412402261.jpg?400/400", }, {
// }, { name: "해녀의 집(haenyeo)",
// name: "해녀의 집(haenyeo)", address: "제주 서귀포시 성산읍 한도로 141-13지번오조리 3 오조해녀의집",
// address: "제주 서귀포시 성산읍 한도로 141-13지번오조리 3 오조해녀의집", img: "https://mblogthumb-phinf.pstatic.net/MjAxNjExMTdfMTc0/MDAxNDc5MzU3ODU0ODQy.KZYXCjzsXT3rCsE4HXBfxyCg2buvluBvN_7NxVp7BSwg.loJc89d8JjGXdNCn-4yMd7aMWPjfrZn21TI9Hyzemkog.JPEG.icocam11/20161010_100205.jpg?type=w800",
// img: "https://mblogthumb-phinf.pstatic.net/MjAxNjExMTdfMTc0/MDAxNDc5MzU3ODU0ODQy.KZYXCjzsXT3rCsE4HXBfxyCg2buvluBvN_7NxVp7BSwg.loJc89d8JjGXdNCn-4yMd7aMWPjfrZn21TI9Hyzemkog.JPEG.icocam11/20161010_100205.jpg?type=w800", }, {
// }, { name: "오설록 티 뮤지엄(osulloc)",
// name: "오설록 티 뮤지엄(osulloc)", address: "제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록",
// address: "제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록", img: "https://cdnweb01.wikitree.co.kr/webdata/editor/202007/01/img_20200701143323_2ced7627.webp",
// img: "https://cdnweb01.wikitree.co.kr/webdata/editor/202007/01/img_20200701143323_2ced7627.webp", }, {
// }, { name: "오설록 티 뮤지엄(osulloc)",
// name: "오설록 티 뮤지엄(osulloc)", address: "제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록",
// address: "제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록", img: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg",
// img: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg/269px-KOCIS_Halla_Mountain_in_Jeju-do_%286387785543%29.jpg",
}] }]
if (state !== false) { if (state !== false) {
...@@ -107,7 +106,17 @@ function Search(props) { ...@@ -107,7 +106,17 @@ function Search(props) {
return page return page
} }
const pagePlace = paginate(places, index, 1) const pagePlace = paginate(places, index, 2)
// function times (){
// let time = new Date()
// console.log(time)
// return time
// }
// console.log(times())
let time = new Date()
return ( return (
<Container > <Container >
...@@ -128,25 +137,28 @@ function Search(props) { ...@@ -128,25 +137,28 @@ function Search(props) {
</InputGroup> </InputGroup>
</Form> </Form>
</Row> </Row>
{time.toString()}****
{time.toLocaleString()}****
{time.toLocaleDateString()}****
{time.toLocaleTimeString()}****
<Col md={6} > <Col md={6} >
<Card align="center" border="info" style={{ margin: "3%" }}> <Card align="center" border="info" style={{ margin: "3%" }}>
<Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place[0].name}</Card.Title> <Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{place[0].name}</Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={imgUrl} /> <Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={imgUrl} />
<Card.Body > <Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} > <Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{place[0].address}{place[0].category} </Card.Text> {place[0].address}{place[0].category} </Card.Text>
<Button variant="primary" onClick={() => { <Button variant="primary" onClick={() => {
// const showArr = [false, false, false, false] // const showArr = [false, false, false, false]
// showArr[index] = true // showArr[index] = true
// setShowSet(showArr) // setShowSet(showArr)
}}>{place[0].name} 자세히 살펴보기</Button> }}>{place[0].name} 자세히 살펴보기</Button>
{/* <Place search={place} show={show} onHide={() => setShowSet([false, false, false, false])} /> */} {/* <Place search={place} show={show} onHide={() => setShowSet([false, false, false, false])} /> */}
</Card.Body> </Card.Body>
</Card> </Card>
</Col> </Col>
<Row className="d-flex flex-wrap"> <Row className="d-flex flex-wrap">
{pagePlace.map((place, index) => { {pagePlace.map((place, index) => {
return ( return (
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -2,14 +2,17 @@ import Places from '../models/Place.js' ...@@ -2,14 +2,17 @@ import Places from '../models/Place.js'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import fs from 'fs' import fs from 'fs'
import axios from 'axios'; import axios from 'axios';
import { time } from 'console';
const searchPlace = async (req, res) => { const searchPlace = async (req, res) => {
const url = "https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=" + encodeURI(req.params.search) const url = "https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=" + encodeURI(req.params.search)
const editUrl = /(http(s)?:\/\/)([a-z0-9\w]+\.*)+[a-z0-9]{2,4}/gi const editUrl = /(http(s)?:\/\/)([a-z0-9\w]+\.*)+[a-z0-9]{2,4}/gi
axios.get(url) axios.get(url)
.then( async (response) => { .then(async (response) => {
const html = response.data const html = response.data
// console.log(html)
fs.writeFileSync("googleReview", html, { encoding: 'utf-8' })
let $1 = cheerio.load(html); let $1 = cheerio.load(html);
let places = {} let places = {}
...@@ -19,7 +22,7 @@ const searchPlace = async (req, res) => { ...@@ -19,7 +22,7 @@ const searchPlace = async (req, res) => {
// console.log($1('.addr').text()) // console.log($1('.addr').text())
// console.log($1('.t?ime highlight').text()) // console.log($1('.t?ime highlight').text())
places[i] = { name: $1('.biz_name').text(), category: $1('.category').text(), address: $1('.addr').text() } places[i] = { name: $1('.biz_name').text(), category: $1('.category').text(), address: $1('.addr').text() }
}) })
// 값이 비어있거나 에러가 생겼을 때를 대비해 try catch를 해야함 // 값이 비어있거나 에러가 생겼을 때를 대비해 try catch를 해야함
...@@ -47,8 +50,20 @@ const searchImg = async (req, res) => { ...@@ -47,8 +50,20 @@ const searchImg = async (req, res) => {
// }) // })
// console.log('%%%%%%%%%%%%%%%%%%%%%%%%%%%', images) // console.log('%%%%%%%%%%%%%%%%%%%%%%%%%%%', images)
res.send(images) res.send(images)
const newPlaces = await new Places(name,images // 여기서 있는건 찾아와서 추가를 시켜야한다.
).save()
//사진만 업데이트
let Place = await Places.findOne({ name: req.params.search })
Place.times.push(new Date().toLocaleString())
await Places.updateOne({ name: req.params.search }, { img: images, times : Place.times })
await Places.createIndex({address : "text", name : "text"})
console.log("************************************************", await Places.find({$text:{$search:"\"경남\""}}))
// console.log(await Places.find())
const newPlaces = await new Places(
).save()
}) })
} }
......
import Review from '../models/Review.js'
import cheerio, { html } from "cheerio";
import jschardet from 'jschardet'
import iconv from 'iconv'
import fs from 'fs'
import axios from 'axios';
import { nextTick } from 'process';
const Iconv = iconv.Iconv
const search = async (req, res, next) => {
// const url = "https://www.google.com/search?q=" + encodeURI(req.params.search) + "+site%3Atistory.com&page_no=1"
const url = "https://www.google.com/search?q=" + encodeURI("한라산") + "+site%3Atistory.com&page_no=1"
let reviews = []
try {
axios.get(url)
// .then(anyToUtf8)
.then((html) => {
const $1 = cheerio.load(html.data);
$1('.kCrYT').each(function (i) {
const searchParams = new URLSearchParams($1(this).find('a').attr('href'));
const title = $1(this).find('h3').text()
const link = searchParams.get("/url?q")
const summary = $1(this).find('.s3v9rd').find('.s3v9rd').text()
const response = axios.get(link)
console.log(response)
// const $2 = cheerio.load(toString(response.data));
let content = "없음"
// if ($2('.tt_article_useless_p_margin').text()) {
// content = $2('.tt_article_useless_p_margin').text()
// }
if (title) {
reviews[i] = { title: title, link: link, content: content }
} else if (summary) {
reviews[i - 1] = { ...reviews[i - 1], summary: summary }
reviews = reviews.filter(e => e)
}
// reviews.forEach((review, i) => {
// axios.get(review.link)
// .then((html) => {
// const $2 = cheerio.load(html.data);
// let content = '없음'
// if ($2('.tt_article_useless_p_margin').text()) {
// content = $2('.tt_article_useless_p_margin').text()
// }
// // fs.writeFileSync(`tistory${i}.txt`, '\ufeff' + html.data, { encoding: 'utf8' });
// // console.log(`${i}번째, ${review.content}`)
// review["content"] = content
// // console.log(review)
// })
// })
// // const review = new Review(reviews).save()
})
res.send(reviews)
})
} catch (error) {
console.log(error)
res.status(500).send('리뷰 저장 에러')
}
}
const getReview = (link) => {
let content = '없음'
const res = axios.get(link)
console.log(res)
// const $2 = cheerio.load(res.data);
// if ($2('.tt_article_useless_p_margin').text()) {
// content = $2('.tt_article_useless_p_margin').text()
// }
console.log(content)
return content
}
export default { search, getReview }
\ No newline at end of file
import Review from '../models/Review.js'
import cheerio, { html } from "cheerio";
import jschardet from 'jschardet'
import iconv from 'iconv'
import fs from 'fs'
import axios from 'axios';
import { nextTick } from 'process';
import { response } from 'express';
const Iconv = iconv.Iconv
const search = async (req, res, next) => {
const url = "https://www.google.com/search?q=" + encodeURI(req.params.search) + "+site%3Atistory.com&page_no=1"
let reviews = []
try {
axios.get(url)
.then((response1) => {
const $1 = cheerio.load(response1.data);
$1('.kCrYT').each(function (i) {
const searchParams = new URLSearchParams($1(this).find('a').attr('href'));
const title = $1(this).find('h3').text()
const link = searchParams.get("/url?q")
const summary = $1(this).find('.s3v9rd').find('.s3v9rd').text()
if (title) {
reviews[i] = { title: title, link: link, }
} else if (summary) {
reviews[i - 1] = { ...reviews[i - 1], summary: summary }
reviews = reviews.filter(e => e)
}
// const review = new Review(reviews).save()
})
res.send(reviews)
})
} catch (error) {
// reviews.forEach((review) => {
// axios.get(review.link)
// .then((response2) => {
// const $2 = cheerio.load(response2.data);
// let content = ''
// if ($2('.tt_article_useless_p_margin').text()) {
// content = $2('.tt_article_useless_p_margin').text()
// }
// review = { content: content }
// console.log("dkssud")
// })
// console.log("dkssud")
// })
// console.log(content)
res.status(500).send(error)
}
}
const getReview = async (link) => {
let content = '없음'
const res = await axios.get(link)
const $2 = cheerio.load(res.data);
if ($2('.tt_article_useless_p_margin').text()) {
content = $2('.tt_article_useless_p_margin').text()
}
console.log(content, "getReiview")
return content
}
export default { search, getReview }
\ No newline at end of file
...@@ -7,11 +7,16 @@ import { nextTick } from 'process'; ...@@ -7,11 +7,16 @@ import { nextTick } from 'process';
// const Iconv = iconv.Iconv // const Iconv = iconv.Iconv
const search = async (req, res, next) => { const search = async (req, res, next) => {
//**************************구글 크롤링 할 때************************/
try { try {
let reviews = [] let reviews = []
let content = [] let content = []
const url = "https://www.google.com/search?q=" + encodeURI(req.params.search) + "+site%3Atistory.com&page_no=1" const url = "https://www.google.com/search?q=" + encodeURI(req.params.search) + "+site%3Atistory.com&page_no=1"
const response1 = await axios.get(url) const response1 = await axios.get(url)
fs.writeFileSync("googleSearch", response1.data, { encoding: 'utf-8' })
// console.log(response1.data) // console.log(response1.data)
const $1 = cheerio.load(response1.data); const $1 = cheerio.load(response1.data);
$1('.kCrYT').each(async function (i) { $1('.kCrYT').each(async function (i) {
...@@ -28,16 +33,36 @@ const search = async (req, res, next) => { ...@@ -28,16 +33,36 @@ const search = async (req, res, next) => {
} }
}) })
const promiseReview = await Promise.all(content) const promiseReview = await Promise.all(content)
reviews.forEach(async(review, i) => { reviews.forEach(async (review, i) => {
review["content"] = promiseReview[i] review["content"] = promiseReview[i]
}) })
res.send(reviews) res.send(reviews)
} catch (error) { } catch (error) {
console.log(error) // console.log(error)
res.send(error) res.send(error)
} }
} }
//***************네이버 크롤링 할 때 ********************* */
// try {
// let reviews = []
// let content = []
// const url = "https://search.naver.com/search.naver?where=view&sm=tab_jum&query=" + encodeURI('한라산')
// const response1 = await axios.get(url)
// // console.log(response1.data)
// const $1 = cheerio.load(response1.data);
// $1('._list').find('.total_wrap').each(async function (i) {
// reviews[i] = { name: $1(this).find('.total_tit').text(), summery: $1(this).find('.dsc_txt').text(), link: $1(this).find('.total_tit').attr('href') }
// })
// res.send(reviews)
// } catch (error) {
// console.log(error)
// res.send(error)
// }
// }
const getReview = async (link) => { const getReview = async (link) => {
let content = '없음' let content = '없음'
if (link) { if (link) {
...@@ -51,3 +76,4 @@ const getReview = async (link) => { ...@@ -51,3 +76,4 @@ const getReview = async (link) => {
} }
export default { search, getReview } export default { search, getReview }
// export default { search, }
...@@ -25,9 +25,13 @@ const PlaceSchema = new mongoose.Schema({ ...@@ -25,9 +25,13 @@ const PlaceSchema = new mongoose.Schema({
type: Array, type: Array,
required: true, required: true,
}, },
category:{ category: {
type:String, type: String,
} },
times: {
type: Array
},
}, { }, {
timestamps: true timestamps: true
}) })
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment