This commit is contained in:
zpc 2025-09-07 16:54:44 +08:00
parent c170a42fd9
commit bbe07eefe6
9 changed files with 100 additions and 59 deletions

View File

@ -51,6 +51,10 @@ namespace CoreCms.Net.Configuration
/// </summary>
public const string ShopDefaultImage = "shopDefaultImage";
/// <summary>
/// 默认图
/// </summary>
public const string UserDefaultImage = "userDefaultImage";
/// <summary>
/// 商家手机号
/// </summary>

View File

@ -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" });

View File

@ -20,27 +20,27 @@ namespace CoreCms.Net.Model.Entities
public partial class CoreCmsArticle
{
/// <summary>
/// 文章分类
/// </summary>
[SugarColumn(IsIgnore = true)]
///// <summary>
///// 文章分类
///// </summary>
//[SugarColumn(IsIgnore = true)]
public CoreCmsArticleType articleType { get; set; }
//public CoreCmsArticleType articleType { get; set; }
/// <summary>
/// 上一篇
/// </summary>
[SugarColumn(IsIgnore = true)]
///// <summary>
///// 上一篇
///// </summary>
//[SugarColumn(IsIgnore = true)]
public CoreCmsArticle upArticle { get; set; }
//public CoreCmsArticle upArticle { get; set; }
/// <summary>
/// 下一篇
/// </summary>
[SugarColumn(IsIgnore = true)]
///// <summary>
///// 下一篇
///// </summary>
//[SugarColumn(IsIgnore = true)]
public CoreCmsArticle downArticle { get; set; }
//public CoreCmsArticle downArticle { get; set; }
}
}

View File

@ -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<CoreCmsArticleType>().InSingleAsync(article.typeId);
}
//上一篇
article.upArticle = await DbClient.Queryable<CoreCmsArticle>().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<CoreCmsArticle>().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<CoreCmsArticleType>().InSingleAsync(article.typeId);
//}
////上一篇
//article.upArticle = await DbClient.Queryable<CoreCmsArticle>().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<CoreCmsArticle>().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<CoreCmsArticle>().SetColumns(p => p.pv == (p.pv + 1)).Where(p => p.id == article.id).ExecuteCommandAsync();

View File

@ -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": {

View File

@ -115,7 +115,19 @@
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['userDefaultImage']['sKey']}}</label>
<div class="layui-input-inline layui-inline-6">
<input type="hidden" name="userDefaultImage" id="userDefaultImage" value="{{d.data.configs['userDefaultImage']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
<div class="layui-upload">
<button type="button" class="layui-btn" id="upUserImageBtn">上传图片</button>
<div class="layui-upload-list">
<img class="layui-upload-img" id="viewUserImgBox" src="{{d.data.configs['userDefaultImage']['sValue'] ? d.data.configs['userDefaultImage']['sValue']:'/static/images/common/empty.png'}}">
<p id="viewTextBox"></p>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['shopBeiAn']['sKey']}}</label>
<div class="layui-input-inline layui-inline-5">
@ -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({

View File

@ -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
/// <summary>
/// 获取单个文章内容
/// </summary>
/// <param name="entity"></param>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetArticleDetail([FromBody] FMIntId entity)
[HttpGet]
public async Task<WebApiCallBack> 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 = "数据获取失败";

View File

@ -121,11 +121,11 @@
</summary>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.ArticleController.GetArticleDetail(CoreCms.Net.Model.FromBody.FMIntId)">
<member name="M:CoreCms.Net.Web.WebApi.Controllers.ArticleController.GetArticleDetail(System.Int32)">
<summary>
获取单个文章内容
</summary>
<param name="entity"></param>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:CoreCms.Net.Web.WebApi.Controllers.CartController">

View File

@ -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": {