Exemple #1
0
        /// <summary>
        /// 外发
        /// </summary>
        public void Send()
        {
            CSConversationBLL conversationBll = new CSConversationBLL(loggingSessionInfo);
            var conversations = conversationBll.Query(new IWhereCondition[]
            {
                new DirectCondition("IsPush=0 or IsPush is NULL")
            }, new[]
            {
                new OrderBy
                {
                    FieldName = "CreateTime",
                    Direction = OrderByDirections.Desc
                }
            });

            foreach (var conversationEntity in conversations)
            {
                CSMessageBLL    messageBll    = new CSMessageBLL(loggingSessionInfo);
                CSMessageEntity messageEntity = messageBll.GetByID(conversationEntity.CSMessageID);
                try
                {
                    switch (messageEntity.CSPipelineID)
                    {
                    //微信
                    case 1:
                        IPushMessage pushWXMessage = new PushWeiXinMessage(loggingSessionInfo);
                        pushWXMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
                        break;

                    //短信
                    case 2:
                        IPushMessage pushSMSMessage = new PushSMSMessage(loggingSessionInfo);
                        pushSMSMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
                        break;

                    //IOS
                    case 3:
                        IPushMessage pusIOSMessage = new PushIOSMessage(loggingSessionInfo);
                        pusIOSMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
                        break;

                    //Android
                    case 4:
                        IPushMessage pusAndroidMessage = new PushAndroidMessage(loggingSessionInfo);
                        pusAndroidMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
                        break;
                    }
                    //更新已经推送
                    conversationEntity.IsPush = 1;
                    conversationBll.Update(conversationEntity);
                }
                catch (Exception ex)
                {
                    Loggers.DEFAULT.Debug(new DebugLogInfo
                    {
                        Message = "离线消息推送错误:" + ex.Message + "|" + conversationEntity.PersonID + "/" + messageEntity.CSPipelineID + "/" + conversationEntity.ToJSON()
                    });
                }
            }
        }
Exemple #2
0
 public void PushMessage(CSConversationEntity conversationEntity, SendMessageEntity wxmessageEntty, string memberID)
 {
     try
     {
         PushWeiXinMessage pushWeixinMessage = new PushWeiXinMessage(loggingSessionInfo);
         pushWeixinMessage.PushMessage(memberID, conversationEntity.Content, wxmessageEntty);
     }
     catch (Exception)
     {
         IPushMessage pushSMSMessage = new PushSMSMessage(loggingSessionInfo);
         pushSMSMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
     }
 }
Exemple #3
0
 public void PushMessage(CSConversationEntity conversationEntity)
 {
     try
     {
         IPushMessage pushWeixinMessage = new PushWeiXinMessage(loggingSessionInfo);
         pushWeixinMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
     }
     catch (Exception)
     {
         IPushMessage pushSMSMessage = new PushSMSMessage(loggingSessionInfo);
         pushSMSMessage.PushMessage(conversationEntity.PersonID, conversationEntity.Content);
     }
 }