2609023_02_ENH: 컨택 연동에 컨택 서비스 실행환경을 추가 prod, dev, local 환경에 따라 분기 처리
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
Dim CRUD : CRUD = Request("CRUD")
|
Dim CRUD : CRUD = Request("CRUD")
|
||||||
Dim PKEY : PKEY = Request("PKEY")
|
Dim PKEY : PKEY = Request("PKEY")
|
||||||
Dim PSIDX : PSIDX = Request("PSIDX")
|
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"
|
Const KON_CONTACT_API_KEY = "4B726963-436F6E74616374-53657276696365-402531213230"
|
||||||
|
|
||||||
@@ -31,6 +32,15 @@
|
|||||||
Response.End
|
Response.End
|
||||||
END IF
|
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
|
IF CRUD = "INSERT" OR CRUD = "DELETE" THEN
|
||||||
Set PSIDX_CHECK = Server.CreateObject("VBScript.RegExp")
|
Set PSIDX_CHECK = Server.CreateObject("VBScript.RegExp")
|
||||||
PSIDX_CHECK.Pattern = "^-?[0-9]{1,19}$"
|
PSIDX_CHECK.Pattern = "^-?[0-9]{1,19}$"
|
||||||
@@ -57,7 +67,7 @@
|
|||||||
CASE "CONTACT_SURVEY"
|
CASE "CONTACT_SURVEY"
|
||||||
response.ContentType = "application/json"
|
response.ContentType = "application/json"
|
||||||
SQL = ""
|
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
|
With ObjCmd
|
||||||
.ActiveConnection = DBConn
|
.ActiveConnection = DBConn
|
||||||
.CommandText = SQL
|
.CommandText = SQL
|
||||||
@@ -82,15 +92,17 @@
|
|||||||
SELECT CASE COMMAND
|
SELECT CASE COMMAND
|
||||||
CASE "CONTACT_SURVEY"
|
CASE "CONTACT_SURVEY"
|
||||||
SQL = ""
|
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
|
With ObjCmd
|
||||||
.ActiveConnection = DBConn
|
.ActiveConnection = DBConn
|
||||||
.CommandText = SQL
|
.CommandText = SQL
|
||||||
.CommandType = adCmdText
|
.CommandType = adCmdText
|
||||||
.Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20)
|
.Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20)
|
||||||
.Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20)
|
.Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20)
|
||||||
|
.Parameters.Append .CreateParameter("@TARGET", adVarChar, adParamInput, 32)
|
||||||
.Parameters("@PKEY") = PKEY
|
.Parameters("@PKEY") = PKEY
|
||||||
.Parameters("@PSIDX") = PSIDX
|
.Parameters("@PSIDX") = PSIDX
|
||||||
|
.Parameters("@TARGET") = TARGET
|
||||||
.Execute , , adExecuteNoRecords
|
.Execute , , adExecuteNoRecords
|
||||||
End With
|
End With
|
||||||
END SELECT
|
END SELECT
|
||||||
@@ -99,15 +111,17 @@
|
|||||||
SELECT CASE COMMAND
|
SELECT CASE COMMAND
|
||||||
CASE "CONTACT_SURVEY"
|
CASE "CONTACT_SURVEY"
|
||||||
SQL = ""
|
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
|
With ObjCmd
|
||||||
.ActiveConnection = DBConn
|
.ActiveConnection = DBConn
|
||||||
.CommandText = SQL
|
.CommandText = SQL
|
||||||
.CommandType = adCmdText
|
.CommandType = adCmdText
|
||||||
.Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20)
|
.Parameters.Append .CreateParameter("@PKEY", adVarChar, adParamInput, 20)
|
||||||
.Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20)
|
.Parameters.Append .CreateParameter("@PSIDX", adVarChar, adParamInput, 20)
|
||||||
|
.Parameters.Append .CreateParameter("@TARGET", adVarChar, adParamInput, 32)
|
||||||
.Parameters("@PKEY") = PKEY
|
.Parameters("@PKEY") = PKEY
|
||||||
.Parameters("@PSIDX") = PSIDX
|
.Parameters("@PSIDX") = PSIDX
|
||||||
|
.Parameters("@TARGET") = TARGET
|
||||||
.Execute , , adExecuteNoRecords
|
.Execute , , adExecuteNoRecords
|
||||||
End With
|
End With
|
||||||
END SELECT
|
END SELECT
|
||||||
|
|||||||
@@ -157,11 +157,32 @@ kon.survey = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function callContactStatusApi(contactMappingList, idkey, status) {
|
function callContactStatusApi(contactMappingList, idkey, status) {
|
||||||
var contactBaseUrl = "https://contact.kric.com/api/external/";
|
var contactRouteUrl = "/api/external/";
|
||||||
//contactBaseUrl = "http://localhost:4000/api/external/";
|
|
||||||
contactMappingList.forEach(function (mapping) {
|
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({
|
$.ajax({
|
||||||
url: contactBaseUrl + status
|
url: contactBaseUrl + contactRouteUrl + status
|
||||||
+ "?psidx=" + encodeURIComponent(mapping.PSIDX)
|
+ "?psidx=" + encodeURIComponent(mapping.PSIDX)
|
||||||
+ "&sid=" + encodeURIComponent(idkey),
|
+ "&sid=" + encodeURIComponent(idkey),
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|||||||
Reference in New Issue
Block a user