Commit 2e335d43 authored by baesangjune's avatar baesangjune
Browse files

채린아 고마워

parent 6da882a6
[{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Place.js":"3","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js":"4","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js":"5"},{"size":1040,"mtime":1611254909400,"results":"6","hashOfConfig":"7"},{"size":375,"mtime":1611254909401,"results":"8","hashOfConfig":"7"},{"size":1551,"mtime":1611256661135,"results":"9","hashOfConfig":"7"},{"size":2199,"mtime":1611254909395,"results":"10","hashOfConfig":"7"},{"size":7426,"mtime":1611497108145,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"13y9yvi",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Place.js",["22"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js",["23","24","25","26","27"],{"ruleId":"28","severity":1,"message":"29","line":20,"column":6,"nodeType":"30","endLine":20,"endColumn":8,"suggestions":"31"},{"ruleId":"32","severity":1,"message":"33","line":15,"column":12,"nodeType":"34","messageId":"35","endLine":15,"endColumn":18},{"ruleId":"32","severity":1,"message":"36","line":16,"column":12,"nodeType":"34","messageId":"35","endLine":16,"endColumn":17},{"ruleId":"28","severity":1,"message":"37","line":65,"column":8,"nodeType":"30","endLine":65,"endColumn":10,"suggestions":"38"},{"ruleId":"32","severity":1,"message":"39","line":72,"column":11,"nodeType":"34","messageId":"35","endLine":72,"endColumn":17},{"ruleId":"40","severity":1,"message":"41","line":130,"column":35,"nodeType":"42","endLine":130,"endColumn":76},"react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.","ArrayExpression",["43"],"no-unused-vars","'mobile' is assigned a value but never used.","Identifier","unusedVar","'place' is assigned a value but never used.","React Hook useEffect has missing dependencies: 'getAssociation', 'getImg', and 'getPlace'. Either include them or remove the dependency array.",["44"],"'places' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute",{"desc":"45","fix":"46"},{"desc":"47","fix":"48"},"Update the dependencies array to be: [getReview]",{"range":"49","text":"50"},"Update the dependencies array to be: [getAssociation, getImg, getPlace]",{"range":"51","text":"52"},[571,573],"[getReview]",[2104,2106],"[getAssociation, getImg, getPlace]"] [{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Place.js":"3","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js":"4","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js":"5","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js":"6"},{"size":939,"mtime":1611497444385,"results":"7","hashOfConfig":"8"},{"size":375,"mtime":1611254909401,"results":"9","hashOfConfig":"8"},{"size":1650,"mtime":1611504929008,"results":"10","hashOfConfig":"8"},{"size":2199,"mtime":1611254909395,"results":"11","hashOfConfig":"8"},{"size":7660,"mtime":1611504775920,"results":"12","hashOfConfig":"8"},{"size":1474,"mtime":1611504101870,"results":"13","hashOfConfig":"8"},{"filePath":"14","messages":"15","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"16"},"13y9yvi",{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"19","messages":"20","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js",["27"],"import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport './index.css';\r\nimport 'bootstrap/dist/css/bootstrap.min.css';\r\nimport App from './Pages/App';\r\nimport Search from './Pages/Search';\r\nimport axios from 'axios';\r\nimport reportWebVitals from './reportWebVitals';\r\nimport {\r\n BrowserRouter as Router,\r\n Switch,\r\n Route,\r\n Redirect,\r\n} from \"react-router-dom\";\r\n\r\nReactDOM.render(\r\n <React.StrictMode>\r\n <Router>\r\n <Switch>\r\n <Route exact path=\"/\" component={App} />\r\n <Route path=\"/search\" component={Search} />\r\n <Redirect path=\"/search\" to=\"/search\" />\r\n </Switch>\r\n </Router>\r\n </React.StrictMode>,\r\n document.getElementById('root')\r\n);\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\nreportWebVitals();\r\n","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Place.js",["28","29"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js",["30","31","32","33","34"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js",[],{"ruleId":"35","severity":1,"message":"36","line":7,"column":8,"nodeType":"37","messageId":"38","endLine":7,"endColumn":13},{"ruleId":"35","severity":1,"message":"39","line":7,"column":14,"nodeType":"37","messageId":"38","endLine":7,"endColumn":19},{"ruleId":"40","severity":1,"message":"41","line":21,"column":6,"nodeType":"42","endLine":21,"endColumn":8,"suggestions":"43"},{"ruleId":"35","severity":1,"message":"44","line":16,"column":12,"nodeType":"37","messageId":"38","endLine":16,"endColumn":18},{"ruleId":"35","severity":1,"message":"45","line":17,"column":12,"nodeType":"37","messageId":"38","endLine":17,"endColumn":17},{"ruleId":"40","severity":1,"message":"46","line":68,"column":8,"nodeType":"42","endLine":68,"endColumn":10,"suggestions":"47"},{"ruleId":"35","severity":1,"message":"48","line":75,"column":11,"nodeType":"37","messageId":"38","endLine":75,"endColumn":17},{"ruleId":"49","severity":1,"message":"50","line":133,"column":35,"nodeType":"51","endLine":133,"endColumn":76},"no-unused-vars","'axios' is defined but never used.","Identifier","unusedVar","'setDb' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.","ArrayExpression",["52"],"'mobile' is assigned a value but never used.","'place' is assigned a value but never used.","React Hook useEffect has missing dependencies: 'getAssociation', 'getImg', and 'getPlace'. Either include them or remove the dependency array.",["53"],"'places' is assigned a value but never used.","react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute",{"desc":"54","fix":"55"},{"desc":"56","fix":"57"},"Update the dependencies array to be: [getReview]",{"range":"58","text":"59"},"Update the dependencies array to be: [getAssociation, getImg, getPlace]",{"range":"60","text":"61"},[605,607],"[getReview]",[2275,2277],"[getAssociation, getImg, getPlace]"]
\ No newline at end of file \ No newline at end of file
[0122/091810.668:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3) [0122/091810.668:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[0125/001732.960:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
...@@ -9288,6 +9288,22 @@ ...@@ -9288,6 +9288,22 @@
"prepend-http": "^1.0.0", "prepend-http": "^1.0.0",
"query-string": "^4.1.0", "query-string": "^4.1.0",
"sort-keys": "^1.0.0" "sort-keys": "^1.0.0"
},
"dependencies": {
"query-string": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
"requires": {
"object-assign": "^4.1.0",
"strict-uri-encode": "^1.0.0"
}
},
"strict-uri-encode": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
}
} }
}, },
"npm-run-path": { "npm-run-path": {
...@@ -11104,12 +11120,13 @@ ...@@ -11104,12 +11120,13 @@
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}, },
"query-string": { "query-string": {
"version": "4.3.4", "version": "6.13.8",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.8.tgz",
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", "integrity": "sha512-jxJzQI2edQPE/NPUOusNjO/ZOGqr1o2OBa/3M00fU76FsLXDVbJDv/p7ng5OdQyorKrkRz1oqfwmbe5MAMePQg==",
"requires": { "requires": {
"object-assign": "^4.1.0", "decode-uri-component": "^0.2.0",
"strict-uri-encode": "^1.0.0" "split-on-first": "^1.0.0",
"strict-uri-encode": "^2.0.0"
} }
}, },
"querystring": { "querystring": {
...@@ -12938,6 +12955,11 @@ ...@@ -12938,6 +12955,11 @@
"wbuf": "^1.7.3" "wbuf": "^1.7.3"
} }
}, },
"split-on-first": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz",
"integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw=="
},
"split-string": { "split-string": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
...@@ -13113,9 +13135,9 @@ ...@@ -13113,9 +13135,9 @@
"integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="
}, },
"strict-uri-encode": { "strict-uri-encode": {
"version": "1.1.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY="
}, },
"string-length": { "string-length": {
"version": "4.0.1", "version": "4.0.1",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
"query-string": "^6.13.8",
"react": "^17.0.1", "react": "^17.0.1",
"react-bootstrap": "^1.4.0", "react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
......
...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG'; import ohuh from '../ohuh-sm.PNG';
import Place from '../Components/Place'; import Place from '../Components/Place';
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button} from 'react-bootstrap'; import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button } from 'react-bootstrap';
import Paginations from '../Components/Paginations'; import Paginations from '../Components/Paginations';
import axios from 'axios'; import axios from 'axios';
import queryString from 'query-string' import queryString from 'query-string'
...@@ -17,6 +17,9 @@ function Search(props) { ...@@ -17,6 +17,9 @@ function Search(props) {
const [place, setPlace] = useState([{ name: "", category: "", address: "" }]) const [place, setPlace] = useState([{ name: "", category: "", address: "" }])
const [imgUrl, setImgUrl] = useState([]) const [imgUrl, setImgUrl] = useState([])
const [association, setAssociation] = useState([]) const [association, setAssociation] = useState([])
console.log("search###############", search)
const getImg = () => { const getImg = () => {
axios.get(`/api/search/imges?keyword=${search}`) axios.get(`/api/search/imges?keyword=${search}`)
.then(res => { .then(res => {
...@@ -39,7 +42,7 @@ function Search(props) { ...@@ -39,7 +42,7 @@ function Search(props) {
}) })
} }
const getAssociation =() => { const getAssociation = () => {
axios.get(`/api/search/association?keyword=${search}`) axios.get(`/api/search/association?keyword=${search}`)
.then(res => { .then(res => {
console.log("Associations = ", res.data) console.log("Associations = ", res.data)
...@@ -144,7 +147,7 @@ function Search(props) { ...@@ -144,7 +147,7 @@ function Search(props) {
</Form> </Form>
</Row> </Row>
<Image src = {imgUrl}/> <Image src={imgUrl} />
{time.toLocaleString()} {time.toLocaleString()}
<Row className="d-flex flex-wrap"> <Row className="d-flex flex-wrap">
...@@ -162,7 +165,8 @@ function Search(props) { ...@@ -162,7 +165,8 @@ function Search(props) {
showArr[index] = true showArr[index] = true
setShowSet(showArr) setShowSet(showArr)
}}>{place.name} 자세히 살펴보기</Button> }}>{place.name} 자세히 살펴보기</Button>
<Place search={place} index={index} show={showSet[index]} onHide={() => setShowSet([false, false, false, false])} /> {console.log("pppppppp",place)}
<Place place={place} index={index} show={showSet[index]} onHide={() => setShowSet([false, false, false, false])} />
</Card.Body> </Card.Body>
</Card> </Card>
</Col> </Col>
......
This diff is collapsed.
...@@ -5,15 +5,15 @@ import axios from 'axios'; ...@@ -5,15 +5,15 @@ import axios from 'axios';
const searchPlace = async (req, res) => { const searchPlace = async (req, res) => {
let DuplicateCheckPlace = await Places.findOne({ name: req.params.search }) let DuplicateCheckPlace = await Places.findOne({ name: req.query.keyword })
if (DuplicateCheckPlace) { if (DuplicateCheckPlace) {
res.send(DuplicateCheckPlace) res.send(DuplicateCheckPlace)
onsole.log("11111111111111111111111Place################ 기존플레이스줄력중") console.log("11111111111111111111111Place################ 기존플레이스줄력중")
} }
else { else {
console.log("2222222222222222222222222222222222222222222222222222222") console.log("2222222222222222222222222222222222222222222222222222222")
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.query.keyword)
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) => {
...@@ -35,29 +35,29 @@ const searchPlace = async (req, res) => { ...@@ -35,29 +35,29 @@ const searchPlace = async (req, res) => {
const searchImg = async (req, res) => { const searchImg = async (req, res) => {
let DuplicateCheckImg = await Places.findOne({ name: req.params.search }) let DuplicateCheckImg = await Places.findOne({ name: req.query.keyword })
if (DuplicateCheckImg.img !== "https://t1.daumcdn.net/thumb/R600x0/?fname=http%3A%2F%2Ft1.daumcdn.net%2Fqna%2Fimage%2F4b035cdf8372d67108f7e8d339660479dfb41bbd" ) { if (DuplicateCheckImg.img !== "https://t1.daumcdn.net/thumb/R600x0/?fname=http%3A%2F%2Ft1.daumcdn.net%2Fqna%2Fimage%2F4b035cdf8372d67108f7e8d339660479dfb41bbd") {
res.send(DuplicateCheckImg) res.send(DuplicateCheckImg)
console.log("333333333333333333333333333IMG@@@@@@@@@@@@@@@@@@@ 기존이미지줄력중") console.log("333333333333333333333333333IMG@@@@@@@@@@@@@@@@@@@ 기존이미지줄력중")
} }
else if (DuplicateCheckImg.img === "https://t1.daumcdn.net/thumb/R600x0/?fname=http%3A%2F%2Ft1.daumcdn.net%2Fqna%2Fimage%2F4b035cdf8372d67108f7e8d339660479dfb41bbd" ) { else if (DuplicateCheckImg.img === "https://t1.daumcdn.net/thumb/R600x0/?fname=http%3A%2F%2Ft1.daumcdn.net%2Fqna%2Fimage%2F4b035cdf8372d67108f7e8d339660479dfb41bbd") {
console.log("4444444444444444444444444444444444444444444444444") console.log("4444444444444444444444444444444444444444444444444")
const imgUrl = "https://www.google.com/search?q=" + encodeURI(req.params.search) + "+site:tistory.com/&sxsrf=ALeKk023Dv08KQDodRmpB5222lQuzw2Vaw:1610612821100&source=lnms&tbm=isch" const imgUrl = "https://www.google.com/search?q=" + encodeURI(req.query.keyword) + "+site:tistory.com/&sxsrf=ALeKk023Dv08KQDodRmpB5222lQuzw2Vaw:1610612821100&source=lnms&tbm=isch"
axios.get(imgUrl) axios.get(imgUrl)
.then(async (response) => { .then(async (response) => {
const html = response.data const html = response.data
let name = req.params.search let name = req.query.keyword
let $1 = cheerio.load(html); let $1 = cheerio.load(html);
let images = $1('.RAyV4b').find('img').attr('src') let images = $1('.RAyV4b').find('img').attr('src')
//사진만 업데이트 //사진만 업데이트
let Place = await Places.findOne({ name: req.params.search }) let Place = await Places.findOne({ name: req.query.keyword })
Place.times.push(new Date().toLocaleString()) Place.times.push(new Date().toLocaleString())
await Places.updateOne({ name: req.params.search }, { img: images, times: Place.times }) await Places.updateOne({ name: req.p }, { img: images, times: Place.times })
const newPlaces = await new Places( const newPlaces = await new Places(
).save() ).save()
...@@ -76,13 +76,12 @@ const searchImg = async (req, res) => { ...@@ -76,13 +76,12 @@ const searchImg = async (req, res) => {
const searchAssociation = async (req, res) => { const searchAssociation = async (req, res) => {
let Place = await Places.findOne({ name: req.query.keyword }) let Place = await Places.findOne({ name: req.query.keyword })
if (!Place) { // if (!Place) {
res.send([]) // res.send([])
} // }
let addresse = Place.address.split(' ')[0] let addresse = Place.address.split(' ')[0]
// let AssociationsId = [] let AssociationsId = []
let addressPlaces = new RegExp(`${addresse}`) let addressPlaces = new RegExp(`${addresse}`)
let responsePlaces = await Places.find({ address: addressPlaces }) let responsePlaces = await Places.find({ address: addressPlaces })
res.send(responsePlaces) res.send(responsePlaces)
......
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