Exemple #1
0
        public ActionResult more_detail(int id)
        {
            NewsGw model = NewsGwBLL.SingleModel.GetModel(id);

            if (model == null)
            {
                return(Content("数据不存在!"));
            }
            return(View(model));
        }
Exemple #2
0
        public ActionResult AddOrEditNews(int appId = 0, int Id = 0, int Type = 0)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }

            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "权限表里没有该数据!", code = "403"
                }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "不能随便跨账号越权!", code = "403"
                }));
            }

            NewsGw model = new NewsGw();

            //默认新增
            ViewBag.Id = appId;
            model.Type = Type;
            if (Id > 0)
            {
                //表示修改
                model = NewsGwBLL.SingleModel.GetModel(Id);
                if (model == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "要修改的数据不存在!", code = "500"
                    }));
                }
            }
            return(View(model));
        }
Exemple #3
0
        public ActionResult DelMiniAppNews(int appId, int Id)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "请先登录" }));
            }

            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙appid_null" }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(Json(new { isok = false, msg = "权限表里没有该数据" }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(Json(new { isok = false, msg = "不能随便跨账号越权" }));
            }

            if (umodel.Id != 281)
            {
                return(Json(new { isok = false, msg = "你不是管理员不能删除" }));
            }

            NewsGw model = NewsGwBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                return(Json(new { isok = false, msg = "数据不存在!" }));
            }
            model.State = 0;
            if (NewsGwBLL.SingleModel.Update(model))
            {
                return(Json(new { isok = true, msg = "删除成功!" }));
            }
            else
            {
                return(Json(new { isok = false, msg = "删除异常!" }));
            }
        }
Exemple #4
0
        public ActionResult AddOrEditNews(int appId, NewsGw news)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "请先登录" }));
            }

            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙appid_null" }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(Json(new { isok = false, msg = "权限表里没有该数据" }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(Json(new { isok = false, msg = "不能随便跨账号越权" }));
            }

            if (umodel.Id != 281)
            {
                return(Json(new { isok = false, msg = "你不是管理员不能查看" }));
            }

            if (news == null || news.Title.Length > 30 || news.Title.Length <= 0)
            {
                return(Json(new { isok = false, msg = "标题不能为空并且长度为30字符内" }));
            }
            if (news.Introduce.Length > 100)
            {
                return(Json(new { isok = false, msg = "简介长度为100字符内" }));
            }

            if (news.Id > 0)
            {
                //表示修改
                if (NewsGwBLL.SingleModel.Update(news))
                {
                    return(Json(new { isok = true, msg = "修改成功!" }));
                }
                else
                {
                    return(Json(new { isok = false, msg = "修改异常!请联系客服" }));
                }
            }
            else
            {
                if (Convert.ToInt32(NewsGwBLL.SingleModel.Add(news)) > 0)
                {
                    return(Json(new { isok = true, msg = "新增成功!" }));
                }
                else
                {
                    return(Json(new { isok = false, msg = "新增异常!请联系客服" }));
                }
            }
        }