테스트 페이지 완료

This commit is contained in:
hehihoho3@gmail.com 2025-09-29 18:31:08 +09:00
parent b3eb056fa8
commit 3867cc7590
14 changed files with 422 additions and 385 deletions

View File

@ -134,19 +134,19 @@
</div>
<div class="mem_cont_in">
<div class="input_list">
<!--
<div class="input_list">
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="24cb8ec4ed7c16969d2ab2988dd2406ee2820" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<div class="input_list_item">
<div class="input_left">*메시지ID

View File

@ -149,18 +149,18 @@
</div>
<div class="mem_cont_in">
<div class="input_list">
<!--
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="12e749877379aa7426275414050694b953" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<div class="input_list_item">
<div class="input_left">페이지번호
@ -174,7 +174,7 @@
</div>
<div class="input_list_item">
<div class="input_left">조회시작일자
<input type="text" class="list_inputType1" id="startDate" maxlength="100" value="" size="100"/>(기본값 오늘)ex)20230601
<input type="text" class="list_inputType1" id="startDate" maxlength="100" value="" size="100"/>(기본값 전체)ex)20230601
</div>
</div>
<div class="input_list_item">

View File

@ -24,12 +24,6 @@
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용해주세요
//실제서비스용
final String mberId = "dudgusw"; //문자온 로그인 아이디
final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api key
//테스트용
//String mberId = request.getParameter("p_mberId"); //문자온 로그인 아이디
//String apiKey = request.getParameter("p_apiKey"); //발급받은 api key
/******************** 전송요청 URL ********************/
@ -42,8 +36,8 @@
Map<String, String> params = new HashMap<String, String>();
/******************** 인증정보 ********************/
params.put("mberId", mberId); //문자온 로그인 아이디
params.put("accessKey", apiKey); //APIKEY
String p_mberId = request.getParameter("p_mberId"); //발신자 번호
String p_apiKey = request.getParameter("p_apiKey"); //수신자 번호
/******************** 전송정보 ********************/
//(선택)
@ -54,6 +48,8 @@
String p_testYn = request.getParameter("p_testYn"); //테스트데이터여부 '', 'YF', 'YS'
//추가 전송 데이터
params.put("mberId", p_mberId); //회원 아이디
params.put("accessKey", p_apiKey); //인증키
params.put("page" , p_page); //페이지번호
params.put("pageSize" , p_pageSize); //페이지당 출력갯수
params.put("startDate" , p_startDate); //시작일자

View File

@ -94,19 +94,20 @@
</div>
<div class="mem_cont_in">
<div class="input_list">
<!--
<div class="input_list">
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="24cb8ec4ed7c16969d2ab2988dd2406ee2820" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<!-- 채널ID 조회 설명 및 입력 영역 끝 -->
<div class="mem_btnWrap2">

View File

@ -20,10 +20,6 @@
final String encodingType = "UTF-8";
final String boundary = "____boundary____";
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용
//실제서비스용
final String mberId = "dudgusw"; //문자온 로그인 아이디
final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api key
//테스트용
//String mberId = request.getParameter("p_mberId"); //문자온 로그인 아이디
@ -32,11 +28,16 @@
/******************** 전송 요청 URL ********************/
final String apiUrl = "http://119.193.215.98:8087/api/kakao/inqry/chnlId"; //채널ID 조회 API URL
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용
String p_mberId = request.getParameter("p_mberId"); //발신자 번호
String p_apiKey = request.getParameter("p_apiKey"); //수신자 번호
Map<String, String> params = new HashMap<String, String>();
//기본 전송 데이터
params.put("mberId", mberId); //회원 아이디
params.put("accessKey", apiKey); //인증키
params.put("mberId", p_mberId); //회원 아이디
params.put("accessKey", p_apiKey); //인증키
//REST API 전송
String result = "";

View File

@ -82,19 +82,19 @@
</div>
<div class="mem_cont_in">
<div class="input_list">
<!--
<div class="input_list">
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="24cb8ec4ed7c16969d2ab2988dd2406ee2820" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<div class="mem_btnWrap2">
&nbsp;<button type="button" class="mem_btn3" style="width: 100%;" id="ajax_select_price" onclick="return false;">발송가능건수 요청</button>

View File

@ -24,8 +24,6 @@
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용해주세요
//실제서비스용
final String mberId = "dudgusw"; //문자온 로그인 아이디
final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api ke
//테스트용
@ -43,9 +41,14 @@
Map<String, String> params = new HashMap<String, String>();
String p_mberId = request.getParameter("p_mberId"); //발신자 번호
String p_apiKey = request.getParameter("p_apiKey"); //수신자 번호
/******************** 인증정보 ********************/
params.put("mberId", mberId); //문자온 로그인 아이디
params.put("accessKey", apiKey); //APIKEY
params.put("mberId", p_mberId); //문자온 로그인 아이디
params.put("accessKey", p_apiKey); //APIKEY
/******************** 전송정보 ********************/
String result = "";

View File

@ -2,155 +2,155 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>알림톡 발송(샘플-문자온)</title>
<script type="text/javascript" src="./jquery-3.5.0.js"></script>
<meta charset="UTF-8">
<title>알림톡 발송(샘플-문자온)</title>
<script type="text/javascript" src="./jquery-3.5.0.js"></script>
<script type="text/javascript">
<script type="text/javascript">
$(function(){
// ===== 전역 설정: multipart로 보낼지 여부 (기본: x-www-form-urlencoded) =====
var USE_MULTIPART = false; // 서버가 multipart/form-data만 받으면 true로 바꿔
// ===== 전역 설정: multipart로 보낼지 여부 (기본: x-www-form-urlencoded) =====
var USE_MULTIPART = false; // 서버가 multipart/form-data만 받으면 true로 바꿔
// ===== 클릭 바인딩 (중복 방지) =====
$("#ajax_send_at").off("click").on("click", function(){
// 결과 초기화
$("#msgGroupId,#resultCode,#resultMsg,#successCnt,#failCnt").text("");
// ===== 클릭 바인딩 (중복 방지) =====
$("#ajax_send_at").off("click").on("click", function(){
// 결과 초기화
$("#msgGroupId,#resultCode,#resultMsg,#successCnt,#failCnt").text("");
// 페이로드 생성
var payload = buildPayload();
console.log("[SEND PAYLOAD]", payload);
// 페이로드 생성
var payload = buildPayload();
console.log("[SEND PAYLOAD]", payload);
if (USE_MULTIPART){
// multipart/form-data
var fd = new FormData();
Object.keys(payload).forEach(function(k){ fd.append(k, payload[k]); });
if (USE_MULTIPART){
// multipart/form-data
var fd = new FormData();
Object.keys(payload).forEach(function(k){ fd.append(k, payload[k]); });
$.ajax({
url: "./jsp_example_send_at_r1.jsp",
type: "POST",
data: fd,
processData: false,
contentType: false,
dataType: "json",
success: handleSuccess,
error: handleError
});
} else {
// x-www-form-urlencoded
$.ajax({
url: "./jsp_example_send_at_r1.jsp",
type: "POST",
data: payload,
dataType: "json",
success: handleSuccess,
error: handleError
});
}
});
$.ajax({
url: "./jsp_example_send_at_r1.jsp",
type: "POST",
data: fd,
processData: false,
contentType: false,
dataType: "json",
success: handleSuccess,
error: handleError
});
} else {
// x-www-form-urlencoded
$.ajax({
url: "./jsp_example_send_at_r1.jsp",
type: "POST",
data: payload,
dataType: "json",
success: handleSuccess,
error: handleError
});
}
});
// ===== 수신자 추가 =====
$("#addReceiver").off("click").on("click", function(){
var nextId = $(".varItem").length + 1;
var tpl = ''
+ '<fieldset class="varItem" style="margin:8px 0;">'
+ ' <legend>수신자 ' + nextId + '</legend>'
+ ' <table border="1" cellspacing="0" cellpadding="6" style="width:100%;">'
+ ' <colgroup><col style="width:180px"><col></colgroup>'
+ ' <tbody>'
+ ' <tr><th align="left">수신자번호</th>'
+ ' <td><input type="text" class="list_inputType1 callTo" size="30" value=""/></td></tr>'
+ ' <tr><th align="left">알림톡 내용 </th>'
+ ' <td><textarea class="list_inputType1 msgTxt" rows="3" cols="80"></textarea></td></tr>'
+ ' <tr><th align="left">알림톡 제목 (선택)</th>'
+ ' <td><input type="text" class="list_inputType1 title" size="60" value=""/></td></tr>'
+ ' <tr><th align="left">대체문자 본문 (선택)</th>'
+ ' <td><input type="text" class="list_inputType1 altSms" size="80" value=""/></td></tr>'
+ ' </tbody>'
+ ' </table>'
+ ' <div style="margin-top:6px;"><button type="button" class="mem_btn3 removeReceiver">삭제</button></div>'
+ '</fieldset>';
$("#receiverList").append(tpl);
});
// ===== 수신자 추가 =====
$("#addReceiver").off("click").on("click", function(){
var nextId = $(".varItem").length + 1;
var tpl = ''
+ '<fieldset class="varItem" style="margin:8px 0;">'
+ ' <legend>수신자 ' + nextId + '</legend>'
+ ' <table border="1" cellspacing="0" cellpadding="6" style="width:100%;">'
+ ' <colgroup><col style="width:180px"><col></colgroup>'
+ ' <tbody>'
+ ' <tr><th align="left">수신자번호</th>'
+ ' <td><input type="text" class="list_inputType1 callTo" size="30" value=""/></td></tr>'
+ ' <tr><th align="left">알림톡 내용 </th>'
+ ' <td><textarea class="list_inputType1 msgTxt" rows="3" cols="80"></textarea></td></tr>'
+ ' <tr><th align="left">알림톡 제목 (선택)</th>'
+ ' <td><input type="text" class="list_inputType1 title" size="60" value=""/></td></tr>'
+ ' <tr><th align="left">대체문자 본문 (선택)</th>'
+ ' <td><input type="text" class="list_inputType1 altSms" size="80" value=""/></td></tr>'
+ ' </tbody>'
+ ' </table>'
+ ' <div style="margin-top:6px;"><button type="button" class="mem_btn3 removeReceiver">삭제</button></div>'
+ '</fieldset>';
$("#receiverList").append(tpl);
});
// ===== 수신자 삭제 (델리게이션) =====
$(document).on("click", ".removeReceiver", function(){
$(this).closest(".varItem").remove();
renumberReceivers();
});
// ===== 수신자 삭제 (델리게이션) =====
$(document).on("click", ".removeReceiver", function(){
$(this).closest(".varItem").remove();
renumberReceivers();
});
// ===== 페이로드 빌더 (Postman 스샷과 동일 키) =====
function buildPayload(){
var p = {
// 공통(단건) 필드
mberId : $("#mberId").val(), // 필요없으면 서버에서 무시
accessKey : $("#apiKey").val(), // accessKey = apiKey 인풋 재사용
senderKey : $("#senderKey").val(),
templateCode : $("#templateCode").val(),
subMsgSendYn : $("#subMsgSendYn").val(), // Y/N
callFrom : $("#callFrom").val()
// testYn 을 서버가 받는다면 여기에 testYn: $("#testYn").val() 추가
};
// ===== 페이로드 빌더 (Postman 스샷과 동일 키) =====
function buildPayload(){
var p = {
// 공통(단건) 필드
mberId : $("#mberId").val(), // 필요없으면 서버에서 무시
accessKey : $("#apiKey").val(), // accessKey = apiKey 인풋 재사용
senderKey : $("#senderKey").val(),
templateCode : $("#templateCode").val(),
subMsgSendYn : $("#subMsgSendYn").val(), // Y/N
callFrom : $("#callFrom").val()
// testYn 을 서버가 받는다면 여기에 testYn: $("#testYn").val() 추가
};
// 수신자별(N명) 필드
var idx = 1;
$(".varItem").each(function(){
var callTo = $(this).find(".callTo").val();
if (!callTo) return; // 번호 없으면 skip (인덱스 띄지 않도록 주의)
// 수신자별(N명) 필드
var idx = 1;
$(".varItem").each(function(){
var callTo = $(this).find(".callTo").val();
if (!callTo) return; // 번호 없으면 skip (인덱스 띄지 않도록 주의)
var title = $(this).find(".title").val();
var content = $(this).find(".msgTxt").val();
var altSms = $(this).find(".altSms").val(); // 없으면 빈값
var title = $(this).find(".title").val();
var content = $(this).find(".msgTxt").val();
var altSms = $(this).find(".altSms").val(); // 없으면 빈값
// 스샷 규칙과 동일한 키로 세팅
p["callTo_" + idx] = callTo;
if (title) p["templateTitle_" + idx] = title;
if (content) p["templateContent_" + idx] = content;
if (altSms) p["subMsgTxt_" + idx] = altSms;
// 스샷 규칙과 동일한 키로 세팅
p["callTo_" + idx] = callTo;
if (title) p["templateTitle_" + idx] = title;
if (content) p["templateContent_" + idx] = content;
if (altSms) p["subMsgTxt_" + idx] = altSms;
// 치환변수 (var1, var2 …)
$(this).find(".variable").each(function(){
var varName = $(this).data("var"); // 예: var1
var varValue = $(this).val();
if (varName && varValue){
p[varName + "_" + idx] = varValue; // 예: var1_1 = '홍길동'
}
});
// 치환변수 (var1, var2 …)
$(this).find(".variable").each(function(){
var varName = $(this).data("var"); // 예: var1
var varValue = $(this).val();
if (varName && varValue){
p[varName + "_" + idx] = varValue; // 예: var1_1 = '홍길동'
}
});
idx++;
});
idx++;
});
return p;
}
return p;
}
// ===== 성공/에러 공통 처리 =====
function handleSuccess(ret){
console.log("returnData :: ", ret);
if (ret && ret.data && ret.data.resultCode == "0"){
$("#msgGroupId").text(ret.data.msgGroupId || "");
$("#resultCode").text(ret.data.resultCode || "");
$("#resultMsg").text(ret.data.msg || "");
$("#successCnt").text(ret.data.successCnt || "");
$("#failCnt").text(ret.data.failCnt || "");
} else {
var rc = ret && ret.data ? ret.data.resultCode : "UNKNOWN";
var rm = ret && ret.data ? ret.data.msg : "오류";
$("#resultCode").text(rc);
$("#resultMsg").text(rm);
alert(rc + " : " + rm);
}
}
function handleError(req, status, err){
alert(req + "///" + err + "///" + status + "///AJAX_ERROR");
console.log("AJAX_ERROR", req, status, err);
}
// ===== 성공/에러 공통 처리 =====
function handleSuccess(ret){
console.log("returnData :: ", ret);
if (ret && ret.data && ret.data.resultCode == "0"){
$("#msgGroupId").text(ret.data.msgGroupId || "");
$("#resultCode").text(ret.data.resultCode || "");
$("#resultMsg").text(ret.data.msg || "");
$("#successCnt").text(ret.data.successCnt || "");
$("#failCnt").text(ret.data.failCnt || "");
} else {
var rc = ret && ret.data ? ret.data.resultCode : "UNKNOWN";
var rm = ret && ret.data ? ret.data.msg : "오류";
$("#resultCode").text(rc);
$("#resultMsg").text(rm);
alert(rc + " : " + rm);
}
}
function handleError(req, status, err){
alert(req + "///" + err + "///" + status + "///AJAX_ERROR");
console.log("AJAX_ERROR", req, status, err);
}
// ===== 가독성용: 수신자 번호 레전드 재정렬 =====
function renumberReceivers(){
$(".varItem").each(function(i){
$(this).find("legend").text("수신자 " + (i+1));
});
}
// ===== 가독성용: 수신자 번호 레전드 재정렬 =====
function renumberReceivers(){
$(".varItem").each(function(i){
$(this).find("legend").text("수신자 " + (i+1));
});
}
});
</script>
@ -159,125 +159,125 @@ $(function(){
<body>
<div class="inner">
<div class="send_top">
<div class="mypage_content current" id="tab5_3">
<div class="send_top">
<div class="mypage_content current" id="tab5_3">
<div class="heading">
<h2><a href="./jsp_example_start_form_r1.jsp">돌아가기</a></h2>
<h2>알림톡 발송(샘플-문자온)</h2>
*mberId와 accessKey값은 실제 서비스시에는 <b>jsp_example_send_at_r1.jsp</b> 파일에 작성하여 사용하세요.<br/>
(샘플 페이지에서는 원활한 테스트를 위해 파라미터 형식으로 제공합니다.)
<br/><br/>
</div>
<div class="heading">
<h2><a href="./jsp_example_start_form_r1.jsp">돌아가기</a></h2>
<h2>알림톡 발송(샘플-문자온)</h2>
*mberId와 accessKey값은 실제 서비스시에는 <b>jsp_example_send_at_r1.jsp</b> 파일에 작성하여 사용하세요.<br/>
(샘플 페이지에서는 원활한 테스트를 위해 파라미터 형식으로 제공합니다.)
<br/><br/>
</div>
<!-- 기본 설정 -->
<fieldset>
<legend>알림톡 기본 설정</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:260px"><col></colgroup>
<tbody>
<!-- 필요 시 주석 해제해서 사용
<tr>
<th align="left">*mberId</th>
<td><input type="text" class="list_inputType1" id="mberId" size="40" value="your_biz_id" /></td>
</tr>
<tr>
<th align="left">*api key</th>
<td><input type="text" class="list_inputType1" id="apiKey" size="60" value="your_api_key" /></td>
</tr>
-->
<tr>
<th align="left">*senderKey (카카오 알림톡 채널ID)</th>
<td><input type="text" class="list_inputType1" id="senderKey" size="60" value="your_sender_key" /></td>
</tr>
<tr>
<th align="left">*templateCode (카카오 알림톡 템플릿 코드)</th>
<td><input type="text" class="list_inputType1" id="templateCode" size="60" value="your_template_code" /></td>
</tr>
<tr>
<th align="left">callFrom (발신번호)</th>
<td><input type="text" class="list_inputType1" id="callFrom" size="30" value="01093414986" /></td>
</tr>
<tr>
<th align="left">subMsgSendYn (대체문자 전송 여부)</th>
<td>
<input type="text" class="list_inputType1" id="subMsgSendYn" size="5" value="Y" />
<span>(Y-전송, N-전송안함)</span>
</td>
</tr>
<tr>
<th align="left">테스트여부</th>
<td>
<input type="text" class="list_inputType1" id="testYn" size="6" />
<span>(기본값 없음, YF-테스트(실패), YS-테스트(성공))</span>
</td>
</tr>
</tbody>
</table>
</fieldset>
<!-- 기본 설정 -->
<fieldset>
<legend>알림톡 기본 설정</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:260px"><col></colgroup>
<tbody>
필요 시 주석 해제해서 사용
<tr>
<th align="left">*mberId</th>
<td><input type="text" class="list_inputType1" id="mberId" size="40" value="dudgusw" /></td>
</tr>
<tr>
<th align="left">*api key</th>
<td><input type="text" class="list_inputType1" id="apiKey" size="60" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" /></td>
</tr>
<tr>
<th align="left">*senderKey (카카오 알림톡 채널ID)</th>
<td><input type="text" class="list_inputType1" id="senderKey" size="60" value="669143473b1af459628b8bdf2f48da090c8895de" /></td>
</tr>
<tr>
<th align="left">*templateCode (카카오 알림톡 템플릿 코드)</th>
<td><input type="text" class="list_inputType1" id="templateCode" size="60" value="bizp_2025031410525347794704159" /></td>
</tr>
<tr>
<th align="left">callFrom (발신번호)</th>
<td><input type="text" class="list_inputType1" id="callFrom" size="30" value="010-9341-4986" /></td>
</tr>
<tr>
<th align="left">subMsgSendYn (대체문자 전송 여부)</th>
<td>
<input type="text" class="list_inputType1" id="subMsgSendYn" size="5" value="Y" />
<span>(Y-전송, N-전송안함)</span>
</td>
</tr>
<tr>
<th align="left">테스트여부</th>
<td>
<input type="text" class="list_inputType1" id="testYn" size="6" />
<span>(기본값 없음, YF-테스트(실패), YS-테스트(성공))</span>
</td>
</tr>
</tbody>
</table>
</fieldset>
<!-- 수신자 목록 -->
<fieldset style="margin-top:16px;">
<legend>수신자 목록</legend>
<!-- 수신자 목록 -->
<fieldset style="margin-top:16px;">
<legend>수신자 목록</legend>
<div style="margin:8px 0;">
<button type="button" class="mem_btn3" id="addReceiver">수신자 추가</button>
</div>
<div style="margin:8px 0;">
<button type="button" class="mem_btn3" id="addReceiver">수신자 추가</button>
</div>
<div id="receiverList">
<!-- 기본 수신자 1 -->
<fieldset class="varItem" style="margin:8px 0;">
<legend>수신자 1</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tbody>
<tr>
<th align="left">수신자번호</th>
<td><input type="text" class="list_inputType1 callTo" size="30" value="01000001111" /></td>
</tr>
<tr>
<th align="left">알림톡 내용</th>
<td><textarea class="list_inputType1 msgTxt" rows="3" cols="80">안녕하세요. 알림톡 테스트입니다.</textarea></td>
</tr>
<tr>
<th align="left">알림톡 제목 (선택)</th>
<td><input type="text" class="list_inputType1 title" size="60" value="테스트 제목" /></td>
</tr>
<tr>
<th align="left">대체문자 본문 (선택)</th>
<td><input type="text" class="list_inputType1 altSms" size="80" value=""></td>
</tr>
</tbody>
</table>
<div style="margin-top:6px;">
<button type="button" class="mem_btn3 removeReceiver">삭제</button>
</div>
</fieldset>
</div>
<div id="receiverList">
<!-- 기본 수신자 1 -->
<fieldset class="varItem" style="margin:8px 0;">
<legend>수신자 1</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tbody>
<tr>
<th align="left">수신자번호</th>
<td><input type="text" class="list_inputType1 callTo" size="30" value="01000001111" /></td>
</tr>
<tr>
<th align="left">알림톡 내용</th>
<td><textarea class="list_inputType1 msgTxt" rows="3" cols="80">테스트 홍길동\n타이틀 버튼 치환 테스트입니다.</textarea></td>
</tr>
<tr>
<th align="left">알림톡 제목 (선택)</th>
<td><input type="text" class="list_inputType1 title" size="60" value="테스트 홍길동111" /></td>
</tr>
<tr>
<th align="left">대체문자 본문 (선택)</th>
<td><input type="text" class="list_inputType1 altSms" size="80" value="대체문자 발송"></td>
</tr>
</tbody>
</table>
<div style="margin-top:6px;">
<button type="button" class="mem_btn3 removeReceiver">삭제</button>
</div>
</fieldset>
</div>
<div style="margin-top:16px;">
<button type="button" class="mem_btn3" style="width:100%;" id="ajax_send_at" onclick="return false;">알림톡 발송</button>
</div>
</fieldset>
<div style="margin-top:16px;">
<button type="button" class="mem_btn3" style="width:100%;" id="ajax_send_at" onclick="return false;">알림톡 발송</button>
</div>
</fieldset>
<!-- 결과 -->
<fieldset style="margin-top:16px;">
<legend>발송 결과</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tbody>
<tr><th align="left">메세지그룹ID</th><td><span id="msgGroupId"></span></td></tr>
<tr><th align="left">결과코드</th><td><span id="resultCode"></span></td></tr>
<tr><th align="left">결과메시지</th><td><span id="resultMsg"></span></td></tr>
<tr><th align="left">성공수량</th><td><span id="successCnt"></span></td></tr>
<tr><th align="left">실패수량</th><td><span id="failCnt"></span></td></tr>
</tbody>
</table>
</fieldset>
<!-- 결과 -->
<fieldset style="margin-top:16px;">
<legend>발송 결과</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tbody>
<tr><th align="left">메세지그룹ID</th><td><span id="msgGroupId"></span></td></tr>
<tr><th align="left">결과코드</th><td><span id="resultCode"></span></td></tr>
<tr><th align="left">결과메시지</th><td><span id="resultMsg"></span></td></tr>
<tr><th align="left">성공수량</th><td><span id="successCnt"></span></td></tr>
<tr><th align="left">실패수량</th><td><span id="failCnt"></span></td></tr>
</tbody>
</table>
</fieldset>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -15,13 +15,18 @@ response.setCharacterEncoding("UTF-8");
try {
// ===== 고정값(실서비스는 서버 보관) =====
final String MBER_ID = "dudgusw";
final String API_KEY = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91";
// ===== 전송 URL =====
// final String apiUrl = "http://119.193.215.98:8087/api/kakao/at/sendMsg";
final String apiUrl = "http://localhost:8088/api/kakao/at/sendMsg";
final String apiUrl = "http://119.193.215.98:8087/api/kakao/at/sendMsg";
String p_mberId = request.getParameter("mberId"); //사용자 ID
String p_apiKey = request.getParameter("accessKey"); //API KEY
System.out.println("p_mberId : "+ p_mberId);
System.out.println("p_apiKey : "+ p_apiKey);
// ===== 공통 파라미터 수신 (p_* / 비접두어 둘 다 허용) =====
String senderKey = request.getParameter("p_senderKey"); if (senderKey == null) senderKey = request.getParameter("senderKey");
String templateCode = request.getParameter("p_templateCode"); if (templateCode == null) templateCode = request.getParameter("templateCode");
@ -29,12 +34,14 @@ try {
String subMsgSendYn = request.getParameter("p_subMsgSendYn"); if (subMsgSendYn == null) subMsgSendYn = request.getParameter("subMsgSendYn");
String testYn = request.getParameter("p_testYn"); if (testYn == null) testYn = request.getParameter("testYn");
System.out.println("senderKey : "+ senderKey);
if (callFrom != null) callFrom = callFrom.replaceAll("\\D", ""); // 숫자만
// ===== form 구성 (x-www-form-urlencoded) =====
List<NameValuePair> form = new ArrayList<>();
form.add(new BasicNameValuePair("mberId", MBER_ID));
form.add(new BasicNameValuePair("accessKey", API_KEY));
form.add(new BasicNameValuePair("mberId", p_mberId));
form.add(new BasicNameValuePair("accessKey", p_apiKey));
form.add(new BasicNameValuePair("senderKey", senderKey != null ? senderKey : ""));
form.add(new BasicNameValuePair("templateCode", templateCode != null ? templateCode : ""));
form.add(new BasicNameValuePair("callFrom", callFrom != null ? callFrom : ""));

View File

@ -6,51 +6,72 @@
<title>친구톡(FT) 발송 샘플</title>
<script src="./jquery-3.5.0.js"></script>
</head>
<body>
<div class="inner">
<div class="send_top">
<div class="mypage_content current" id="tab5_3">
<div class="heading">
<h2><a href="./jsp_example_start_form_r1.jsp">돌아가기</a></h2>
<h2>친구톡 발송(샘플-문자온)</h2>
*mberId와 accessKey값은 실제 서비스시에는 <b>jsp_example_send_ft_r1.jsp</b> 파일에 작성하여 사용하세요.<br/>
(샘플 페이지에서는 원활한 테스트를 위해 파라미터 형식으로 제공합니다.)
<br/><br/>
</div>
<h2>친구톡(FT) 발송(샘플)</h2>
<form id="ftForm" method="post" action="./jsp_example_send_ft_r1.jsp" enctype="multipart/form-data">
<fieldset>
<legend>공통</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:220px"><col></colgroup>
<tr><th align="left">*senderKey</th><td><input type="text" name="senderKey" size="60" value=""/></td></tr>
<tr><th align="left">adFlag</th><td><input type="text" name="adFlag" size="4" value="N"/> (Y/N)</td></tr>
<tr><th align="left">subMsgSendYn</th><td><input type="text" name="subMsgSendYn" size="4" value="Y"/> (Y/N)</td></tr>
<tr><th align="left">callFrom</th><td><input type="text" name="callFrom" size="20" value="010-9341-4986"/></td></tr>
<tr><th align="left">button(JSON)</th><td>
<textarea name="button" rows="4" cols="80">{ "button": [ { "name":"사이트", "linkType":"WL", "linkMo":"https://m.example.com", "linkPc":"https://www.example.com" } ] }</textarea>
<div style="color:#666;">※ WL/AL만 가능</div>
</td></tr>
<tr><th align="left">templateImage</th><td><input type="file" name="templateImage" accept="image/*"/></td></tr>
<!-- 서버 경로로 보낼 때는 아래 사용(선택) -->
<!-- <tr><th align="left">templateImagePath</th><td><input type="text" name="templateImagePath" size="80" value="/path/to/image.jpg"/></td></tr> -->
<tr><th align="left">testYn</th><td><input type="text" name="testYn" size="6" value=""/> (YS-성공, YF-실패, 공란-실발송)</td></tr>
</table>
</fieldset>
<fieldset>
<legend>공통</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:220px"><col></colgroup>
<tr><th align="left">*mberId</th><td><input type="text" name="mberId" size="60" value="dudgusw"/></td></tr>
<tr><th align="left">*API_KEY</th><td><input type="text" name="API_KEY" size="60" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91"/></td></tr>
<tr><th align="left">*senderKey</th><td><input type="text" name="senderKey" size="60" value="669143473b1af459628b8bdf2f48da090c8895de"/></td></tr>
<tr><th align="left">adFlag</th><td><input type="text" name="adFlag" size="4" value="N"/> (Y/N)</td></tr>
<tr><th align="left">subMsgSendYn</th><td><input type="text" name="subMsgSendYn" size="4" value="Y"/> (Y/N)</td></tr>
<tr><th align="left">callFrom</th><td><input type="text" name="callFrom" size="20" value="010-9341-4986"/></td></tr>
<tr><th align="left">button(JSON)</th><td>
<textarea name="button" rows="4" cols="80">{ "button": [ { "name":"사이트", "linkType":"WL", "linkMo":"https://m.example.com", "linkPc":"https://www.example.com" } ] }</textarea>
<div style="color:#666;">※ WL/AL만 가능</div>
</td></tr>
<tr><th align="left">templateImage</th><td><input type="file" name="templateImage" accept="image/*"/></td></tr>
<!-- 서버 경로로 보낼 때는 아래 사용(선택) -->
<!-- <tr><th align="left">templateImagePath</th><td><input type="text" name="templateImagePath" size="80" value="/path/to/image.jpg"/></td></tr> -->
<tr><th align="left">testYn</th><td><input type="text" name="testYn" size="6" value=""/> (YS-성공, YF-실패, 공란-실발송)</td></tr>
</table>
</fieldset>
<fieldset style="margin-top:12px;">
<legend>수신자 목록</legend>
<div id="receiverList">
<fieldset class="rItem" style="margin:8px 0;">
<legend>수신자 1</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tr><th align="left">callTo_1</th><td><input type="text" name="callTo_1" size="30" value="01083584250"/></td></tr>
<tr><th align="left">templateContent_1</th><td><textarea name="templateContent_1" rows="3" cols="80">친구톡 본문 1</textarea></td></tr>
<tr><th align="left">subMsgTxt_1</th><td><input type="text" name="subMsgTxt_1" size="80" value="대체문자 발송1"/></td></tr>
</table>
<div style="margin-top:6px;"><button type="button" class="removeBtn">삭제</button></div>
</fieldset>
</div>
<div style="margin:8px 0;">
<button type="button" id="addReceiver">수신자 추가</button>
</div>
</fieldset>
<fieldset style="margin-top:12px;">
<legend>수신자 목록</legend>
<div id="receiverList">
<fieldset class="rItem" style="margin:8px 0;">
<legend>수신자 1</legend>
<table border="1" cellspacing="0" cellpadding="6" style="width:100%;">
<colgroup><col style="width:180px"><col></colgroup>
<tr><th align="left">callTo_1</th><td><input type="text" name="callTo_1" size="30" value="01083584250"/></td></tr>
<tr><th align="left">templateContent_1</th><td><textarea name="templateContent_1" rows="3" cols="80">친구톡 본문 1</textarea></td></tr>
<tr><th align="left">subMsgTxt_1</th><td><input type="text" name="subMsgTxt_1" size="80" value="대체문자 발송1"/></td></tr>
</table>
<div style="margin-top:6px;"><button type="button" class="removeBtn">삭제</button></div>
</fieldset>
</div>
<div style="margin:8px 0;">
<button type="button" id="addReceiver">수신자 추가</button>
</div>
</fieldset>
<div style="margin-top:12px;">
<button type="submit" id="sendBtn" style="width:100%;">친구톡 발송</button>
</div>
<div style="margin-top:12px;">
<button type="submit" id="sendBtn" style="width:100%;">친구톡 발송</button>
</div>
</form>
<hr/>
@ -59,49 +80,52 @@
<script>
$(function(){
// 수신자 추가
$("#addReceiver").on("click", function(){
var n = $(".rItem").length + 1;
var tpl = ''
+ '<fieldset class="rItem" style="margin:8px 0;">'
+ ' <legend>수신자 '+ n +'</legend>'
+ ' <table border="1" cellspacing="0" cellpadding="6" style="width:100%;">'
+ ' <colgroup><col style="width:180px"><col></colgroup>'
+ ' <tr><th align="left">callTo_'+n+'</th><td><input type="text" name="callTo_'+n+'" size="30" value=""/></td></tr>'
+ ' <tr><th align="left">templateContent_'+n+'</th><td><textarea name="templateContent_'+n+'" rows="3" cols="80"></textarea></td></tr>'
+ ' <tr><th align="left">subMsgTxt_'+n+'</th><td><input type="text" name="subMsgTxt_'+n+'" size="80" value=""/></td></tr>'
+ ' </table>'
+ ' <div style="margin-top:6px;"><button type="button" class="removeBtn">삭제</button></div>'
+ '</fieldset>';
$("#receiverList").append(tpl);
});
// 수신자 추가
$("#addReceiver").on("click", function(){
var n = $(".rItem").length + 1;
var tpl = ''
+ '<fieldset class="rItem" style="margin:8px 0;">'
+ ' <legend>수신자 '+ n +'</legend>'
+ ' <table border="1" cellspacing="0" cellpadding="6" style="width:100%;">'
+ ' <colgroup><col style="width:180px"><col></colgroup>'
+ ' <tr><th align="left">callTo_'+n+'</th><td><input type="text" name="callTo_'+n+'" size="30" value=""/></td></tr>'
+ ' <tr><th align="left">templateContent_'+n+'</th><td><textarea name="templateContent_'+n+'" rows="3" cols="80"></textarea></td></tr>'
+ ' <tr><th align="left">subMsgTxt_'+n+'</th><td><input type="text" name="subMsgTxt_'+n+'" size="80" value=""/></td></tr>'
+ ' </table>'
+ ' <div style="margin-top:6px;"><button type="button" class="removeBtn">삭제</button></div>'
+ '</fieldset>';
$("#receiverList").append(tpl);
});
// 수신자 삭제
$(document).on("click", ".removeBtn", function(){
$(this).closest(".rItem").remove();
$(".rItem").each(function(i){ $(this).find("legend").text("수신자 " + (i+1)); });
});
// 수신자 삭제
$(document).on("click", ".removeBtn", function(){
$(this).closest(".rItem").remove();
$(".rItem").each(function(i){ $(this).find("legend").text("수신자 " + (i+1)); });
});
// 폼 제출 AJAX (파일 포함)
$("#ftForm").on("submit", function(e){
e.preventDefault();
var fd = new FormData(this);
$.ajax({
url: $(this).attr("action"),
type: "POST",
data: fd,
processData: false,
contentType: false,
success: function(ret){
try { $("#resultBox").text(JSON.stringify(ret, null, 2)); }
catch(e) { $("#resultBox").text(ret); }
},
error: function(req, st, err){
$("#resultBox").text("ERROR: " + st + " / " + err);
}
});
});
// 폼 제출 AJAX (파일 포함)
$("#ftForm").on("submit", function(e){
e.preventDefault();
var fd = new FormData(this);
$.ajax({
url: $(this).attr("action"),
type: "POST",
data: fd,
processData: false,
contentType: false,
success: function(ret){
try { $("#resultBox").text(JSON.stringify(ret, null, 2)); }
catch(e) { $("#resultBox").text(ret); }
},
error: function(req, st, err){
$("#resultBox").text("ERROR: " + st + " / " + err);
}
});
});
});
</script>
</div>
</div>
</div>
</body>
</html>

View File

@ -79,18 +79,18 @@
</div>
<div class="mem_cont_in">
<div class="input_list">
<!--
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="24cb8ec4ed7c16969d2ab2988dd2406ee2820" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<!-- 발신자 번호 -->
<div class="input_list_item">

View File

@ -24,8 +24,8 @@
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용
//실제서비스용
final String mberId = "dudgusw"; //문자온 로그인 아이디
final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api ke
// final String mberId = "dudgusw"; //문자온 로그인 아이디
// final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api ke
//테스트용
@ -34,11 +34,14 @@
/******************** 전송 요청 URL ********************/
// final String apiUrl = "https://api.munjaon.co.kr/api/send/sendMsg"; //개발테스트용 URL
String apiUrl = "/api/send/sendMsg"; //개발테스트용 URL URL
// final String apiUrl = "http://119.193.215.98:8087/api/send/sendMsg"; //개발테스트용 URL
// String apiUrl = "/api/send/sendMsg"; //개발테스트용 URL URL
final String apiUrl = "http://119.193.215.98:8087/api/send/sendMsg"; //개발테스트용 URL
// final String apiUrl = "http://192.168.0.96:8088/api/send/sendMsg"; //개발테스트용 URL
/******************** 전송 정보 ********************/
//필수 값
String p_mberId = request.getParameter("p_mberId"); //발신자 번호
String p_apiKey = request.getParameter("p_apiKey"); //수신자 번호
String p_callFrom = request.getParameter("p_callFrom"); //발신자 번호
String p_callToList = request.getParameter("p_callToList"); //수신자 번호
String p_smsTxt = request.getParameter("p_smsTxt"); //문자 내용
@ -47,7 +50,7 @@
String p_nameStr = request.getParameter("p_nameStr"); //치환용 이름
String p_testYn = request.getParameter("p_testYn"); //테스트 데이터 여부 '', 'YF', 'YS'
String p_api_ip = request.getParameter("p_api_ip"); //테스트 데이터 여부 '', 'YF', 'YS'
apiUrl += p_api_ip;
// apiUrl += p_api_ip;
/* 추후 사용을 위하여 주석 상태로 보존 - 사용자 샘플 JSP에는 해당 내용 삭제 */
@ -75,8 +78,8 @@
Map<String, String> params = new HashMap<String, String>();
//필수 전송 데이터
params.put("mberId", mberId); //회원 아이디
params.put("accessKey", apiKey); //인증키
params.put("mberId", p_mberId); //회원 아이디
params.put("accessKey", p_apiKey); //인증키
params.put("callFrom" , p_callFrom); //발신자 번호
params.put("callToList" , p_callToList); //수신자 번호
params.put("smsTxt" , p_smsTxt); //문자 내용

View File

@ -97,7 +97,7 @@
<br/>
<!-- 문자발송 설명 및 입력 영역 시작 -->
<h2>대량문자발송(샘플-문자온)</h2>
*mberId와 accessKey값은 실제 서비스시에는 jsp_example_send_msg_r1.jsp 파일에 작성하여 사용하세요
*mberId와 accessKey값은 실제 서비스시에는 jsp_example_send_msgs_r1.jsp 파일에 작성하여 사용하세요
<br/>(샘플 페이지에서는 월활한 테스트를 위해 파라미터 형식으로 제공합니다.)
<br/><br/><br/>
@ -114,18 +114,18 @@
</div>
<div class="input_list">
<!--
<div class="input_list_item">
<div class="input_left">*mberId
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="goodgkdus" size="100"/>
<input type="text" class="list_inputType1" id="mberId" maxlength="100" value="dudgusw" size="100"/>
</div>
</div>
<div class="input_list_item">
<div class="input_left">*api key
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="24cb8ec4ed7c16969d2ab2988dd2406ee2820" size="100"/>
<input type="text" class="list_inputType1" id="apiKey" maxlength="100" value="3429312e6a2c732188d4cc7d15d8a1baa01d8d91" size="100"/>
</div>
</div>
-->
<!-- 발신자 번호 -->
<div class="input_list_item">

View File

@ -24,8 +24,8 @@
//회원아이디, APIKEY - 보안을 위해 실제 서비스 시에는 이곳에 mberId와 apiKey 값을 적어서 사용
//실제서비스용
final String mberId = "dudgusw"; //문자온 로그인 아이디
final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api ke
// final String mberId = "dudgusw"; //문자온 로그인 아이디
// final String apiKey = "3429312e6a2c732188d4cc7d15d8a1baa01d8d91"; //발급받은 api ke
//테스트용
@ -39,7 +39,9 @@
// final String apiUrl = "http://localhost:8088/api/send/sendMsgs"; //개발테스트용 URL
/******************** 전송 정보 ********************/
//필수 값’
//필수 값
String p_mberId = request.getParameter("p_mberId"); //발신자 번호
String p_apiKey = request.getParameter("p_apiKey"); //수신자 번호’
String p_callFrom = request.getParameter("p_callFrom"); //발신자 번호
String p_callTo_1 = request.getParameter("p_callTo_1"); //수신자 번호 1
String p_smsTxt_1 = request.getParameter("p_smsTxt_1"); //문자 내용 1
@ -73,8 +75,8 @@
Map<String, String> params = new HashMap<String, String>();
//필수 전송 데이터
params.put("mberId", mberId); //회원 아이디
params.put("accessKey", apiKey); //인증키
params.put("mberId", p_mberId); //회원 아이디
params.put("accessKey", p_apiKey); //인증키
params.put("callFrom" , p_callFrom); //발신번호
//선택 전송 데이터