261028_01_ENH: 새로운 KART 연동

This commit is contained in:
2026-10-28 08:54:54 +09:00
parent cadf55e7ee
commit 998d04d39c
3 changed files with 68 additions and 85 deletions

View File

@@ -113,91 +113,29 @@ kon.prj = (function () {
return { "element": "button", "text": element.name, "attr": { "data-code": code, "onClick": element.fn,"class":element.class , "data_type":element.data_type, "style":element.style} }
})
}
/* 2023-02-01 서성완 Analysis 버튼에 Kart 연동 */
/* 2026-10-27 Analysis 버튼 → KART 사내 연동 API(URL Copy)로 변경 */
function fnAnalysis() { /* 프로젝트 기능 버튼 반환 함수 */
var isKiwi = "1"; //KIWI 프로젝트는 "1"
var reportToken = getReportToken();/////인증 - Report API로 부터 인증 키를 받아야만 다른 기능을 사용 가능
kon.prj.code = event.target.getAttribute("data-code");
var skey = getSkey(reportToken.Token, kon.prj.code, "1");
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_KIWI_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 fn_makeFrame() { /* 프로젝트 만든 프레임 틀에 넣는 함수 */