diff --git a/Base/Controller/FOCommon.cs b/Base/Controller/FOCommon.cs index 92a34ee..8ee9aae 100644 --- a/Base/Controller/FOCommon.cs +++ b/Base/Controller/FOCommon.cs @@ -498,8 +498,24 @@ namespace NP.Base.Controllers { try { - Dao.Save("users.snslink.up", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "snsid", snsid }, { "jointype", jointype }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); - return JsonBack(new JsonRtn() { code = 1 }); + if (string.IsNullOrEmpty(snsid) && jointype == 0) //SNS 연동을 해제 + { + Dao.Save("users.snslink.up", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "snsid", snsid }, { "jointype", jointype }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); + return JsonBack(new JsonRtn() { code = 1 }); + } + else //SNS 연동 + { + var result = Dao.Get("users.check.snsid", new Hashtable() { { "snsid", snsid }, { "jointype", jointype } }).Count(); + if (result > 0) //SNS 연동 중복체크 + { + return JsonBack(new JsonRtn() { code = -99 }); + } + else + { + Dao.Save("users.snslink.up", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "snsid", snsid }, { "jointype", jointype }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); + return JsonBack(new JsonRtn() { code = 1 }); + } + } } catch (Exception e) { diff --git a/FO/Views/Account/SNSLinkCallback.cshtml b/FO/Views/Account/SNSLinkCallback.cshtml index b534a09..6b717e0 100644 --- a/FO/Views/Account/SNSLinkCallback.cshtml +++ b/FO/Views/Account/SNSLinkCallback.cshtml @@ -92,6 +92,10 @@ alert("연동하였습니다."); goRefresh(); } + else if(capResult.code == -99){ + alert("이미 연동된 SNS 계정입니다. SNS 계정을 다시 확인해주세요."); + return; + } else { alert("SNS 연동에 실패하였습니다. \r\n관리자에게 문의하세요."); return;