public bool SendToReceive(string jsonNotify, out string errMsg)
        {
            bool isSuccess;

            errMsg = "";
            try
            {
                Check.IsNullOrEmpty(jsonNotify, "补推json字符串");
                NotifyMessageModel model = JsonConvert.DeserializeObject <NotifyMessageModel>(jsonNotify);
                Process.Info("消息补推", "DifferentShowBusiness.SendToReceive", "", "json格式字符串:" + jsonNotify, "");
                if (model == null)
                {
                    Process.Info("消息补推", "DifferentShowBusiness.SendToReceive", "", "序列化失败", "");
                    isSuccess = false;
                    errMsg    = "序列化失败";
                    return(isSuccess);
                }
                isSuccess = SendToReceive(model, out errMsg);
            }
            catch (Exception ex)
            {
                Process.Error("消息补推", "DifferentShowBusiness.SendToReceive", "", jsonNotify + ",补推失败,ex:" + ex.ToString(), "");
                errMsg    = ex.GetString();
                isSuccess = false;
            }
            return(isSuccess);
        }
        public bool SendToReceive(NotifyMessageModel model, out string errMsg)
        {
            bool isSuccess;

            errMsg = "";
            NotifyMessage notifyMsg;

            try
            {
                Check.IsNull(model, string.Format("消息补推MessageId【{0}】对象", model.MessageId ?? ""));
                notifyMsg = MappingHelper.From <NotifyMessage, NotifyMessageModel>(model);
                Check.IsNull(notifyMsg, string.Format("消息补推MessageId【{0}】对象", model.MessageId ?? ""));
                ReceiveServiceClient rsClient = new ReceiveServiceClient();
                rsClient.Notify(notifyMsg);
                Process.Info("消息补推", "DifferentShowBusiness.SendToReceive", (model.MessageId ?? ""), "补推成功", "");
                isSuccess = true;
                if (!string.IsNullOrWhiteSpace(model.MessageId))
                {
                    NotifyMessageBusiness notifyBus = new NotifyMessageBusiness();
                    notifyBus.Delete(model.MessageId);
                }
            }
            catch (Exception ex)
            {
                Process.Error("消息补推", "DifferentShowBusiness.SendToReceive", (model.MessageId ?? ""), "补推失败,ex:" + ex.ToString(), "");
                errMsg    = ex.GetString();
                isSuccess = false;
            }
            return(isSuccess);
        }
示例#3
0
        public ActionResult SendToReceiveFromModel(NotifyMessageModel model)
        {
            string errMsg;

            model.MessagePriority = JinRi.Notify.Model.MessagePriorityEnum.None;
            bool isSuccess = m_diffBus.SendToReceive(model, out errMsg);

            return(Content(JsonConvert.SerializeObject(new ReturnMessage {
                Success = isSuccess, Msg = errMsg
            })));
        }