Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장주현
/
Amazon_Shopping_Helper
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장주현
2020-06-24 23:35:16 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
54a2164222ed990acc00f221408f05ce34be3809
54a21642
1 parent
f6059932
예상 원화 가격 확인 기능 추가
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
182 additions
and
59 deletions
app.js
views/index.ejs
app.js
View file @
54a2164
...
...
@@ -26,7 +26,7 @@ var cityE, stateE, streetE;
app
.
get
(
'/'
,
function
(
req
,
res
){
//res.send('hello world');
res
.
render
(
'index'
);
res
.
render
(
'index'
);
});
...
...
@@ -39,66 +39,161 @@ var cityE, stateE, streetE;
//app.use('/', indexRoute);
app
.
post
(
'/'
,
async
function
(
req
,
res
){
console
.
log
(
req
.
body
);
zipcode
=
req
.
body
.
zipcode
;
addressK
=
req
.
body
.
addressK
;
addressE
=
req
.
body
.
addressE
;
detailaddressK
=
req
.
body
.
detailaddressK
;
extraaddressK
=
req
.
body
.
extraaddressK
;
extraaddressK
=
extraaddressK
.
replace
(
"("
,
""
);
extraaddressK
=
extraaddressK
.
replace
(
")"
,
""
);
console
.
log
(
extraaddressK
);
console
.
log
(
addressK
);
//trans(detailaddressK, detailaddressE);
//trans(extraaddressK, extraaddressE);
request
.
post
(
{
url
:
PAPAGO_URL
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'X-Naver-Client-Id'
:
`
${
PAPAGO_ID
}
`
,
'X-Naver-Client-Secret'
:
`
${
PAPAGO_SECRET
}
`
},
body
:
'source=ko&target=en&text='
+
detailaddressK
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
message
);
detailaddressE
=
body
.
message
.
result
.
translatedText
;
if
(
req
.
body
.
process
==
"주소 변환"
){
console
.
log
(
req
.
body
);
zipcode
=
req
.
body
.
zipcode
;
addressK
=
req
.
body
.
addressK
;
addressE
=
req
.
body
.
addressE
;
detailaddressK
=
req
.
body
.
detailaddressK
;
extraaddressK
=
req
.
body
.
extraaddressK
;
extraaddressK
=
extraaddressK
.
replace
(
"("
,
""
);
extraaddressK
=
extraaddressK
.
replace
(
")"
,
""
);
console
.
log
(
extraaddressK
);
console
.
log
(
addressK
);
//trans(detailaddressK, detailaddressE);
//trans(extraaddressK, extraaddressE);
request
.
post
(
{
url
:
PAPAGO_URL
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'X-Naver-Client-Id'
:
`
${
PAPAGO_ID
}
`
,
'X-Naver-Client-Secret'
:
`
${
PAPAGO_SECRET
}
`
},
body
:
'source=ko&target=en&text='
+
detailaddressK
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
message
);
detailaddressE
=
body
.
message
.
result
.
translatedText
;
}
});
request
.
post
(
{
url
:
PAPAGO_URL
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'X-Naver-Client-Id'
:
`
${
PAPAGO_ID
}
`
,
'X-Naver-Client-Secret'
:
`
${
PAPAGO_SECRET
}
`
},
body
:
'source=ko&target=en&text='
+
extraaddressK
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
message
);
extraaddressE
=
body
.
message
.
result
.
translatedText
;
}
});
setTimeout
(
function
(){
var
splitaddressE
=
addressE
.
split
(
", "
);
cityE
=
splitaddressE
[
4
];
stateE
=
splitaddressE
[
3
];
streetE
=
splitaddressE
[
0
]
+
", "
+
splitaddressE
[
1
]
+
", "
+
splitaddressE
[
2
];
},
300
);
setTimeout
(
function
(){
console
.
log
(
"set2: "
+
detailaddressE
)},
300
);
setTimeout
(
function
(){
console
.
log
(
"set2: "
+
extraaddressE
)},
300
);
//var splitaddressE = addressE.split(", ")
console
.
log
(
"address: "
+
addressE
);
if
(
req
.
body
.
os
==
"amazon"
){
res
.
render
(
'amazonaddr'
,
{
cityE
:
cityE
,
stateE
:
stateE
,
streetE
:
streetE
,
detailaddressE
:
detailaddressE
,
extraaddressE
:
extraaddressE
,
zipcode
:
zipcode
,
os
:
req
.
body
.
os
});
}
if
(
req
.
body
.
os
==
"ebay"
){
res
.
render
(
'ebayaddr'
,
{
cityE
:
cityE
,
stateE
:
stateE
,
streetE
:
streetE
,
detailaddressE
:
detailaddressE
,
extraaddressE
:
extraaddressE
,
zipcode
:
zipcode
,
os
:
req
.
body
.
os
});
}
}
else
if
(
req
.
body
.
process
==
"환율 계산"
){
var
card
=
req
.
body
.
card
;
var
credit
=
req
.
body
.
credit
;
var
brand
=
req
.
body
.
brand
;
var
moneyU
=
Number
(
req
.
body
.
moneyU
);
var
addmoneyU
=
0
;
var
addpersent
=
0
;
var
exchange
;
if
(
brand
==
"VISA"
){
addpersent
+=
0.011
;
}
else
if
(
brand
==
"MASTER"
){
addpersent
+=
0.01
;
}
else
if
(
brand
==
"American Express"
){
addpersent
+=
0.01
;
}
else
if
(
brand
==
"JCB"
){
}
else
if
(
brand
==
"UnionPay"
){
if
(
card
==
"KB국민카드"
){
addpersent
+=
0.008
;
}
});
request
.
post
(
{
url
:
PAPAGO_URL
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'X-Naver-Client-Id'
:
`
${
PAPAGO_ID
}
`
,
'X-Naver-Client-Secret'
:
`
${
PAPAGO_SECRET
}
`
},
body
:
'source=ko&target=en&text='
+
extraaddressK
,
json
:
true
},(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
message
);
extraaddressE
=
body
.
message
.
result
.
translatedText
;
}
if
(
card
==
"KB국민카드"
){
addpersent
+=
0.0025
;
}
else
if
(
card
==
"NH농협카드"
){
if
(
credit
==
"신용카드"
){
addpersent
+=
0.0025
;
}
else
if
(
credit
==
"체크카드"
){
addmoneyU
+=
0.5
;
}
});
}
else
if
(
card
==
"롯데카드"
){
addpersent
+=
0.002
;
}
else
if
(
card
==
"삼성카드"
){
addpersent
+=
0.002
;
}
else
if
(
card
==
"신한카드"
){
if
(
credit
==
"신용카드"
){
addpersent
+=
0.0018
;
}
else
if
(
credit
==
"체크카드"
){
addpersent
+=
0.002
;
}
}
else
if
(
card
==
"씨티카드"
){
addpersent
+=
0.0025
;
}
else
if
(
card
==
"우리카드"
){
if
(
credit
==
"신용카드"
){
addpersent
+=
0.003
;
}
else
if
(
credit
==
"체크카드"
){
addmoneyU
+=
0.5
;
}
}
else
if
(
card
==
"현대카드"
){
if
(
credit
==
"신용카드"
){
addpersent
+=
0.0018
;
}
else
if
(
credit
==
"체크카드"
){
}
}
else
if
(
card
==
"하나카드"
){
if
(
credit
==
"신용카드"
){
addpersent
+=
0.002
;
}
else
if
(
credit
==
"체크카드"
){
addmoneyU
+=
0.5
;
}
}
else
if
(
card
==
"BC카드"
){
}
request
({
encoding
:
"utf-8"
,
method
:
"GET"
,
uri
:
"https://api.exchangeratesapi.io/2020-06-10?base=USD&symbols=KRW"
},
function
(
err
,
res
,
html
){
exchange
=
Number
(
html
.
substring
(
16
,
23
));
})
setTimeout
(
function
(){
var
result
=
(
moneyU
+
addmoneyU
)
*
(
1
+
addpersent
)
*
exchange
;
console
.
log
(
result
);
res
.
send
(
"원화: "
+
result
+
"원"
);
},
300
);
setTimeout
(
function
(){
var
splitaddressE
=
addressE
.
split
(
", "
);
cityE
=
splitaddressE
[
4
];
stateE
=
splitaddressE
[
3
];
streetE
=
splitaddressE
[
0
]
+
", "
+
splitaddressE
[
1
]
+
", "
+
splitaddressE
[
2
];
},
300
);
setTimeout
(
function
(){
console
.
log
(
"set2: "
+
detailaddressE
)},
300
);
setTimeout
(
function
(){
console
.
log
(
"set2: "
+
extraaddressE
)},
300
);
//var splitaddressE = addressE.split(", ")
console
.
log
(
"address: "
+
addressE
);
if
(
req
.
body
.
os
==
"amazon"
){
res
.
render
(
'amazonaddr'
,
{
cityE
:
cityE
,
stateE
:
stateE
,
streetE
:
streetE
,
detailaddressE
:
detailaddressE
,
extraaddressE
:
extraaddressE
,
zipcode
:
zipcode
,
os
:
req
.
body
.
os
});
}
if
(
req
.
body
.
os
==
"ebay"
){
res
.
render
(
'ebayaddr'
,
{
cityE
:
cityE
,
stateE
:
stateE
,
streetE
:
streetE
,
detailaddressE
:
detailaddressE
,
extraaddressE
:
extraaddressE
,
zipcode
:
zipcode
,
os
:
req
.
body
.
os
});
}
});
...
...
views/index.ejs
View file @
54a2164
...
...
@@ -12,7 +12,35 @@
<p> 사용할 해외 쇼핑몰 선택 후 변환</p>
<input type="radio" name="os" value="amazon" checked="checked">Amazon
<input type="radio" name="os" value="ebay">Ebay
<input type="submit" value="주소 변환">
<input type="submit" name="process" value="주소 변환">
<br><br><br>
<p> 구매할 물품의 달러가격을 적은후 해당 조건에 맞게 설정후 검색</p>
<input type="text" name="moneyU" placeholder="물품 달러 가격">
<select name="card">
<option value="KB국민카드">KB국민카드</option>
<option value="NH농협카드">NH농협카드</option>
<option value="롯데카드">롯데카드</option>
<option value="삼성카드">삼성카드</option>
<option value="신한카드">신한카드</option>
<option value="씨티카드">씨티카드</option>
<option value="우리카드">우리카드</option>
<option value="현대카드">현대카드</option>
<option value="하나카드">하나카드</option>
<option value="BC카드">BC카드</option>
</select>
<select name="credit">
<option value="신용카드">신용카드</option>
<option value="체크카드">체크카드</option>
</select>
<select name="brand">
<option value="VISA">VISA</option>
<option value="MASTER">MASTER</option>
<option value="American Express">American Express</option>
<option value="JCB">JCB</option>
<option value="UnionPay">UnionPay</option>
</select>
<input type="submit" name="process" value="환율 계산">
</form>
<div id="wrap" style="display:none;border:1px solid;width:500px;height:300px;margin:5px 0;position:relative">
...
...
Please
register
or
login
to post a comment