diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs index c0dc81a..2757a7f 100644 --- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs +++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs @@ -51,6 +51,10 @@ namespace CoreCms.Net.Configuration /// public const string ShopDefaultImage = "shopDefaultImage"; + /// + /// 默认图 + /// + public const string UserDefaultImage = "userDefaultImage"; /// /// 商家手机号 /// diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs index 6491dc2..10145e9 100644 --- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs +++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs @@ -34,7 +34,8 @@ namespace CoreCms.Net.Configuration di.Add(SystemSettingConstVars.ShopBeiAn, new DictionaryKeyValues() { sKey = "备案信息", sValue = "网站备案信息" }); di.Add(SystemSettingConstVars.ShopLogo, new DictionaryKeyValues() { sKey = "平台logo", sValue = "" }); di.Add(SystemSettingConstVars.ShopFavicon, new DictionaryKeyValues() { sKey = "Favicon图标", sValue = "" }); - di.Add(SystemSettingConstVars.ShopDefaultImage, new DictionaryKeyValues() { sKey = "默认图", sValue = "" }); + di.Add(SystemSettingConstVars.ShopDefaultImage, new DictionaryKeyValues() { sKey = "首页背景图", sValue = "" }); + di.Add(SystemSettingConstVars.UserDefaultImage, new DictionaryKeyValues() { sKey = "用户默认头像", sValue = "" }); di.Add(SystemSettingConstVars.StoreSwitch, new DictionaryKeyValues() { sKey = "开启门店自提", sValue = "2" }); di.Add(SystemSettingConstVars.CateStyle, new DictionaryKeyValues() { sKey = "分类样式", sValue = "3" }); di.Add(SystemSettingConstVars.CateType, new DictionaryKeyValues() { sKey = "H5分类样式", sValue = "1" }); diff --git a/CoreCms.Net.Model/Entities/Article/CoreCmsArticlePartial.cs b/CoreCms.Net.Model/Entities/Article/CoreCmsArticlePartial.cs index 34969b7..372a865 100644 --- a/CoreCms.Net.Model/Entities/Article/CoreCmsArticlePartial.cs +++ b/CoreCms.Net.Model/Entities/Article/CoreCmsArticlePartial.cs @@ -20,27 +20,27 @@ namespace CoreCms.Net.Model.Entities public partial class CoreCmsArticle { - /// - /// 文章分类 - /// - [SugarColumn(IsIgnore = true)] + ///// + ///// 文章分类 + ///// + //[SugarColumn(IsIgnore = true)] - public CoreCmsArticleType articleType { get; set; } + //public CoreCmsArticleType articleType { get; set; } - /// - /// 上一篇 - /// - [SugarColumn(IsIgnore = true)] + ///// + ///// 上一篇 + ///// + //[SugarColumn(IsIgnore = true)] - public CoreCmsArticle upArticle { get; set; } + //public CoreCmsArticle upArticle { get; set; } - /// - /// 下一篇 - /// - [SugarColumn(IsIgnore = true)] + ///// + ///// 下一篇 + ///// + //[SugarColumn(IsIgnore = true)] - public CoreCmsArticle downArticle { get; set; } + //public CoreCmsArticle downArticle { get; set; } } } diff --git a/CoreCms.Net.Repository/Article/CoreCmsArticleRepository.cs b/CoreCms.Net.Repository/Article/CoreCmsArticleRepository.cs index 155755a..6a9c90d 100644 --- a/CoreCms.Net.Repository/Article/CoreCmsArticleRepository.cs +++ b/CoreCms.Net.Repository/Article/CoreCmsArticleRepository.cs @@ -49,40 +49,40 @@ namespace CoreCms.Net.Repository article.contentBody = article.contentBody.Replace("oembed url=", "video width=\"100%\" controls=\"controls\" src="); article.contentBody = article.contentBody.Replace("/oembed", "/video"); - if (article.typeId > 0) - { - article.articleType = await DbClient.Queryable().InSingleAsync(article.typeId); - } - //上一篇 - article.upArticle = await DbClient.Queryable().Where(p => p.id < article.id && p.isPub == true).Select(p => new CoreCmsArticle - { - id = p.id, - title = p.title, - brief = p.brief, - coverImage = p.coverImage, - typeId = p.typeId, - sort = p.sort, - isPub = p.isPub, - isDel = p.isDel, - pv = p.pv, - createTime = p.createTime, - updateTime = p.updateTime - }).FirstAsync(); - //下一篇 - article.downArticle = await DbClient.Queryable().Where(p => p.id > article.id && p.isPub == true).Select(p => new CoreCmsArticle - { - id = p.id, - title = p.title, - brief = p.brief, - coverImage = p.coverImage, - typeId = p.typeId, - sort = p.sort, - isPub = p.isPub, - isDel = p.isDel, - pv = p.pv, - createTime = p.createTime, - updateTime = p.updateTime - }).FirstAsync(); + //if (article.typeId > 0) + //{ + // article.articleType = await DbClient.Queryable().InSingleAsync(article.typeId); + //} + ////上一篇 + //article.upArticle = await DbClient.Queryable().Where(p => p.id < article.id && p.isPub == true).Select(p => new CoreCmsArticle + //{ + // id = p.id, + // title = p.title, + // brief = p.brief, + // coverImage = p.coverImage, + // typeId = p.typeId, + // sort = p.sort, + // isPub = p.isPub, + // isDel = p.isDel, + // pv = p.pv, + // createTime = p.createTime, + // updateTime = p.updateTime + //}).FirstAsync(); + ////下一篇 + //article.downArticle = await DbClient.Queryable().Where(p => p.id > article.id && p.isPub == true).Select(p => new CoreCmsArticle + //{ + // id = p.id, + // title = p.title, + // brief = p.brief, + // coverImage = p.coverImage, + // typeId = p.typeId, + // sort = p.sort, + // isPub = p.isPub, + // isDel = p.isDel, + // pv = p.pv, + // createTime = p.createTime, + // updateTime = p.updateTime + //}).FirstAsync(); await DbClient.Updateable().SetColumns(p => p.pv == (p.pv + 1)).Where(p => p.id == article.id).ExecuteCommandAsync(); diff --git a/CoreCms.Net.Web.Admin/appsettings.json b/CoreCms.Net.Web.Admin/appsettings.json index 508ae8f..2e84aa5 100644 --- a/CoreCms.Net.Web.Admin/appsettings.json +++ b/CoreCms.Net.Web.Admin/appsettings.json @@ -22,7 +22,7 @@ "UseCache": true, //启用redis作为内存选择 "UseTimedTask": true, //启用redis作为定时任务 // 如果采用容器化部署Service 要写成redis的服务名,否则写地址 - "ConnectionString": "192.168.195.8:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=10" //redis数据库连接字符串 + "ConnectionString": "192.168.195.8:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=9" //redis数据库连接字符串 }, //jwt授权认证的一些设置 "JwtConfig": { diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html index fdca10d..75f3d3a 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html @@ -115,7 +115,19 @@ - + + {{d.data.configs['userDefaultImage']['sKey']}}: + + + + 上传图片 + + + + + + + {{d.data.configs['shopBeiAn']['sKey']}}: @@ -477,6 +489,27 @@ } }); }); + //系统默认图 + $('#upUserImageBtn').click(function () { + cropperImg.cropImg({ + aspectRatio: 1 / 1, + imgSrc: $('#viewUserImgBox').attr('src'), + onCrop: function (data) { + var loadIndex = layer.load(2); + coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) { + if (0 === res.code) { + $('#viewUserImgBox').attr('src', res.data.fileUrl); + $("#userDefaultImage").val(res.data.fileUrl); + layer.msg(res.msg); + layer.close(loadIndex); + } else { + layer.close(loadIndex); + layer.msg(res.msg, { icon: 2, anim: 6 }); + } + }); + } + }); + }); //logo $('#upLogoBtn').click(function () { cropperImg.cropImg({ diff --git a/CoreCms.Net.Web.WebApi/Controllers/ArticleController.cs b/CoreCms.Net.Web.WebApi/Controllers/ArticleController.cs index c158c17..1e32b6a 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/ArticleController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/ArticleController.cs @@ -10,11 +10,14 @@ using System.Linq; using System.Threading.Tasks; + using CoreCms.Net.Auth.HttpContextUser; using CoreCms.Net.IServices; using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.ViewModels.UI; + using Microsoft.AspNetCore.Mvc; + using SqlSugar; namespace CoreCms.Net.Web.WebApi.Controllers @@ -105,14 +108,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers /// /// 获取单个文章内容 /// - /// + /// /// - [HttpPost] - public async Task GetArticleDetail([FromBody] FMIntId entity) + [HttpGet] + public async Task GetArticleDetail([FromQuery] int id) { var jm = new WebApiCallBack(); - var model = await _articleServices.ArticleDetail(entity.id); + var model = await _articleServices.ArticleDetail(id); if (model == null) { jm.msg = "数据获取失败"; diff --git a/CoreCms.Net.Web.WebApi/Doc.xml b/CoreCms.Net.Web.WebApi/Doc.xml index 34e529d..e678ff9 100644 --- a/CoreCms.Net.Web.WebApi/Doc.xml +++ b/CoreCms.Net.Web.WebApi/Doc.xml @@ -121,11 +121,11 @@ - + 获取单个文章内容 - + diff --git a/CoreCms.Net.Web.WebApi/appsettings.json b/CoreCms.Net.Web.WebApi/appsettings.json index e1d6aaf..a3c3631 100644 --- a/CoreCms.Net.Web.WebApi/appsettings.json +++ b/CoreCms.Net.Web.WebApi/appsettings.json @@ -30,7 +30,7 @@ "UseCache": true, //启用redis作为内存选择 "UseTimedTask": true, //启用redis作为定时任务 // 如果采用容器化部署Service 要写成redis的服务名,否则写地址 - "ConnectionString": "192.168.195.8:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=10" //redis数据库连接字符串 + "ConnectionString": "192.168.195.8:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=9" //redis数据库连接字符串 }, //jwt授权认证的一些设置 "JwtConfig": {