Пример #1
0
        /// <summary>
        /// 发布主题
        /// </summary>
        public void Theme_publish()
        {
            int        id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme model = B_Lebi_Theme.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            B_Lebi_Theme.BindForm(model);
            model.Path_Advert = model.Path_Files + "/advertment/";
            model.Path_Advert = model.Path_Advert.Replace("//", "/");
            string res = Shop.LebiAPI.Service.Instanse.Theme_Upload(model);

            Response.Write("{\"msg\":\"" + res + "\"}");
        }
Пример #2
0
        /// <summary>
        /// 编辑模板
        /// </summary>
        public void Theme_Edit()
        {
            int        id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme model = B_Lebi_Theme.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Theme();
            }
            B_Lebi_Theme.BindForm(model);
            model.ImageSmallUrl = model.ImageUrl.Replace("icon", "icon_small");
            if (model.LebiUser == "")
            {
                model.LebiUser = SYS.LicenseUserName;
            }
            model.Language          = RequestTool.RequestSafeString("Language");
            model.ImageBig_Height   = SYS.ImageBigHeight;
            model.ImageBig_Width    = SYS.ImageBigWidth;
            model.ImageSmall_Height = SYS.ImageSmallHeight;
            model.ImageSmall_Width  = SYS.ImageSmallWidth;
            model.Path_Files        = RequestTool.RequestString("Path_Files");
            model.Path_CSS          = RequestTool.RequestString("Path_CSS");
            model.Path_Image        = RequestTool.RequestString("Path_Image");
            model.Path_JS           = RequestTool.RequestString("Path_JS");
            model.Path_Advert       = model.Path_Files + "/advertment/";
            model.Path_Files        = "/" + model.Path_Files.Trim('/');
            model.Path_CSS          = "/" + model.Path_CSS.Trim('/');
            model.Path_Image        = "/" + model.Path_Image.Trim('/');
            model.Path_JS           = "/" + model.Path_JS.Trim('/');
            model.IsUpdate          = RequestTool.RequestInt("IsUpdate");
            if (model.id == 0)
            {
                if (!EX_Admin.Power("theme_add", "添加模板"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme.Add(model);
                id = B_Lebi_Theme.GetMaxId();
                //model.Code = SYS.LicenseUserName + "_" + id;
                model.Code = DateTime.Now.ToString("yyMMddssfff");
                model.id   = id;
                B_Lebi_Theme.Update(model);
                Log.Add("添加模板", "Theme", id.ToString(), CurrentAdmin, model.Name);
            }
            else
            {
                if (!EX_Admin.Power("theme_edit", "编辑模板"))
                {
                    AjaxNoPower();
                    return;
                }
                if (model.Code == "")
                {
                    model.Code = DateTime.Now.ToString("yyMMddssfff");
                }
                //model.Code = SYS.LicenseUserName + "_" + id;
                B_Lebi_Theme.Update(model);
                Log.Add("编辑模板", "Theme", id.ToString(), CurrentAdmin, model.Name);
            }
            string Language_ids = RequestTool.RequestString("Language_ids");

            if (Language_ids != "")
            {
                List <Lebi_Language> langs = B_Lebi_Language.GetList("id in (lbsql{" + Language_ids + "})", "");
                foreach (Lebi_Language lang in langs)
                {
                    lang.Theme_id = id;
                    B_Lebi_Language.Update(lang);
                }
            }
            Language.UpdteImageSize();
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }