From 0d205ed65be693063224d44fba36e9fa68def3e6 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 23 Sep 2026 08:27:04 +0900 Subject: [PATCH] =?UTF-8?q?2609023=5F02=5FENH:=20=EC=BB=A8=ED=83=9D=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=EC=97=90=20=EC=BB=A8=ED=83=9D=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EC=8B=A4=ED=96=89=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=20prod,=20dev,=20local=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ajax_contact.asp | 22 ++++++++++++++++++---- module/survey.js | 29 +++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/include/ajax_contact.asp b/include/ajax_contact.asp index fd32a9e..08c7c2d 100644 --- a/include/ajax_contact.asp +++ b/include/ajax_contact.asp @@ -6,7 +6,8 @@ Dim CRUD : CRUD = Request("CRUD") Dim PKEY : PKEY = Request("PKEY") Dim PSIDX : PSIDX = Request("PSIDX") - Dim PSIDX_CHECK, PSIDX_DIGITS, PSIDX_LIMIT + Dim TARGET : TARGET = Request("TARGET") + Dim PSIDX_CHECK Const KON_CONTACT_API_KEY = "4B726963-436F6E74616374-53657276696365-402531213230" @@ -31,6 +32,15 @@ Response.End END IF + IF CRUD = "INSERT" OR CRUD = "DELETE" THEN + IF Len(TARGET) = 0 OR Len(TARGET) > 32 THEN + Response.Status = "400 Bad Request" + Response.ContentType = "application/json; charset=utf-8" + Response.Write "{""message"":""Invalid TARGET""}" + Response.End + END IF + END IF + IF CRUD = "INSERT" OR CRUD = "DELETE" THEN Set PSIDX_CHECK = Server.CreateObject("VBScript.RegExp") PSIDX_CHECK.Pattern = "^-?[0-9]{1,19}$" @@ -57,7 +67,7 @@ CASE "CONTACT_SURVEY" response.ContentType = "application/json" SQL = "" - SQL = SQL & " SELECT IDX, PKEY, PSIDX, REG_DT FROM KON_CONTACT_MAPPING WHERE PKEY = ? ORDER BY IDX " + SQL = SQL & " SELECT IDX, PKEY, PSIDX, TARGET_SYSTEM, REG_DT FROM KON_CONTACT_MAPPING WHERE PKEY = ? ORDER BY IDX " With ObjCmd .ActiveConnection = DBConn .CommandText = SQL @@ -82,15 +92,17 @@ SELECT CASE COMMAND CASE "CONTACT_SURVEY" SQL = "" - SQL = SQL & " INSERT INTO KON_CONTACT_MAPPING (PKEY, PSIDX) VALUES (?, CAST(? AS BIGINT)) " + SQL = SQL & " INSERT INTO KON_CONTACT_MAPPING (PKEY, PSIDX, TARGET_SYSTEM) VALUES (?, CAST(? AS BIGINT), ?) " With ObjCmd .ActiveConnection = DBConn .CommandText = SQL .CommandType = adCmdText .Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20) .Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20) + .Parameters.Append .CreateParameter("@TARGET", adVarChar, adParamInput, 32) .Parameters("@PKEY") = PKEY .Parameters("@PSIDX") = PSIDX + .Parameters("@TARGET") = TARGET .Execute , , adExecuteNoRecords End With END SELECT @@ -99,15 +111,17 @@ SELECT CASE COMMAND CASE "CONTACT_SURVEY" SQL = "" - SQL = SQL & " DELETE FROM KON_CONTACT_MAPPING WHERE PKEY = ? AND PSIDX = CAST(? AS BIGINT) " + SQL = SQL & " DELETE FROM KON_CONTACT_MAPPING WHERE PKEY = ? AND PSIDX = CAST(? AS BIGINT) AND TARGET_SYSTEM = ? " With ObjCmd .ActiveConnection = DBConn .CommandText = SQL .CommandType = adCmdText .Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20) .Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20) + .Parameters.Append .CreateParameter("@TARGET", adVarChar, adParamInput, 32) .Parameters("@PKEY") = PKEY .Parameters("@PSIDX") = PSIDX + .Parameters("@TARGET") = TARGET .Execute , , adExecuteNoRecords End With END SELECT diff --git a/module/survey.js b/module/survey.js index e459b11..80356af 100644 --- a/module/survey.js +++ b/module/survey.js @@ -156,12 +156,33 @@ kon.survey = (function () { }) } - function callContactStatusApi(contactMappingList, idkey, status){ - var contactBaseUrl = "https://contact.kric.com/api/external/"; - //contactBaseUrl = "http://localhost:4000/api/external/"; + function callContactStatusApi(contactMappingList, idkey, status) { + var contactRouteUrl = "/api/external/"; + contactMappingList.forEach(function (mapping) { + var targetSystem = String(mapping.TARGET_SYSTEM || "").toUpperCase(); + var contactBaseUrl; + + switch (targetSystem) { + case "PROD": + contactBaseUrl = "https://contact.kric.com"; + break; + + case "DEV": + contactBaseUrl = "https://test-contact.kric.com"; + break; + + case "LOCAL": + contactBaseUrl = "http://localhost:4000"; + break; + + default: + console.error("지원하지 않는 TARGET_SYSTEM:", mapping.TARGET_SYSTEM); + return; + } +console.log(contactBaseUrl, mapping) $.ajax({ - url: contactBaseUrl + status + url: contactBaseUrl + contactRouteUrl + status + "?psidx=" + encodeURIComponent(mapping.PSIDX) + "&sid=" + encodeURIComponent(idkey), type: "POST",