261028_01_ENH: 새로운 KART 연동
This commit is contained in:
@@ -116,97 +116,35 @@ kon.prj = (function () {
|
||||
|
||||
/* 2022-05-03 서성완 make_button에서 style 사용하기 위해 style부분 추가 */
|
||||
function make_button(code) { /* 프로젝트 기능 버튼 반환 함수 */
|
||||
return project_function.map(function (element) {
|
||||
return { "element": "button", "text": element.name, "attr": { "data-code": code, "onClick": element.fn,"class":element.class , "data_type":element.data_type, "style":element.style} }
|
||||
})
|
||||
}
|
||||
/* 2022-05-04 서성완 Analysis 버튼에 report 연동 */
|
||||
/* 2023-02-01 서성완 Analysis 버튼에 Kart 연동 */
|
||||
return project_function.map(function (element) {
|
||||
return { "element": "button", "text": element.name, "attr": { "data-code": code, "onClick": element.fn,"class":element.class , "data_type":element.data_type, "style":element.style} }
|
||||
})
|
||||
}
|
||||
|
||||
/* 2026-10-27 Analysis 버튼 → KART 사내 연동 API(URL Copy)로 변경 */
|
||||
function fnAnalysis() { /* 프로젝트 기능 버튼 반환 함수 */
|
||||
var isKiwi = "0"; //KIWI 프로젝트는 "1"
|
||||
var reportToken = getReportToken();/////인증 - Report API로 부터 인증 키를 받아야만 다른 기능을 사용 가능
|
||||
kon.prj.code = event.target.getAttribute("data-code");
|
||||
var skey = getSkey(reportToken.Token, kon.prj.code, "0");
|
||||
var shortUrl = getShortUrl(reportToken.Token, skey);
|
||||
kon.prj.code = $(event.target).closest("[data-code]").attr("data-code");
|
||||
var win = window.open("about:blank", "_blank"); // 비동기 호출 전에 열어 팝업 차단 방지
|
||||
|
||||
window.open(shortUrl, '_blank');
|
||||
}
|
||||
|
||||
/* 2023-02-01 서성완 Kart 특졍값을 전송해 External Token 가져오는 함수 */
|
||||
function getReportToken(){
|
||||
var reportToken = "";
|
||||
$.ajax({
|
||||
url: 'https://rapi.kric.com/api/v1/encrypt/external',
|
||||
url: KART_BASE_URL + "/project/" + KART_PROJECT_TYPE + "/" + encodeURIComponent(kon.prj.code) + "/share",
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: JSON.stringify({ "external": "KON"}),
|
||||
data: JSON.stringify({ realUrl: "/Report/Current", mode: "U" }),
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function (data) {
|
||||
reportToken = JSON.parse(data);
|
||||
},
|
||||
error: function (x, h, r) {
|
||||
console.log(x);
|
||||
console.log(h);
|
||||
console.log(r);
|
||||
}
|
||||
});
|
||||
return reportToken;
|
||||
|
||||
}
|
||||
/* 2023-02-01 서성완 Kart Skey Token 가져오는 함수 */
|
||||
function getSkey(token,pkey,iskiwi){
|
||||
var skey = "";
|
||||
$.ajax({
|
||||
url: 'https://rapi.kric.com/api/v1/encrypt/pkey',
|
||||
type: "GET",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
cache: false,
|
||||
async: false,
|
||||
beforeSend : function(xhr){
|
||||
xhr.setRequestHeader("token", token);
|
||||
xhr.setRequestHeader("pkey",pkey);
|
||||
xhr.setRequestHeader("iskiwi",iskiwi);
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("X-API-Key", KON_API_KEY);
|
||||
},
|
||||
success: function (data) {
|
||||
skey = data;
|
||||
win.location.href = data.url;
|
||||
},
|
||||
error: function (x, h, r) {
|
||||
console.log(x);
|
||||
console.log(h);
|
||||
console.log(r);
|
||||
error: function (x) {
|
||||
win.close();
|
||||
alert((x.responseJSON && x.responseJSON.message) || "공유 링크 생성에 실패했습니다.");
|
||||
}
|
||||
});
|
||||
return skey;
|
||||
}
|
||||
|
||||
/* 2023-02-01 서성완 Kart ShortUrl로 변경하는 함수 */
|
||||
function getShortUrl(token, skey){
|
||||
$.ajax({
|
||||
url: 'https://rapi.kric.com/api/v1/uri/short',
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data:JSON.stringify({
|
||||
"realURI": "/Report/Current",
|
||||
"mode": "U"
|
||||
}),
|
||||
cache: false,
|
||||
async: false,
|
||||
beforeSend : function(xhr){
|
||||
xhr.setRequestHeader("token", token);
|
||||
xhr.setRequestHeader("skey",skey);
|
||||
},
|
||||
success: function (data) {
|
||||
shortUrl = data;
|
||||
},
|
||||
error: function (x, h, r) {
|
||||
console.log(x);
|
||||
console.log(h);
|
||||
console.log(r);
|
||||
}
|
||||
});
|
||||
return shortUrl;
|
||||
}
|
||||
|
||||
//function getResultData(token,pkey,iskiwi,indexParam, bannerParam, filterParam, optionParam){
|
||||
// var resultData = '';
|
||||
|
||||
Reference in New Issue
Block a user