zoukankan      html  css  js  c++  java
  • 异步发送

            /// <summary>
            /// 发送  改成异步发送了
            /// </summary>
            /// <param name="userList"></param>
            /// <param name="message"></param>
            /// <param name="title"></param>
            /// <param name="notifyenum"></param>
            private static void Notify(NotifyContext noticontext, List<IssuedType> notifyenum)
            {
                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        notifyenum.ForEach(p =>
                        {
                            BaseNotifier noti = null;
                            #region 实例
                            //邮件
                            if (p == IssuedType.Mail)
                            {
                                noti = new MailNotifier();
                            }
                            //App
                            if (p == IssuedType.App)
                            {
                                noti = new AppNotifier();
                            }
                            //短信
                            if (p == IssuedType.SMS)
                            {
                                noti = new SMSNotifier();
                            }
                            #endregion
    
                            #region 赋值发送
                            if (noti != null)
                            {
                                noti.Context = noticontext;
                                noti.Notify();
    
    
                            }
                            #endregion
                        });
                    }
                    catch (Exception ex) { Dao.Get().ExecuteNonQuery("insert into vinson_msg(msg) values('" + ex.Message + "')"); }
                });
            }
  • 相关阅读:
    为什么要用do-while(0)?
    网络字节序&大小端存储
    sql语句w3school教程
    C++编码规范
    std::deque双端队列介绍
    gdb基本操作
    gdb调试多线程
    数据库基础
    删除vector所有元素
    stl迭代器失效
  • 原文地址:https://www.cnblogs.com/vinsonLu/p/9100779.html
Copyright © 2011-2022 走看看