protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("emailtask_edit", "群发邮件")) { PageReturnMsg = PageNoPowerMsg(); } PageSize = RequestTool.getpageSize(25); string where = "1=1"; models = B_Lebi_Email.GetList(where, "id desc", PageSize, page); int recordCount = B_Lebi_Email.Counts(where); PageString = Pager.GetPaginationString("?page={0}", page, PageSize, recordCount); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("emailtask_edit", "群发邮件")) { PageNoPower(); } int id = RequestTool.RequestInt("id", 0); model = B_Lebi_Email.GetModel(id); if (model == null) { model = new Lebi_Email(); } }
/// <summary> ///生成邮件任务 /// </summary> public void EmailTask_Create() { if (!EX_Admin.Power("emailtask_edit", "群发邮件")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); Lebi_EmailTask model = B_Lebi_EmailTask.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } model.EmailContent = Language.RequestString("EmailContent"); model.EmailTitle = Language.RequestString("EmailTitle"); model.UserLevel_ids = RequestTool.RequestString("UserLevel_ids"); model.Time_task = RequestTool.RequestTime("Time_task"); B_Lebi_EmailTask.Update(model); //================= //处理图片 string content = model.EmailContent; Regex r = new Regex(@"[sS][rR][cC]=\\\"".*?\\\""", RegexOptions.Singleline); MatchCollection mc = r.Matches(content); string temp = ""; string src = ""; foreach (Match m in mc) { temp = m.Value; src = RegexTool.GetRegValue(temp, @"[sS][rR][cC]=\\\""(.*?)\\\"""); if (!Regex.IsMatch(src.ToLower(), @"http://.*?", RegexOptions.IgnoreCase)) //if (!src.ToLower().Contains("http://")) { src = SYS.Domain + "/" + src; src = ThemeUrl.CheckURL(src); content = content.Replace(temp, "src=\\\"" + src + "\""); } } //处理图片结束 //==================== List <Lebi_User> users = B_Lebi_User.GetList("UserLevel_id in (" + model.UserLevel_ids + ")", ""); Lebi_Email email = new Lebi_Email(); foreach (Lebi_User user in users) { email.Content = Language.Content(content, user.Language); email.Title = Language.Content(model.EmailTitle, user.Language); email.Time_Task = model.Time_task; email.User_id = user.id; email.User_Name = user.UserName; email.EmailTask_id = model.id; email.Email = user.Email; email.Count_send = 0; email.Type_id_EmailStatus = 270;//排队中的邮件 B_Lebi_Email.Add(email); } model.IsSubmit = 1; B_Lebi_EmailTask.Update(model); Response.Write("{\"msg\":\"OK\"}"); }