diff --git a/BO/Controllers/AccountController.cs b/BO/Controllers/AccountController.cs index f6b5817..c4af541 100644 --- a/BO/Controllers/AccountController.cs +++ b/BO/Controllers/AccountController.cs @@ -287,8 +287,11 @@ namespace NP.BO.Controllers m.Users.Add(new MemoUser() { userno = u.userno, + uno = SUserInfo.UserNo, + uip = GetUserIP(), smstype = "A", isok = string.IsNullOrEmpty(u.mobile) ? -1 : 1, + title = "[영남건설기술교육원] 진행평가 참여 알림", mobile = (u.mobile ?? "").Replace("-", ""), mcontents = string.Format("영남건설기술교육원입니다.\n\n[{0}]님이 수강중인 [{1}] 강좌의 교육 종료일이 {2}일 남았습니다. 종료되기전에 서둘러 " + (u.scdno < 3 ? "학습을 진행" : u.scdno == 3 ? "진행평가에" : u.scdno == 4 ? "최종평가에" : u.scdno == 5 ? "과제을 제출" : u.scdno == 6 ? "토론에 참여" : u.scdno == 7 ? "강의평가에 참여" : "-") + "해주세요.\n\n☞사이트 : https://edu.kfcf.or.kr", @@ -297,7 +300,7 @@ namespace NP.BO.Controllers } if (m.Users.Where(w => w.isok == 1).Count() > 0) { - Talk(m.Users.Where(w => w.isok == 1).ToList(), "encourage1"); + SaveTalk(m.Users.Where(w => w.isok == 1).ToList(), "encourage1"); m.Users.Clear(); } var masteremail = GetConfig("masteremail"); @@ -321,6 +324,7 @@ namespace NP.BO.Controllers { userno = u.userno, smstype = "A", + title = "[영남건설기술교육원] 진행평가 참여 알림", isok = string.IsNullOrEmpty(u.mobile) ? -1 : 1, mobile = (u.mobile ?? "").Replace("-", ""), mcontents = string.Format("영남건설기술교육원입니다.\n\n{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.\n\n☞사이트 : https://edu.kfcf.or.kr", @@ -329,7 +333,7 @@ namespace NP.BO.Controllers } if (m.Users.Where(w => w.isok == 1).Count() > 0) { - Talk(m.Users.Where(w => w.isok == 1).ToList(), "encourage7"); + SaveTalk(m.Users.Where(w => w.isok == 1).ToList(), "encourage7"); m.Users.Clear(); } var masteremail = GetConfig("masteremail"); @@ -352,6 +356,7 @@ namespace NP.BO.Controllers { userno = u.userno, smstype = "A", + title = "[영남건설기술교육원] 진행평가 참여 알림", isok = string.IsNullOrEmpty(u.mobile) ? -1 : 1, mobile = (u.mobile ?? "").Replace("-", ""), mcontents = string.Format("영남건설기술교육원입니다.\n\n{0}님이 신청중인 [{1}] 자격검정이 [{2}]에 {3}에서 이뤄질 예정입니다.\n\n☞사이트: https://edu.kfcf.or.kr", @@ -360,7 +365,7 @@ namespace NP.BO.Controllers } if (m.Users.Where(w => w.isok == 1).Count() > 0) { - Talk(m.Users.Where(w => w.isok == 1).ToList(), "encourage8"); + SaveTalk(m.Users.Where(w => w.isok == 1).ToList(), "encourage8"); m.Users.Clear(); } var masteremail = GetConfig("masteremail"); diff --git a/BO/Web.config b/BO/Web.config index b732431..06dad23 100644 --- a/BO/Web.config +++ b/BO/Web.config @@ -73,9 +73,10 @@ + + - diff --git a/BO/obj/Debug/BO.csprojAssemblyReference.cache b/BO/obj/Debug/BO.csprojAssemblyReference.cache index ca5c69c..08d7e60 100644 Binary files a/BO/obj/Debug/BO.csprojAssemblyReference.cache and b/BO/obj/Debug/BO.csprojAssemblyReference.cache differ diff --git a/Base/Controller/BasePartialController.cs b/Base/Controller/BasePartialController.cs index e5d7a0c..846ae0f 100644 --- a/Base/Controller/BasePartialController.cs +++ b/Base/Controller/BasePartialController.cs @@ -9,6 +9,8 @@ using System.Security.Principal; using System.Security.Cryptography; using System.IO; using System.Web.Mail; +using System.Web.Compilation; +using NP.Model; namespace NP.Base { @@ -1231,6 +1233,34 @@ namespace NP.Base } } } + public void SaveTalk(IList Users, String tmplkey) + { + + IList m = new List() { }; + var us = Users.Where(w => w.isok == 1).ToList(); + if (us.Count() > 0) + { + System.Text.StringBuilder sb = new System.Text.StringBuilder(""); + for (var i = 0; i < us.Count(); i++) + { + var cbnum = GetConfig("mtssendnum"); + var talkkey = GetConfig("mastersms"); + var ismms = System.Text.Encoding.Default.GetBytes(us[i].mcontents).Length > 90; + + for (var j = 0; j < us.Count(); j++) + { + sb.Append(string.Format(",('{0}','{1}','{2}','{3}','{4}','{5}',now(),5,'1','{6}','{7}')", talkkey, tmplkey, cbnum, us[i].mobile.Replace(" ","").Replace("-",""), us[i].title, us[i].mcontents, (ismms ? "L" : "S"), us[i].mcontents)); + } + } + var strConn = GetConfig("mtsdb"); + using (var conn = new MySql.Data.MySqlClient.MySqlConnection(strConn)) + { + conn.Open(); + var cmd = new MySql.Data.MySqlClient.MySqlCommand("insert into mts_atalk_msg(tran_sender_key,tran_tmpl_cd,tran_callback,tran_phone,tran_subject,tran_msg,tran_date,tran_type,tran_status,tran_replace_type,tran_replace_msg) values" + sb.ToString().Substring(1), conn); + cmd.ExecuteNonQuery(); + } + } + } /// /// /// diff --git a/Base/Controller/FOCommon.cs b/Base/Controller/FOCommon.cs index 6c1d875..26dbff5 100644 --- a/Base/Controller/FOCommon.cs +++ b/Base/Controller/FOCommon.cs @@ -8,6 +8,8 @@ using NP.Model; using System.Collections; using NP.Base.Auth; using NP.Base.ENUM; +using System.Web.ModelBinding; + namespace NP.Base.Controllers { public partial class FOCommonController : NP.Base.BaseController @@ -476,7 +478,18 @@ namespace NP.Base.Controllers return JsonBack(new JsonRtn() { code = -1 }); } Dao.Insert("common.smsauth", sa); - Dao.Insert("common.atalk.send", new Hashtable() { { "senderkey", GetConfig("mastersms").Split(';')[0] },{"method","alarm" }, { "DEST_PHONE", mobile.Replace(" ", "").Replace("-", "") }, { "SEND_PHONE", GetConfig("mastersms").Split(';')[1] },{"title","인증번호" }, { "MSG_BODY", msg },{"replace_type","S" } }); + IList us = new List(); + us.Add(new MemoUser() + { + userno = SUserInfo.UserNo, + mobile = mobile, + title = "인증번호", + mcontents = msg, + smstype = "A", + isok = 1 + }); + SaveTalk(us, "alarm"); + //Dao.Insert("common.atalk.send", new Hashtable() { { "senderkey", GetConfig("mastersms").Split(';')[0] },{"method","alarm" }, { "DEST_PHONE", mobile.Replace(" ", "").Replace("-", "") }, { "SEND_PHONE", GetConfig("mastersms").Split(';')[1] },{"title","인증번호" }, { "MSG_BODY", msg },{"replace_type","S" } }); return JsonOK(sa.authno); } [HttpPost] diff --git a/Base/obj/Debug/Base.csprojAssemblyReference.cache b/Base/obj/Debug/Base.csprojAssemblyReference.cache index 5455e2b..f3f8efd 100644 Binary files a/Base/obj/Debug/Base.csprojAssemblyReference.cache and b/Base/obj/Debug/Base.csprojAssemblyReference.cache differ diff --git a/Dao/obj/Debug/Dao.csprojAssemblyReference.cache b/Dao/obj/Debug/Dao.csprojAssemblyReference.cache index cc42b5a..ba0d58a 100644 Binary files a/Dao/obj/Debug/Dao.csprojAssemblyReference.cache and b/Dao/obj/Debug/Dao.csprojAssemblyReference.cache differ diff --git a/FO/Web.config b/FO/Web.config index c25507a..d4e041a 100644 --- a/FO/Web.config +++ b/FO/Web.config @@ -36,7 +36,6 @@ - @@ -78,7 +77,10 @@ - + + + + diff --git a/Model/Common.cs b/Model/Common.cs index 32eac50..4ee2c75 100644 --- a/Model/Common.cs +++ b/Model/Common.cs @@ -119,6 +119,7 @@ namespace NP.Model public String msgid { get; set; } public String message { get; set; } public String mcontents { get; set; } + public String title { get; set; } }