Ejemplo n.º 1
0
        private void ShowWebPush(Int64 userid, String pushId)
        {
            String name = NoticeHtml.GetWebPushPath(long.Parse(pushId));

            NoticeHtml.CreateWebPushHtml(pushId, Server.MapPath(name));

            if (!System.IO.File.Exists(Server.MapPath(name)))
            {
                Response.Redirect("/home/push/template/push_404.html");
            }
            else
            {
                UpdateReadStatus(userid, pushId);
                Response.Redirect(name);
            }
        }
Ejemplo n.º 2
0
        private void DoEdit(long id)
        {
            int totalUserCount = 0;

            Int32.TryParse(this.hidTotalUserCount.Value, out totalUserCount);
            if (totalUserCount == 0)
            {
                JscriptMsg("选择的推送用户数不能为0!", "", "Error");
                return;
            }
            BLL.CCOM.Notice bll   = new BLL.CCOM.Notice();
            var             model = bll.GetModel(id);

            model.Notice_last_editor = GetAdminInfo_CCOM().User_id;
            model.Notice_receiver_id = this.hidUserList.Value.ToString();
            int type = this.hidIsImagePush.Value == "1" ? 1 : 0;

            if (type == 0)
            {
                model.Notice_content = txtContent.Text.Trim().Replace("'", "");
            }
            else
            {
                //图文通知
                model.Notice_title   = this.txtTitle.Text.Trim();
                model.Notice_content = this.hidEditorCnt.Value.Replace("'", "");
                new BLL.CCOM.Notice_attach().Delete(" Notice_id=" + id);
                AddAttach(id);
            }
            bool result = bll.Update(model);

            //修改推送用户的阅读状态为未读,相当于重新推送覆盖之前
            if (result)
            {
                var      userIdList   = this.hidUserList.Value.ToString().Split(',').ToList();
                string[] receiver_ids = this.hidUserList.Value.ToString().Split(',');

                if (receiver_ids != null && receiver_ids.Length > 0)
                {
                    var bll1 = new BLL.CCOM.User_notice();
                    for (int i = 0; i < receiver_ids.Length; i++)
                    {
                        var user_notice_model = bll1.GetModel(" User_id= " + receiver_ids[i]);
                        if (user_notice_model != null)
                        {
                            string[] notice_ids      = user_notice_model.Notice_id.Split(',');
                            string[] notice_read_ids = user_notice_model.Notice_read_id.Split(',');
                            //新加的用户
                            if (!notice_ids.Contains(model.Notice_id.ToString()) && !notice_read_ids.Contains(model.Notice_id.ToString()))
                            {
                                if (user_notice_model.Notice_id == null || user_notice_model.Notice_id.Length <= 0)//暂无未读通知
                                {
                                    user_notice_model.Notice_id = model.Notice_id.ToString();
                                }
                                else
                                {
                                    user_notice_model.Notice_id = user_notice_model.Notice_id + "," + model.Notice_id.ToString();
                                }
                                bll1.Update(user_notice_model);
                            }
                            else//之前发送过的用户
                            {
                                if (notice_read_ids.Contains(model.Notice_id.ToString()))//已经阅读过,从已读移到未读
                                {
                                    //从已读去掉
                                    List <string> read_ids = notice_read_ids.ToList();
                                    read_ids.Remove(model.Notice_id.ToString());

                                    string temp = string.Empty;
                                    for (int j = 0; j < read_ids.Count; j++)
                                    {
                                        temp = temp + read_ids[j] + ",";
                                    }
                                    temp = temp.Substring(0, temp.Length - 1);
                                    user_notice_model.Notice_read_id = temp;

                                    //加入未读
                                    if (user_notice_model.Notice_id == null || user_notice_model.Notice_id.Length <= 0)
                                    {
                                        user_notice_model.Notice_id = model.Notice_id.ToString();
                                    }
                                    else
                                    {
                                        user_notice_model.Notice_id = user_notice_model.Notice_id + "," + model.Notice_id.ToString();
                                    }
                                    //更新
                                    bll1.Update(user_notice_model);
                                }
                            }
                        }
                        else
                        {
                            //表中暂无该用户记录,创建该用户记录
                            Model.CCOM.User_notice mod = new Model.CCOM.User_notice();
                            mod.Notice_id = model.Notice_id.ToString();
                            mod.User_id   = long.Parse(receiver_ids[i]);
                            bll1.Add(mod);
                        }
                    }
                }

                if (this.chbSmsSend.Checked)
                {
                    SmsHelper.SendSmsNotice(userIdList, model.Notice_content, GetAdminInfo_CCOM().User_id);
                    //if (new BLL.CCOM.User_sms().GetModel(GetAdminInfo_CCOM().User_id).User_sms_left < userIdList.Count)
                    //{
                    //    JscriptMsg("您的剩余短信已不足,请申请短信!!", "", "Error");
                    //    return;
                    //}
                }
                //生成静态页
                NoticeHtml.CreateHtml(id, false);
                string pageUrl = Utils.CombUrlTxt("Notice_list_manager.aspx", "fun_id={0}&pushId={1}", get_fun_id("CCOM/notice/Notice_list_manager.aspx"), pushId.ToString());
                JscriptMsg("修改成功 ,跳转至结果页面...", pageUrl, "Success");
            }
        }
Ejemplo n.º 3
0
        //生成静态页面
        private void CreateHtmlPage(long id)
        {
            String name = NoticeHtml.WebPushBaseDir + DESEncrypt.Encrypt(id.ToString()) + ".html";

            NoticeHtml.CreateWebPushHtml(id.ToString(), Server.MapPath(name));
        }