diff --git a/Base/Controller/BaseController.cs b/Base/Controller/BaseController.cs index c953f66..28b8c62 100644 --- a/Base/Controller/BaseController.cs +++ b/Base/Controller/BaseController.cs @@ -44,6 +44,7 @@ namespace NP.Base ViewBag.SSUIP = GetUserIP(); ViewBag.SiteTitle = "영남건설기술교육원"; ViewBag.AssignLogo = string.Empty; + ViewBag.isPayTest = GetConfig("ispaytest"); var suiv = TopMenuNo == 1 ? SUI : SUIF; var suitv = TopMenuNo == 1 ? SUIT : SUIFT; //디버그로그 @@ -52,9 +53,14 @@ namespace NP.Base var rtn = System.Threading.Tasks.Task.Run(async () => Console.WriteLine(await Dao.Log( new NP.Model.PageLog() { uno = SUserInfo.UserNo, uip = GetUserIP(), logsite = 1, loginfo = Request.Url.ToString() + Request.Params.ToString() }))); } - if (filterContext.HttpContext.Request.Cookies[TopMenuNo == 1 ? SUI : SUIF] != null) + var newck = filterContext.HttpContext.Request.Cookies[suiv]; + if (TopMenuNo == 2 && newck == null) { - var sui = DecString(filterContext.HttpContext.Request.Cookies[suiv].Value).Split('$'); + newck = filterContext.HttpContext.Request.Cookies[SUIFCROOM]; + } + if (newck != null) + { + var sui = DecString(newck.Value).Split('$'); //var sui = DecString("kMA1yvFp2GPs5aP8fUuRwYCWEamo5aHhb1Mlg6m+T9ef07yi4y+7K11xRQqyQHgI/gjzLYLNrqEIGd1GYUIKjZp5iLFJY+jdFoO95T9LrVdk6reEo8Yz4aToiMV67F3citUUG+Kuw1aUngmft+OKZg==x").Split('$'); if (sui.Length > 8 && sui[0] == SUIDATE) { @@ -312,8 +318,13 @@ namespace NP.Base { Response.Cookies[suitv].Value = null; } + if (Request.Cookies[SUIFCROOM] != null) + { + Response.Cookies[SUIFCROOM].Value = null; + } Response.Cookies[suiv].Expires = DateTime.Now.AddDays(-1); Response.Cookies[suitv].Expires = DateTime.Now.AddDays(-1); + Response.Cookies[SUIFCROOM].Expires = DateTime.Now.AddDays(-1); } else { diff --git a/Base/Controller/BasePartialController.cs b/Base/Controller/BasePartialController.cs index d321a51..296be76 100644 --- a/Base/Controller/BasePartialController.cs +++ b/Base/Controller/BasePartialController.cs @@ -30,10 +30,11 @@ namespace NP.Base _sip = value; } } - public const String SUI = "KFCFSUI"; - public const String SUIT = "KFCFSUIT"; - public const String SUIF = "KFCFSUIF"; - public const String SUIFT = "KFCFSUIFT"; + public const String SUI = "NPTECHSUI"; + public const String SUIT = "NPTECHSUIT"; + public const String SUIF = "NPTECHSUIF"; + public const String SUIFCROOM = "NPTECHSUIFCROOM"; + public const String SUIFT = "NPTECHSUIFT"; private const String SUIDATE = "190517"; public NP.Model.SSUserInfo SUserInfo = new Model.SSUserInfo(); @@ -872,7 +873,7 @@ namespace NP.Base } protected void AuthCookie(bool isFront) { - Response.Cookies.Add(new System.Web.HttpCookie(isFront?SUIF:SUI + var c = new System.Web.HttpCookie(isFront ? SUIF : SUI , EncString(SUIDATE + "$" + SUserInfo.UserNo + "$" + SUserInfo.UserName.Replace("$", "") + "$" + SUserInfo.UserType + "$" + @@ -880,9 +881,29 @@ namespace NP.Base SUserInfo.UserInfo + "$" + SUserInfo.LoginKey + "$" + DateTime.Now.ToString("yyMMddHHmmss") + "$" + - SUserInfo.LoginIP))); - - Response.Cookies.Add(new System.Web.HttpCookie(TopMenuNo == 1 ? SUIT : SUIFT, EncString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")))); + SUserInfo.LoginIP) + ";SameSite=None; Secure"); + Response.Cookies.Add(c); + var c2 = new System.Web.HttpCookie(TopMenuNo == 1 ? SUIT : SUIFT, EncString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); + Response.Cookies.Add(c2); + if (isFront) + { + AuthCookieCroom(); + } + } + protected void AuthCookieCroom() + { + var c = new System.Web.HttpCookie(SUIFCROOM + , EncString(SUIDATE + "$" + SUserInfo.UserNo + "$" + + SUserInfo.UserName.Replace("$", "") + "$" + + SUserInfo.UserType + "$" + + SUserInfo.ASNo + "$" + + SUserInfo.UserInfo + "$" + + SUserInfo.LoginKey + "$" + + DateTime.Now.ToString("yyMMddHHmmss") + "$" + + SUserInfo.LoginIP)); + Response.Cookies.Add(c); + var c2 = new System.Web.HttpCookie(SUIFT, EncString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); + Response.Cookies.Add(c2); } protected bool IsEmail(string email) { diff --git a/Base/Controller/FCommonPay.cs b/Base/Controller/FCommonPay.cs index 0fab8f4..0096fa9 100644 --- a/Base/Controller/FCommonPay.cs +++ b/Base/Controller/FCommonPay.cs @@ -163,114 +163,49 @@ namespace NP.Base.Controllers [HttpPost] public JsonResult PayStart(VMPay vm) { + vm.PPLog = Dao.Get("pay.pplogs", new Hashtable() { { "pplno", vm.pplno }, { "userno", SUserInfo.UserNo } }).First(); vm.PayItems = new List() { }; foreach (var d in vm.items.Split(';')) { var dd = d.Split(':'); - vm.PayItems.Add(new PayItem() { ptype = GetInt(dd[0]), itemno = GetLong(dd[1]), pcnt = GetInt(dd[2]), userno = vm.isgroup == 0 || dd[0] == "2" ? SUserInfo.UserNo : GetInt(dd[3]), isrebate = GetInt(dd[4]), fgno = dd[5] == "0" ? (Int64?)null : GetLong(dd[5]) }); + vm.PayItems.Add(new PayItem() { ptype = GetInt(dd[0]), itemno = GetLong(dd[1]), pcnt = GetInt(dd[2]), userno = vm.isgroup == 0 || dd[0] == "2" ? SUserInfo.UserNo : GetInt(dd[3]), isrebate = GetInt(dd[4]), fgno = dd[5] == "0" ? (Int64?)null : GetLong(dd[5]), + rbank = vm.PPLog.rbankname, rbankaccnum = vm.PPLog.rbankacc, tbankuser = vm.PPLog.rbankowner }); } if (vm.isgroup == 1) { - //단체 검증 - //신청가능확인(기간,제한인원,동일강좌,유사강좌) - var lects = Dao.Get("pay.cmcheck.forgrouppay", new Hashtable() { { "cmno", vm.PayItems.Where(w => w.ptype == 0).First().itemno }, - {"usernos", "," + string.Join(",", vm.PayItems.Where(w=>w.ptype == 0).Select(s=>s.userno)) + "," },{ "userno", SUserInfo.UserNo} }); - if (lects.Count() < 1) - { - //수강신청기간이 아님 - return JsonBack(new JsonRtn() { code = 1000, msg = "수강신청기간이 아닙니다.", obj = 0 }); - } - else if(lects.First().quota !=0 && (vm.PayItems.Count() + lects.Where(w=>w.cmno == vm.PayItems.Where(s=>s.ptype==0).First().itemno ).Count()) > lects.First().quota) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "신청인원이 제한인원을 초과했습니다. [" + "제한인원 : "+ lects.First().quota + "명]", obj = 0 }); - } - else if (lects.Where(w => w.ispaied == 1).Count() > 0) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "이미 개별 신청한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.ispaied == 1).Select(s => s.username)) + "]", obj = 0 }); - } - else if (lects.First().quota != 0 && lects.Where(w => w.ispaied == 1).Count() + vm.PayItems.Where(w => w.ptype == 0).Count() >= lects.First().quota) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "제한인원을 초과한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.ispaied == 1).Select(s => s.username)) + "]", obj = 0 }); - } - foreach (var pi in vm.PayItems.Where(w => w.ptype == 0)) - { - pi.rstime = lects.Where(w => w.cmno == pi.itemno).First().rstime; - pi.retime = lects.Where(w => w.cmno == pi.itemno).First().retime; - pi.orgamt = lects.Where(w => w.cmno == pi.itemno).First().outfee; - pi.discamt = lects.Where(w => w.cmno == pi.itemno).First().outfee - lects.Where(w => w.cmno == pi.itemno).First().payamt; - pi.payamt = lects.Where(w => w.cmno == pi.itemno).First().payamt; - } + } else { - if (vm.ispaycert) + if (vm.PayItems.Where(w => w.ptype == 0).Count() > 0) { - //자격증강좌 - vm.PayItems = Dao.Get("pay.payitems.forcertpay", new System.Collections.Hashtable() { { "payno", vm.payno }, { "userno", SUserInfo.UserNo } }); //개별 검증 - //신청가능확인(기간,제한인원) - var lects = Dao.Get("pay.cmcheck.forpay", new Hashtable() { { "cmno", vm.PayItems.Where(w=>w.ptype == 4).First().itemno }, { "userno", SUserInfo.UserNo } }); + //신청가능확인(기간,제한인원,동일강좌,유사강좌) + var lects = Dao.Get("pay.cmcheck.forpay", new Hashtable() { { "cmnos", string.Join(",", vm.PayItems.Where(w => w.ptype == 0).Select(s => s.itemno)) }, { "userno", SUserInfo.UserNo } }); if (lects.Count() < 1) { //수강신청기간이 아님 return JsonBack(new JsonRtn() { code = 1000, msg = "수강신청기간이 아닙니다.", obj = 0 }); } - else if (lects.Where(w => w.status == 4).Count() != 1) + else if (lects.Where(w => w.status > 0).Count() > 0) { - return JsonBack(new JsonRtn() { code = 1000, msg = "결제가능한 상태가 아닙니다.", obj = 0 }); + return JsonBack(new JsonRtn() { code = 1000, msg = "이미 신청한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.status > 0).Select(s => s.cname)) + "]", obj = 0 }); } - else if (lects.Where(w => w.quota != 0 && (w.quota + 1) <= w.countlect).Count() > 0) + else if (lects.Where(w => w.quota != 0 && w.quota <= w.countlect).Count() > 0) { - return JsonBack(new JsonRtn() { code = 1000, msg = "제한인원을 초과한 강좌입니다.", obj = 0 }); + return JsonBack(new JsonRtn() { code = 1000, msg = "제한인원을 초과한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.quota != 0 && w.quota <= w.countlect).Select(s => s.cname)) + "]", obj = 0 }); } - else if (lects.Select(s => s.cmno).Count() != vm.PayItems.Where(w => w.ptype == 4).Count()) + else if (lects.Select(s => s.cmno).Count() != vm.PayItems.Where(w => w.ptype == 0).Count()) { return JsonBack(new JsonRtn() { code = 1000, msg = "구매상품이 올바르지 않습니다.", obj = 0 }); } - } - else if (vm.ispayexam) - { - vm.PayItems = Dao.Get("pay.payitems.forexampay", new System.Collections.Hashtable() { { "exno", vm.exno }, { "userno", SUserInfo.UserNo } }); - //개별 검증 - //신청가능확인(기간,제한인원) - if (vm.PayItems.Where(w=>w.rstime < DateTime.Now && w.retime > DateTime.Now).Count() != 1) + foreach (var pi in vm.PayItems.Where(w => w.ptype == 0)) { - //수강신청기간이 아님 - return JsonBack(new JsonRtn() { code = 1000, msg = "신청기간이 아닙니다.", obj = 0 }); - } - } - else - { - if (vm.PayItems.Where(w => w.ptype == 0).Count() > 0) - { - //개별 검증 - //신청가능확인(기간,제한인원,동일강좌,유사강좌) - var lects = Dao.Get("pay.cmcheck.forpay", new Hashtable() { { "cmnos", string.Join(",", vm.PayItems.Where(w => w.ptype == 0).Select(s => s.itemno)) }, { "userno", SUserInfo.UserNo } }); - if (lects.Count() < 1) - { - //수강신청기간이 아님 - return JsonBack(new JsonRtn() { code = 1000, msg = "수강신청기간이 아닙니다.", obj = 0 }); - } - else if (lects.Where(w => w.status > 0).Count() > 0) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "이미 신청한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.status > 0).Select(s => s.cname)) + "]", obj = 0 }); - } - else if (lects.Where(w => w.quota != 0 && w.quota <= w.countlect).Count() > 0) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "제한인원을 초과한 강좌입니다. [" + string.Join(", ", lects.Where(w => w.quota != 0 && w.quota <= w.countlect).Select(s => s.cname)) + "]", obj = 0 }); - } - else if (lects.Select(s => s.cmno).Count() != vm.PayItems.Where(w => w.ptype == 0).Count()) - { - return JsonBack(new JsonRtn() { code = 1000, msg = "구매상품이 올바르지 않습니다.", obj = 0 }); - } - foreach (var pi in vm.PayItems.Where(w => w.ptype == 0)) - { - pi.rstime = lects.Where(w => w.cmno == pi.itemno).First().rstime; - pi.retime = lects.Where(w => w.cmno == pi.itemno).First().retime; - pi.orgamt = lects.Where(w => w.cmno == pi.itemno).First().outfee; - pi.discamt = lects.Where(w => w.cmno == pi.itemno).First().outfee - lects.Where(w => w.cmno == pi.itemno).First().payamt; - pi.payamt = lects.Where(w => w.cmno == pi.itemno).First().payamt; - } + pi.rstime = lects.Where(w => w.cmno == pi.itemno).First().rstime; + pi.retime = lects.Where(w => w.cmno == pi.itemno).First().retime; + pi.orgamt = lects.Where(w => w.cmno == pi.itemno).First().infee; + pi.discamt = lects.Where(w => w.cmno == pi.itemno).First().infee - lects.Where(w => w.cmno == pi.itemno).First().payamt; + pi.payamt = lects.Where(w => w.cmno == pi.itemno).First().payamt; } } } @@ -292,86 +227,86 @@ namespace NP.Base.Controllers if (vm.ispaycert) { //자격증강좌 결제 시작 - vm.Pay = new Pay() - { - payno = vm.payno, - ptype = vm.ptype, - isdvr = vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? 1 : 0, - uno = SUserInfo.UserNo, - uip = GetUserIP(), - userno = SUserInfo.UserNo, - deliamt = vm.isdvr == 1 && vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? GetInt(GetConfig("deliveramt")) : 0 - }; - if (vm.Pay.ptype == 3) - { - //가상계좌 결제 시 ?일동안만 입금가능 / 수강신청중 빠른 것 - vm.Pay.paylimit = Convert.ToDateTime(DateTime.Now.AddDays(paylimitday).ToString("yyyy-MM-dd")).AddSeconds(-1); - //if (vm.PayItems.Where(w => w.ptype == 4).First().retime < vm.Pay.paylimit) - //{ - // vm.Pay.paylimit = Convert.ToDateTime(vm.PayItems.Where(w => w.ptype == 4).First().retime.Value.AddDays(1).ToString("yyyy-MM-dd")).AddSeconds(-1); - //} - vm.Pay.acceptmethod = "vbank(" + vm.Pay.paylimit.Value.ToString("yyyyMMddHHmm") + ")"; - } - if (Dao.Save("pay.paycert.paystart", vm.Pay) > 0) - { - vm.Pay.payamt = vm.PayItems.Sum(s => s.payamt2); - if (vm.Pay.isdvr == 1) - { - vm.Pay.payamt += GetInt(GetConfig("deliveramt")); - try - { - vm.PayDVR.payno = vm.Pay.payno; - vm.PayDVR.isdvr = vm.isdvr; - vm.PayDVR.uno = SUserInfo.UserNo; vm.PayDVR.uip = GetUserIP(); - Dao.Save("pay.paydvr.in", vm.PayDVR); - } - catch (Exception exx) { SetError("배송정보입력오류: " + vm.Pay.payno + ": " + exx.Message); } - } - var pginfos = GetConfig("pginfo").Split('|'); - string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; - vm.Pay.timestamp = timeTemp.Split('.')[0]; - System.Security.Cryptography.SHA256Managed sha256Managed = new System.Security.Cryptography.SHA256Managed(); - vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", pginfos[4] + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); - vm.Pay.oid2 = pginfos[4]; - return JsonBack(new JsonRtn() { code = 1000, obj = vm.Pay }); - } + //vm.Pay = new Pay() + //{ + // payno = vm.payno, + // ptype = vm.ptype, + // isdvr = vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? 1 : 0, + // uno = SUserInfo.UserNo, + // uip = GetUserIP(), + // userno = SUserInfo.UserNo, + // deliamt = vm.isdvr == 1 && vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? GetInt(GetConfig("deliveramt")) : 0 + //}; + //if (vm.Pay.ptype == 3) + //{ + // //가상계좌 결제 시 ?일동안만 입금가능 / 수강신청중 빠른 것 + // vm.Pay.paylimit = Convert.ToDateTime(DateTime.Now.AddDays(paylimitday).ToString("yyyy-MM-dd")).AddSeconds(-1); + // //if (vm.PayItems.Where(w => w.ptype == 4).First().retime < vm.Pay.paylimit) + // //{ + // // vm.Pay.paylimit = Convert.ToDateTime(vm.PayItems.Where(w => w.ptype == 4).First().retime.Value.AddDays(1).ToString("yyyy-MM-dd")).AddSeconds(-1); + // //} + // vm.Pay.acceptmethod = "vbank(" + vm.Pay.paylimit.Value.ToString("yyyyMMddHHmm") + ")"; + //} + //if (Dao.Save("pay.paycert.paystart", vm.Pay) > 0) + //{ + // vm.Pay.payamt = vm.PayItems.Sum(s => s.payamt2); + // if (vm.Pay.isdvr == 1) + // { + // vm.Pay.payamt += GetInt(GetConfig("deliveramt")); + // try + // { + // vm.PayDVR.payno = vm.Pay.payno; + // vm.PayDVR.isdvr = vm.isdvr; + // vm.PayDVR.uno = SUserInfo.UserNo; vm.PayDVR.uip = GetUserIP(); + // Dao.Save("pay.paydvr.in", vm.PayDVR); + // } + // catch (Exception exx) { SetError("배송정보입력오류: " + vm.Pay.payno + ": " + exx.Message); } + // } + // var pginfos = GetConfig("pginfo").Split('|'); + // string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; + // vm.Pay.timestamp = timeTemp.Split('.')[0]; + // System.Security.Cryptography.SHA256Managed sha256Managed = new System.Security.Cryptography.SHA256Managed(); + // vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", pginfos[4] + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); + // vm.Pay.oid2 = pginfos[4]; + // return JsonBack(new JsonRtn() { code = 1000, obj = vm.Pay }); + //} } else if (vm.ispayexam) { //자격증시험 결제 진행 - vm.Pay = new Pay() - { - ptype = vm.ptype, - isexam = 1, - uno = SUserInfo.UserNo, - uip = GetUserIP(), - ispg = 1, - userno = SUserInfo.UserNo, - orgamt = vm.PayItems.Sum(s => s.orgamt), - discamt = vm.PayItems.Sum(s => s.discamt), - payamt = vm.PayItems.Sum(s => s.payamt), - PIs = vm.PayItems - }; - if (vm.Pay.ptype == 3) - { - //가상계좌 결제 시 ?일동안만 입금가능 / 수강신청중 빠른 것 - vm.Pay.paylimit = Convert.ToDateTime(DateTime.Now.AddDays(paylimitday).ToString("yyyy-MM-dd")).AddSeconds(-1); - //if (vm.PayItems.Where(w => w.retime != null && w.retime < vm.Pay.paylimit).Count() > 0) - //{ - // vm.Pay.paylimit = Convert.ToDateTime(vm.PayItems.Where(w => w.retime != null && w.retime < vm.Pay.paylimit).Min(m => m.retime).Value.AddDays(1).ToString("yyyy-MM-dd")).AddSeconds(-1); - //} - vm.Pay.acceptmethod = "vbank(" + vm.Pay.paylimit.Value.ToString("yyyyMMddHHmm") + ")"; - } - if (Dao.PayIn(vm.Pay) > 0) - { - var pginfos = GetConfig("pginfo").Split('|'); - string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; - vm.Pay.timestamp = timeTemp.Split('.')[0]; - System.Security.Cryptography.SHA256Managed sha256Managed = new System.Security.Cryptography.SHA256Managed(); - vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", pginfos[4] + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); - vm.Pay.oid2 = pginfos[4]; - return JsonBack(new JsonRtn() { code = 1000, obj = vm.Pay }); - } + //vm.Pay = new Pay() + //{ + // ptype = vm.ptype, + // isexam = 1, + // uno = SUserInfo.UserNo, + // uip = GetUserIP(), + // ispg = 1, + // userno = SUserInfo.UserNo, + // orgamt = vm.PayItems.Sum(s => s.orgamt), + // discamt = vm.PayItems.Sum(s => s.discamt), + // payamt = vm.PayItems.Sum(s => s.payamt), + // PIs = vm.PayItems + //}; + //if (vm.Pay.ptype == 3) + //{ + // //가상계좌 결제 시 ?일동안만 입금가능 / 수강신청중 빠른 것 + // vm.Pay.paylimit = Convert.ToDateTime(DateTime.Now.AddDays(paylimitday).ToString("yyyy-MM-dd")).AddSeconds(-1); + // //if (vm.PayItems.Where(w => w.retime != null && w.retime < vm.Pay.paylimit).Count() > 0) + // //{ + // // vm.Pay.paylimit = Convert.ToDateTime(vm.PayItems.Where(w => w.retime != null && w.retime < vm.Pay.paylimit).Min(m => m.retime).Value.AddDays(1).ToString("yyyy-MM-dd")).AddSeconds(-1); + // //} + // vm.Pay.acceptmethod = "vbank(" + vm.Pay.paylimit.Value.ToString("yyyyMMddHHmm") + ")"; + //} + //if (Dao.PayIn(vm.Pay) > 0) + //{ + // var pginfos = GetConfig("pginfo").Split('|'); + // string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; + // vm.Pay.timestamp = timeTemp.Split('.')[0]; + // System.Security.Cryptography.SHA256Managed sha256Managed = new System.Security.Cryptography.SHA256Managed(); + // vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", pginfos[4] + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); + // vm.Pay.oid2 = pginfos[4]; + // return JsonBack(new JsonRtn() { code = 1000, obj = vm.Pay }); + //} } else { @@ -382,19 +317,22 @@ namespace NP.Base.Controllers uno = SUserInfo.UserNo, uip = GetUserIP(), ispg = 1, - isexam = vm.ispaycart?2:0, + isexam = vm.ispaycart ? 2 : 0, isgroup = vm.isgroup, userno = SUserInfo.UserNo, orgamt = vm.PayItems.Sum(s => s.orgamt), discamt = vm.PayItems.Sum(s => s.discamt), deliamt = vm.isdvr == 1 && vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? GetInt(GetConfig("deliveramt")) : 0, payamt = vm.PayItems.Sum(s => s.payamt) + (vm.isdvr == 1 && vm.PayItems.Where(w => w.ptype == 2).Count() > 0 ? GetInt(GetConfig("deliveramt")) : 0), + iscashrct = vm.ptype == 1 ? 0 : vm.iscashrct, + cashrcthp = vm.ptype == 1 ? null : vm.cashrcthp, + pplno = vm.pplno, PIs = vm.PayItems }; if (vm.Pay.isdvr == 1) { - vm.PayDVR.isdvr = vm.isdvr; - vm.Pay.PayDVR = vm.PayDVR; + //vm.PayDVR.isdvr = vm.isdvr; + //vm.Pay.PayDVR = vm.PayDVR; } if (vm.Pay.ptype == 3 && vm.Pay.payamt > 0) { @@ -421,8 +359,8 @@ namespace NP.Base.Controllers string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; vm.Pay.timestamp = timeTemp.Split('.')[0]; System.Security.Cryptography.SHA256Managed sha256Managed = new System.Security.Cryptography.SHA256Managed(); - vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", pginfos[4] + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); - vm.Pay.oid2 = pginfos[4]; + vm.Pay.signature = ComputeHash(string.Format("oid={0}&price={1}×tamp={2}", GetConfig("PAYMENT_CLASSIFICATION") + vm.Pay.payno, vm.Pay.payamt, vm.Pay.timestamp)); + vm.Pay.oid2 = GetConfig("PAYMENT_CLASSIFICATION"); return JsonBack(new JsonRtn() { code = 1000, obj = vm.Pay }); } } diff --git a/Dao/DB/DB1.Scheme.txt b/Dao/DB/DB1.Scheme.txt index c296075..f504cce 100644 --- a/Dao/DB/DB1.Scheme.txt +++ b/Dao/DB/DB1.Scheme.txt @@ -933,8 +933,8 @@ create table payrfd ( rfdno bigint auto_increment not null ,payno bigint not null ,rtext varchar (500) - ,bankname varchar (50) - ,bankno varbinary (200) + ,bankname varchar (50) + ,bankno varbinary (200) ,bankowner varchar (50) ,isowner tinyint not null ,rstatus tinyint not null @@ -943,8 +943,8 @@ create table payrfd ( ,rreason tinyint not null ,ruser varchar (50) null ,rphone varbinary (200) null - ,fgnor bigint not null - ,fgnob bigint not null + ,fgnor bigint null + ,fgnob bigint null ,rback varchar(500) null ,cdt datetime not null,cno bigint not NULL,udt datetime not null,uno bigint not NULL,uip varchar(50) not NULL ,primary key(rfdno)); diff --git a/Dao/MyBatis/Maps/Pay.xml b/Dao/MyBatis/Maps/Pay.xml index 466d8a2..9e82088 100644 --- a/Dao/MyBatis/Maps/Pay.xml +++ b/Dao/MyBatis/Maps/Pay.xml @@ -221,13 +221,13 @@ insert into pay(ptype,ispg,isgroup,isexam,userno,username,pstatus,rstatus - ,refunding,paylimit,payoktime,pgkey,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,isdvr,) + ,refunding,paylimit,payoktime,pgkey,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,isdvr,iscashrct,cashrcthp,pplno,) select #ptype#,#ispg#,#isgroup#,#isexam#,a.userno,a.username,case when #ptype# = 6 then 1 else 0 end,0 - ,#refunding#,#paylimit#,case when #ptype# = 6 then now() else #payoktime# end,#pgkey#,#orgamt#,#discamt#,#deliamt#,#isrefunddvr#,#payamt#,#refundamt#,#isdvr#, + ,#refunding#,#paylimit#,case when #ptype# = 6 then now() else #payoktime# end,#pgkey#,#orgamt#,#discamt#,#deliamt#,#isrefunddvr#,#payamt#,#refundamt#,#isdvr#,#iscashrct#,HEX(AES_ENCRYPT(#cashrcthp#, )),#pplno#, from users a where a.userno=#userno# SELECT LAST_INSERT_ID() insert into payitem (payno,ptype,pcno,itemno,userno,pstatus,rstatus - ,pcnt,orgamt,discamt,payamt,payamtcash,payamtcard,refundamt,refundtime,refundtimereal,refundinfo,isrebate,fgno,) + ,pcnt,orgamt,discamt,payamt,payamtcash,payamtcard,refundamt,refundtime,refundtimereal,refundinfo,isrebate,rbank,rbankaccnum,tbankuser,fgno,) select #payno#,a.ptype,null,a.itemno,a.userno,case when #ptype# = 6 then 1 else 0 end,0 - ,a.pcnt,a.orgamt,a.discamt,a.payamt,0,0,0,null,null,null,a.isrebate,ifnull(b.fgno,a.fgno), + ,a.pcnt,a.orgamt,a.discamt,a.payamt,0,0,0,null,null,null,a.isrebate,a.rbank,HEX(AES_ENCRYPT(a.rbankaccnum, )),a.tbankuser,ifnull(b.fgno,a.fgno), from ( - select #PIs[].ptype# ptype,#PIs[].itemno# itemno,#PIs[].userno# userno,#PIs[].pcnt# pcnt,#PIs[].orgamt# orgamt,#PIs[].discamt# discamt,#PIs[].payamt# payamt,#PIs[].isrebate# isrebate,#PIs[].fgno# fgno + select #PIs[].ptype# ptype,#PIs[].itemno# itemno,#PIs[].userno# userno,#PIs[].pcnt# pcnt,#PIs[].orgamt# orgamt,#PIs[].discamt# discamt,#PIs[].payamt# payamt,#PIs[].isrebate# isrebate,#PIs[].rbank# rbank,#PIs[].rbankaccnum# rbankaccnum,#PIs[].tbankuser# tbankuser,#PIs[].fgno# fgno ) a left outer join paycart b on #isexam# = 2 and a.ptype=0 and b.ptype=0 and b.itemno=a.itemno and b.userno=#userno# and b.status=1 and b.ispay=1 @@ -820,7 +820,7 @@ where payno=#payno# and isunpay=1; @*강좌번호*@ + @*법정교육/기타교육*@ + @*교육유형*@ + @*기술인분류*@ + @*교육목적*@ + @*등급*@ + @*직무분야*@ + + + +

신청강좌

+
    +
  • +
      +
    • + @if (Model.CM.cshape == 0) + { +

      + } + else if (Model.CM.cshape == 1) + { +

      + } + else if (Model.CM.cshape == 2) + { +

      + } +
    • +
    +
    + 결제금액 : @Model.CM.infee 원 +
    +
  • +
+ +

결제방법

+
    +
  • +
  • +
+ + + @Html.HiddenFor(m => m.payno) + @Html.HiddenFor(m => m.exno) + @Html.Hidden("pplno", Model.PPLog.pplno) + + + + + + + + + + + + + + + + + + + + + + + + +@section scriptsHeader{ + +} + diff --git a/FO/Views/Course/XpayREQ.cshtml b/FO/Views/Course/XpayREQ.cshtml new file mode 100644 index 0000000..c6c8da6 --- /dev/null +++ b/FO/Views/Course/XpayREQ.cshtml @@ -0,0 +1,61 @@ +@model NP.Model.VMPay +@if (ViewBag.isPayTest == "1") +{ + //테스트일 경우 + +} +else +{ + //서비스일 경우 + +} +
+
결제 진행중입니다. 잠시만 기다려주세요.
+
+ +
+ @foreach (System.Collections.DictionaryEntry data in Model.payParams) + { +
+ @*@(data.Key + "-" + data.Value)*@ + } +
+ + diff --git a/FO/Views/Course/XpayReturnURL.cshtml b/FO/Views/Course/XpayReturnURL.cshtml new file mode 100644 index 0000000..0e20668 --- /dev/null +++ b/FO/Views/Course/XpayReturnURL.cshtml @@ -0,0 +1,41 @@ +@{ + Layout = null; +} + + + + + + + + + +
+
결제 진행중입니다. 잠시만 기다려주세요.
+
+
+ @if (Model.payParams != null) + { + foreach (System.Collections.DictionaryEntry data in Model.payParams) + { +
+ } + } +
+ + \ No newline at end of file diff --git a/FO/Web.config b/FO/Web.config index 140d682..daba1cc 100644 --- a/FO/Web.config +++ b/FO/Web.config @@ -44,7 +44,7 @@ - + @@ -58,6 +58,25 @@ + + + + + + + + + + + + + + + + + + + @@ -112,7 +131,8 @@ - + + diff --git a/Model/Pay.cs b/Model/Pay.cs index 6f55401..7ecec87 100644 --- a/Model/Pay.cs +++ b/Model/Pay.cs @@ -209,6 +209,9 @@ namespace NP.Model public int exno { get; set; } public long rfdno { get; set; } public int iscanceled { get; set; } + public int iscashrct { get; set; } + public String cashrcthp { get; set; } + } public class PayItem : BaseModel @@ -457,6 +460,9 @@ namespace NP.Model return sstime.ToString("yyyy-MM-dd") + " ~ " + setime.ToString("yyyy-MM-dd"); } } + public String rbank { get; set; } + public String rbankaccnum{ get; set; } + public String tbankuser{ get; set; } } /// diff --git a/Model/VMCourse.cs b/Model/VMCourse.cs index 4208144..1735c3f 100644 --- a/Model/VMCourse.cs +++ b/Model/VMCourse.cs @@ -49,5 +49,6 @@ namespace NP.Model public Int64 pplno { get; set; } public Int64 payno { get; set; } public PayItem PayItem { get; set; } + public PPLog PPLog { get; set; } } } diff --git a/Model/VMPay.cs b/Model/VMPay.cs index 167d37c..edb1128 100644 --- a/Model/VMPay.cs +++ b/Model/VMPay.cs @@ -52,6 +52,10 @@ namespace NP.Model public IList PayCarts { get; set; } public int isexamready { get; set; } public int userno { get; set; } - + public Int64 pplno { get; set; } + public PPLog PPLog { get; set; } + public int iscashrct { get; set; } + public String cashrcthp { get; set; } + public System.Collections.Hashtable payParams { get; set; } } }