예제 #1
0
        //发送商家短信
        void SendMessageBusiness(MessageModel model)
        {
            try
            {
                BusinessDao businessDao = new BusinessDao();
                DataTable   dt          = businessDao.GetPhoneNoList(model.PushCity);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["PhoneNo"] == null || dt.Rows[i]["PhoneNo"].ToString() == "")
                    {
                        continue;
                    }

                    string phoneNo = "";
                    if (StringHelper.CheckPhone(dt.Rows[i]["PhoneNo"].ToString()))
                    {
                        phoneNo = dt.Rows[i]["PhoneNo"].ToString();
                    }
                    //string phoneNo = "13520860798";
                    Task.Factory.StartNew(() =>
                    {
                        SendSmsHelper.SendSendSmsSaveLog(phoneNo, model.Content, SystemConst.SMSSOURCE);
                        //写日志
                        LogHelper.LogTraceWriterPhone(model.Id + "  商家:" + phoneNo);
                    });
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogWriter(ex);
            }
        }
예제 #2
0
        //发送商家app
        void SendAppBusiness(MessageModel model)
        {
            try
            {
                BusinessDao businessDao = new BusinessDao();
                DataTable   dt          = businessDao.GetPhoneNoList(model.PushCity);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string businessId = dt.Rows[i]["id"].ToString();
                    long   id         = businessMessageDao.Insert(new BusinessMessage
                    {
                        BusinessId = Convert.ToInt32(businessId),
                        Content    = model.Content,
                        IsRead     = 0
                    }
                                                                  );

                    Task.Factory.StartNew(() =>
                    {
                        JPushModel jpushModel = new JPushModel()
                        {
                            Alert          = "您有新消息啦,请及时查收!",
                            City           = string.Empty,
                            Content        = id.ToString(),
                            ContentKey     = "Notice",
                            RegistrationId = "B_" + businessId,
                            TagId          = 1,
                            Title          = "新消息",
                            PushType       = 1
                        };
                        Push.PushMessage(jpushModel);
                    });
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogWriter(ex);
            }
        }