Commit d64668dd authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

Merge remote-tracking branch 'origin/BAE' into cherry

parents 7f193b5a b11c4c5d
This diff is collapsed.
......@@ -7076,6 +7076,11 @@
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw=="
},
"icons": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/icons/-/icons-1.0.0.tgz",
"integrity": "sha512-7POum3AHKovjEEXg4ITL2opTzGjnN2UnUIhv5LsUX+SjKBsFMjRyANShrCubt0KQdNdcX2wAym+JXOt6LceuYA=="
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
......@@ -11222,6 +11227,14 @@
"warning": "^4.0.3"
}
},
"react-bootstrap-icons": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.3.0.tgz",
"integrity": "sha512-84ne6JNYd/aT4/lk9IT23YmPdat7RrBFuf1rSIdrufX5bAkVzDPqNUkLS1gZqylZIzjjKJvIevLHLGYaMCo7Ig==",
"requires": {
"prop-types": "^15.7.2"
}
},
"react-dev-utils": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.1.tgz",
......
......@@ -7,8 +7,10 @@
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"bootstrap": "^4.5.3",
"icons": "^1.0.0",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-bootstrap-icons": "^1.3.0",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
......@@ -38,5 +40,5 @@
"last 1 safari version"
]
},
"proxy":"http://localhost:3001"
"proxy": "http://localhost:3001"
}
......@@ -46,7 +46,7 @@ function Login() {
}
if (success) {
console.log('success', success)
alert("로그인되었습니다.")
return <Redirect to= '/'/> //성공하면 홈화면으로 간다
}
......
import React, { useState, useEffect } from 'react'
import { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar, Image } from "react-bootstrap"
import { Col, Card, Container, Row, Button, Nav, Navbar, Image } from "react-bootstrap"
import axios from "axios"
import ohuh from '../ohuh-sm.PNG';
import catchErrors from '../utils/catchErrors.js'
import { isAuthenticated } from '../utils/auth'
import * as Icon from 'react-bootstrap-icons';
import { Link, Redirect } from 'react-router-dom';
import { Link } from 'react-router-dom'
const INIT_PAGE = {
......@@ -104,7 +104,7 @@ function Bookmark() {
</Row>
</Container>
</Container >
)
}
......
/*global kakao*/
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Container, Row, Button, Image, } from 'react-bootstrap';
import { Container, Row, Image } from 'react-bootstrap';
import queryString from 'query-string'
import { Link } from 'react-bootstrap-icons';
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
import styled from 'styled-components';
const MapContents = styled.div`
width: 100%;
height: 100%;
`;
function Place(props) {
console.log(props)
......
import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom';
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button, Nav } from 'react-bootstrap';
import Paginations from '../Components/Paginations';
......@@ -17,7 +17,6 @@ function Search(props) {
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
const [bookmark, setBookmark] = useState([false, false, false, false])
const user = isAuthenticated()
const [mobile, setMobile] = useState();
const [association, setAssociation] = useState([{ name: " ", address: " ", img: " " }])
const [pagePlace, setPagePlace] = useState([{ name: " ", address: " ", img: " " }, { name: " ", address: " ", img: " " }])
const [endPage, setEndPage] = useState(1)
......@@ -56,9 +55,7 @@ function Search(props) {
else {
setPagePlace(paginate(association, index, 4))
}
console.log("뿌릴 data1", pagePlace)
setEndPage(Math.floor((association.length / 4)))
console.log("7489309484839", endPage)
}, [association, index])
......@@ -89,40 +86,6 @@ function Search(props) {
console.log(scrollHeight, scrollTop, clientHeight)
}
const places = [{
name: "한라산",
address: "제주 서귀포시 토평동 산15-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?size=200x200",
}, {
name: "성산일출봉(sungsan)",
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",
}, {
name: "해녀의 집(haenyeo)",
address: "제주 서귀포시 성산읍 한도로 141-13지번오조리 3 오조해녀의집",
img: "https://mblogthumb-phinf.pstatic.net/MjAxNjExMTdfMTc0/MDAxNDc5MzU3ODU0ODQy.KZYXCjzsXT3rCsE4HXBfxyCg2buvluBvN_7NxVp7BSwg.loJc89d8JjGXdNCn-4yMd7aMWPjfrZn21TI9Hyzemkog.JPEG.icocam11/20161010_100205.jpg?type=w800",
}, {
name: "오설록 티 뮤지엄(osulloc)",
address: "제주 서귀포시 안덕면 신화역사로 15 오설록지번서광리 1235-1 오설록",
img: "https://cdnweb01.wikitree.co.kr/webdata/editor/202007/01/img_20200701143323_2ced7627.webp",
}, {
name: "오설록 티 뮤지엄(osulloc)",
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",
}]
if (state !== false) {
// console.log(queryString.parse(props.location.search))
// = {keyword:search}
// return <Redirect to={{
// pathname: `/search?keyword=${search}`,
// state: { id: search },
// }} />;
// history.pushState(null, null, "?"+queryParams.toString());
// return <Redirect to={`/search?keyword=${search}`} />;
}
const handlePage = (num) => {
setIndex(num);
console.log("pagenation num", num)
......
......@@ -5,6 +5,7 @@ export function handleLogin(userId) { //로그인할때 로컬스토리지에
}
export async function handleLogout() {
alert("로그아웃되었습니다.")
localStorage.removeItem('loginStatus') //로컬스토리지에서 로그인상태를 지운다
await axios.get('/api/auth/logout')
window.location.href='/' //경로 지정
......
This diff is collapsed.
import Places from '../models/Place.js'
const searchRecommend = async (req, res, next,) => {
let responseRecommend = await Places.aggregate([
{
$project: {
name:1,
address:1,
img:1,
timeslength: { $cond: { if: { $isArray: "$times" }, then: { $size: "$times" }, else: 'NA' } }
}
}
])
let result = responseRecommend.sort((a, b) => {
return b.timeslength-a.timeslength
});
res.send(result[0])
}
const searchLatest = async (req, res, next) => {
let responseLatest = await Places.find({}).sort({ updatedAt: -1 })
res.send(responseLatest[0])
}
export default { searchRecommend, searchLatest }
import Places from '../models/Place.js'
import cheerio from 'cheerio'
import fs from 'fs'
import axios from 'axios';
import { nextTick } from 'process';
const searchPlace = async (req, res, next,) => {
let DuplicateCheckPlace = await Places.findOne({ name: req.query.keyword })
req.places = DuplicateCheckPlace
if (DuplicateCheckPlace) {
console.log("11111111111111111111111Place################ 기존플레이스줄력중")
}
else {
console.log("2222222222222222222222222222222222222222222222222222222")
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 { data: html } = await axios.get(url)
......@@ -25,14 +25,15 @@ const searchPlace = async (req, res, next,) => {
})
req.places = places
}
next()
}
const searchImg = async (req, res, next) => {
if (req.places.img !== "https://t1.daumcdn.net/thumb/R600x0/?fname=http%3A%2F%2Ft1.daumcdn.net%2Fqna%2Fimage%2F4b035cdf8372d67108f7e8d339660479dfb41bbd") {
console.log("333333333333333333333333333IMG@@@@@@@@@@@@@@@@@@@ 기존이미지줄력중")
req.places.times.push(new Date().toLocaleString())
const newPlaces = await new Places(req.places).save()
next()
......@@ -41,41 +42,33 @@ const searchImg = async (req, res, next) => {
axios.get(imgUrl)
.then(async (response) => {
console.log("4444444444444444444444444444444444444444444444444새로운 이미지 출력중")
const html = response.data
let name = req.query.keyword
let $1 = cheerio.load(html);
let images = $1('.RAyV4b').find('img').attr('src')
req.places.img = images
console.log("4141414141414141", req.places)
//사진만 업데이트
// let Place2 = await Places.findOne({ name: req.query.keyword })
req.places.times.push(new Date().toLocaleString())
// await Places.updateOne({ name: req.query.keyword }, { img: images, times: Place2.times })
// res.send(images)
const newPlaces = await new Places(req.places).save()
next()
})
} else {
console.log("이미지 생성 오류발생!!")
}
}
const searchAssociation = async (req, res) => {
let Place3 = req.places.address
if (!Place3) {
console.log("asdfasdfasdf222222222222222222dsaf2222222222214123q5", Place3)
res.send({ error: "Place.address is null" })
}
else {
let addresse = Place3.split(' ')[0]
let AssociationsId = []
let addressPlaces = new RegExp(`${addresse}`)
let responsePlaces = await Places.find({ address: addressPlaces }).sort({ updatedAt: -1 })
//몽구스나 몽고디비에 있는 sort 확인해보고 나열하기.
// console.log("$$$$$$$$$$$4", responsePlaces)
res.send(responsePlaces)
}
}
export default { searchImg, searchPlace, searchAssociation }
export default { searchImg, searchPlace, searchAssociation }
import express from 'express'
import app from '../controllers/app.controller.js'
const router = express.Router()
router.route('/api/app/recommend')
.get(app.searchRecommend)
router.route('/api/app/lastest')
.get(app.searchLatest)
export default router
\ No newline at end of file
......@@ -2,6 +2,7 @@ import express from 'express'
import connectDb from './utils/connectDb.js'
import placeRouter from './routes/place.routes.js'
import reviewRouter from './routes/review.routes.js'
import appRouter from './routes/app.router.js'
import userRouter from "./routes/user.routes.js"
import authRouter from "./routes/auth.routes.js"
......@@ -13,9 +14,16 @@ app.use(express.json())
app.use(placeRouter)
app.use(reviewRouter)
app.use(appRouter)
app.use(userRouter)
app.use(authRouter)
app.get('/', (req, res) => {
console.log("/ req.body", req.body)
res.json({ message: "http://localhost3001/ 에 연결됨" })
})
app.listen(3001, () => {
console.log('Listening on port 3001')
})
\ No newline at end of file
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