Пример #1
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");
                var channelId           = body.GetPostInt("channelId");
                var contentId           = body.GetPostInt("contentId");
                var templateId          = body.GetPostInt("templateId");
                var ajaxDivId           = PageUtils.FilterSqlAndXss(body.GetPostString("ajaxDivId"));
                var pageUrl             = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("pageUrl"));
                var testType            = PageUtils.FilterSqlAndXss(body.GetPostString("testType"));
                var testValue           = PageUtils.FilterSqlAndXss(body.GetPostString("testValue"));
                var testOperate         = PageUtils.FilterSqlAndXss(body.GetPostString("testOperate"));
                var successTemplate     = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("successTemplate"));
                var failureTemplate     = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("failureTemplate"));

                var isSuccess = false;
                if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserLoggin))
                {
                    isSuccess = body.IsUserLoggin;
                }
                else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsAdministratorLoggin))
                {
                    isSuccess = body.IsAdministratorLoggin;
                }
                else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserOrAdministratorLoggin))
                {
                    isSuccess = body.IsUserLoggin || body.IsAdministratorLoggin;
                }
                else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeUserGroup))
                {
                    if (body.IsUserLoggin && body.UserInfo.GroupId > 0)
                    {
                        var groupName = UserGroupManager.GetGroupName(body.UserInfo.GroupId);
                        if (!string.IsNullOrEmpty(groupName))
                        {
                            isSuccess = StlIf.TestTypeValue(testOperate, testValue, groupName);
                        }
                    }
                }

                return(Ok(new
                {
                    Html = StlUtility.ParseDynamicContent(publishmentSystemId, channelId, contentId, templateId, false, isSuccess ? successTemplate : failureTemplate, pageUrl, 0, ajaxDivId, null, body.UserInfo)
                }));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
Пример #2
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");
                var pageNodeId          = body.GetPostInt("pageNodeId");
                if (pageNodeId == 0)
                {
                    pageNodeId = publishmentSystemId;
                }
                var pageContentId   = body.GetPostInt("pageContentId");
                var pageTemplateId  = body.GetPostInt("pageTemplateId");
                var isPageRefresh   = body.GetPostBool("isPageRefresh");
                var templateContent = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("templateContent"));
                var ajaxDivId       = PageUtils.FilterSqlAndXss(body.GetPostString("ajaxDivId"));

                var channelId = body.GetPostInt("channelId");
                if (channelId == 0)
                {
                    channelId = pageNodeId;
                }
                var contentId = body.GetPostInt("contentId");
                if (contentId == 0)
                {
                    contentId = pageContentId;
                }

                var pageUrl   = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("pageUrl"));
                var pageIndex = body.GetPostInt("pageNum");
                if (pageIndex > 0)
                {
                    pageIndex--;
                }

                var queryString = PageUtils.GetQueryStringFilterXss(PageUtils.UrlDecode(HttpContext.Current.Request.RawUrl));
                queryString.Remove("publishmentSystemID");

                return(Ok(new
                {
                    Html = StlUtility.ParseDynamicContent(publishmentSystemId, channelId, contentId, pageTemplateId, isPageRefresh, templateContent, pageUrl, pageIndex, ajaxDivId, queryString, body.UserInfo)
                }));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
Пример #3
0
        public IHttpActionResult Main()
        {
            try
            {
                var request = new Request();

                var siteId     = request.GetPostInt("siteId");
                var channelId  = request.GetPostInt("channelId");
                var contentId  = request.GetPostInt("contentId");
                var templateId = request.GetPostInt("templateId");
                var ajaxDivId  = PageUtils.FilterSqlAndXss(request.GetPostString("ajaxDivId"));
                var pageUrl    = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("pageUrl"));
                var testType   = PageUtils.FilterSqlAndXss(request.GetPostString("testType"));
                //var testValue = PageUtils.FilterSqlAndXss(request.GetPostString("testValue"));
                //var testOperate = PageUtils.FilterSqlAndXss(request.GetPostString("testOperate"));
                var successTemplate = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("successTemplate"));
                var failureTemplate = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("failureTemplate"));

                var isSuccess = false;
                if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserLoggin))
                {
                    isSuccess = request.IsUserLoggin;
                }
                else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsAdministratorLoggin))
                {
                    isSuccess = request.IsAdminLoggin;
                }
                else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserOrAdministratorLoggin))
                {
                    isSuccess = request.IsUserLoggin || request.IsAdminLoggin;
                }

                return(Ok(new
                {
                    Html = StlUtility.ParseDynamicContent(siteId, channelId, contentId, templateId, false, isSuccess ? successTemplate : failureTemplate, pageUrl, 0, ajaxDivId, null, request.UserInfo)
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }