Ejemplo n.º 1
0
        public JsonResult GetMessageType(string message)
        {
            try
            {
                var msgContent = string.Empty;
                var msgType    = 0;
                var imgList    = new List <string>();
                MsgServices.GetMessageType(message, out msgContent, out msgType, out imgList);

                //去掉html标签
                string strText = System.Text.RegularExpressions.Regex.Replace(msgContent, @"<[^>]*>", "");
                strText = System.Text.RegularExpressions.Regex.Replace(strText, "&[^;]+;", "");


                return(Json(
                           new
                {
                    Success = true,
                    Content = strText,
                    msgType = msgType,
                    imgList = imgList,
                },
                           JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(
                           new
                {
                    Success = true,
                    Content = ex.ToString()
                },
                           JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetWorkGroup(string message)
        {
            try
            {
                var result = new TextAndImageMessage {
                    imgList = new List <string>(), msg = string.Empty, type = 0,
                };
                var msgContent = string.Empty;
                var msgType    = 0;
                var imgList    = new List <string>();
                MsgServices.GetMessageType(message, out msgContent, out msgType, out imgList);

                //去掉html标签
                string strText = System.Text.RegularExpressions.Regex.Replace(msgContent, @"<[^>]*>", "");
                strText = System.Text.RegularExpressions.Regex.Replace(strText, "&[^;]+;", "");

                result.imgList = imgList;
                result.msg     = msgContent;
                result.type    = msgType;

                return(Json(
                           new
                {
                    Success = true,
                    Content = result,
                    Error = "",
                    Message = "查询成功",
                    Count = 0,
                    Total = 0,
                }));
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                return(Json(
                           new
                {
                    Success = false,
                    Content = "",
                    Error = ex.Message,
                    Message = "查询失败",
                    Count = 0,
                    Total = 0,
                }));
            }
        }