コード例 #1
0
        public ActionResult AddOrEditDevelopment(int appid, int id, int Level)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(appid);

            if (listtemp == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有找到模板!", code = "500"
                }));
            }
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = appid;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            if (id <= 0)
            {
                return(View(new Development()));
            }
            else
            {
                Development model = DevelopmentBLL.SingleModel.GetModel(id);
                return(View(model));
            }
        }
コード例 #2
0
 /// <summary>
 /// 编辑模块
 /// </summary>
 /// <param name="id"></param>
 /// <param name="ty"></param>
 /// <returns></returns>
 public ActionResult AddOrEditMiniapp(Miniapp infon)
 {
     try
     {
         if (dzaccount == null)
         {
             return(Redirect("/dzhome/login"));
         }
         //添加
         if (infon.Id == 0)
         {
             infon.OpenId     = dzaccount.OpenId;
             infon.CreateDate = DateTime.Now;
             object id = MiniappBLL.SingleModel.Add(infon);
             if (int.Parse(id.ToString()) <= 0)
             {
                 return(Json(new { code = 0, msg = "添加失败" }));
             }
             return(Json(new { code = 1, msg = "添加成功" }));
         }
         else
         {
             //删除
             if (infon.State == 0)
             {
                 Miniapp model = MiniappBLL.SingleModel.GetModel(infon.Id);
                 model.State = infon.State;
                 if (!MiniappBLL.SingleModel.Update(model))
                 {
                     return(Json(new { code = 0, msg = "删除失败" }));
                 }
                 return(Json(new { code = 1, msg = "删除成功" }));
             }
             else
             {
                 //修改
                 string cloumns = "StoreName,Linkurl,ImgUrl,Description,MenuLink,ModelId";
                 if (!MiniappBLL.SingleModel.Update(infon, cloumns))
                 {
                     return(Json(new { code = 0, msg = "修改失败" }));
                 }
                 return(Json(new { code = 1, msg = "修改成功" }));
             }
         }
     }
     catch (Exception ex)
     {
         log4net.LogHelper.WriteError(this.GetType(), ex);
         return(Json(new { code = 0, msg = "操作异常" }));
     }
 }
コード例 #3
0
        public ActionResult AddOrEditCompanyNews(int appid, int id, int Level)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(appid);

            if (listtemp == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有找到模板!", code = "500"
                }));
            }
            if (Level == 8)
            {
                ViewBag.Title = "编辑企业动态";
            }
            else
            {
                ViewBag.Title = "编辑产品展示";
            }
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = appid;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            if (id <= 0)
            {
                return(View(new Moduls()));
            }
            else
            {
                Moduls model = ModulsBLL.SingleModel.GetModel(id);
                ViewBag.xcxImgUrlList = new List <object>();
                if (model != null)
                {
                    ViewBag.xcxImgUrlList = new List <object>()
                    {
                        new { id = model.Id, url = model.ImgUrl }
                    };
                }
                return(View(model));
            }
        }
コード例 #4
0
        public ActionResult ReflashModelImg(int id)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            Miniapp infos = MiniappBLL.SingleModel.GetModelByRelationId(id);

            //var infos = _miniappBll.GetModel("Id = " + id);
            if (infos != null)
            {
                return(PartialView("MiappImgUpload", new Moduls()
                {
                    ImgUrl = infos.ImgUrl
                }));
            }

            return(PartialView("MiappImgUpload", new Moduls()));
        }
コード例 #5
0
        /// <summary>
        /// 初始化模块
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="storename"></param>
        /// <param name="Level"></param>
        /// <returns></returns>
        ///
        public ActionResult ModelData(int Id = 0, string storename = "", int Level = 0, int pageindex = 1, int pagesize = 10)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            if (Id <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数出错!", code = "500"
                }));
            }

            XcxAppAccountRelation role = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(Id, dzaccount.Id.ToString());

            if (role == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有权限!", code = "403"
                }));
            }

            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(Id);

            if (listtemp != null)
            {
                //获得隐藏模板Level
                ViewBag.hidden = listtemp.hiddenModel;
            }
            else
            {
                XcxAppAccountRelation xrelationmodel = XcxAppAccountRelationBLL.SingleModel.GetModel(Id);
                if (xrelationmodel == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "没有权限!", code = "403"
                    }));
                }
                listtemp               = new Miniapp();
                listtemp.CreateDate    = DateTime.Now;
                listtemp.Description   = "官网小程序";
                listtemp.OpenId        = dzaccount.OpenId;
                listtemp.xcxRelationId = Id;
                listtemp.State         = 1;
                listtemp.ModelId       = xrelationmodel.AppId;
                listtemp.Id            = Convert.ToInt32(MiniappBLL.SingleModel.Add(listtemp));
                if (listtemp.Id <= 0)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "添加繁忙!", code = "500"
                    }));
                }
                ViewBag.hidden = "";
            }

            ViewBag.Title      = storename;
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = Id;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            string        sql      = "appId = " + listtemp.Id + " and Level = " + Level + " and State = 1";
            List <Moduls> model    = ModulsBLL.SingleModel.GetList(sql);
            string        viewname = "";

            switch (Level)
            {
            case (int)Miapp_Miniappmoduls_Level.ModelData: viewname = "Index";
                break;

            case (int)Miapp_Miniappmoduls_Level.FirstModel: viewname = "FirstModel";
                break;

            case (int)Miapp_Miniappmoduls_Level.TwoModel: viewname = "TwoModel";
                break;

            case (int)Miapp_Miniappmoduls_Level.ThreeModel: viewname = "ThreeModel"; break;

            case (int)Miapp_Miniappmoduls_Level.FourModel:
                viewname = "ProductShow";

                List <Moduls> productlist = ModulsBLL.SingleModel.GetListByAppidandLevel(listtemp.Id, Level, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.TotalCount = ModulsBLL.SingleModel.GetListByAppidandLevelCount(listtemp.Id, Level);
                return(View(viewname, productlist));

            case (int)Miapp_Miniappmoduls_Level.FiveModel:
                Moduls miniappmodel = new Moduls();
                if (model == null || model.Count <= 0)
                {
                    //添加动态新闻背景色
                    miniappmodel            = new Moduls();
                    miniappmodel.appId      = listtemp.Id;
                    miniappmodel.Level      = (int)Miapp_Miniappmoduls_Level.FiveModel;
                    miniappmodel.State      = 1;
                    miniappmodel.Createdate = DateTime.Now;
                    miniappmodel.Lastdate   = DateTime.Now;
                    miniappmodel.Title      = "发展历程";
                    miniappmodel.Id         = Convert.ToInt32(ModulsBLL.SingleModel.Add(miniappmodel));
                }
                else
                {
                    miniappmodel = model[0];
                }
                viewname = "Development";
                List <Development> datass = DevelopmentBLL.SingleModel.GetListByAppid(listtemp.Id, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.dTitle     = miniappmodel.Title;
                ViewBag.did        = miniappmodel.Id;
                ViewBag.TotalCount = DevelopmentBLL.SingleModel.GetListByAppidCount(listtemp.Id);
                return(View(viewname, datass));

            case (int)Miapp_Miniappmoduls_Level.SixModel: viewname = "CallWe";
                break;

            case (int)Miapp_Miniappmoduls_Level.EightModel:
                viewname = "CompanyNews";
                List <Moduls> companynewslist = ModulsBLL.SingleModel.GetListByAppidandLevel(listtemp.Id, Level, pageindex, pagesize);
                ViewBag.pageSize   = 10;
                ViewBag.TotalCount = ModulsBLL.SingleModel.GetListByAppidandLevelCount(listtemp.Id, Level);
                return(View(viewname, companynewslist));

            default:
                viewname = "ModelData";
                break;
            }

            if (model != null && model.Count > 0)
            {
                return(View(viewname, model[0]));
            }

            return(View(viewname, new Moduls()
            {
                appId = listtemp.Id, Level = Level
            }));
        }
コード例 #6
0
        public ActionResult Index(int Id, string storename, int Level)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            if (Id <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }

            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(Id);

            if (listtemp != null)
            {
                //获得隐藏模板Level
                ViewBag.hidden = listtemp.hiddenModel;
            }
            else
            {
                XcxAppAccountRelation xrelationmodel = XcxAppAccountRelationBLL.SingleModel.GetModel(Id);
                if (xrelationmodel == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "没有权限!", code = "403"
                    }));
                }
                listtemp               = new Miniapp();
                listtemp.CreateDate    = DateTime.Now;
                listtemp.Description   = "官网小程序";
                listtemp.OpenId        = dzaccount.OpenId;
                listtemp.xcxRelationId = Id;
                listtemp.State         = 1;
                listtemp.ModelId       = xrelationmodel.AppId;
                listtemp.Id            = Convert.ToInt32(MiniappBLL.SingleModel.Add(listtemp));
                if (listtemp.Id <= 0)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "添加出错!", code = "500"
                    }));
                }
                ViewBag.hidden = "";
            }

            ViewBag.Title      = storename;
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = Id;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;
            ViewBag.ImgUrlList = new List <object>();

            string        sql   = "appId = " + listtemp.Id + " and Level = " + Level + " and State = 1";
            List <Moduls> model = ModulsBLL.SingleModel.GetList(sql);


            ViewBag.ImgUrlList = new List <object>();
            if (model != null && model.Count > 0)
            {
                List <C_Attachment> imgs = C_AttachmentBLL.SingleModel.GetListByCache(model[0].Id, (int)AttachmentItemType.小程序官网首页轮播图, true);
                if (imgs != null && imgs.Count > 0)
                {
                    List <object> imgurl = new List <object>();
                    foreach (C_Attachment item in imgs)
                    {
                        imgurl.Add(new { id = item.id, url = item.filepath });
                    }
                    ViewBag.ImgUrlList = imgurl;
                }

                return(View(model[0]));
            }

            return(View(new Moduls()
            {
                appId = listtemp.Id, Level = Level
            }));
        }