Merge branch 'master' into dev
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
@@ -308,3 +308,8 @@ COMCMS.Web/wwwroot/userfiles/
|
||||
/COMCMS.Web/UploadFile
|
||||
/COMCMS.Web/UploadTemp
|
||||
/WebTest/wwwroot
|
||||
COMCMS.Web/wwwroot/install.lock
|
||||
|
||||
|
||||
# others
|
||||
.cursorrules
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.Core" Version="8.6.2020.204" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.104.1" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.104.1" />
|
||||
<PackageReference Include="NewLife.Core" Version="11.5.2025.501" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.22.0" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.23.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -950,10 +950,11 @@ namespace COMCMS.API.Weixin.Common
|
||||
/// </summary>
|
||||
public long ConvertDateTimeInt(System.DateTime time)
|
||||
{
|
||||
long intResult = 0;
|
||||
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
||||
intResult = (long)(time - startTime).TotalSeconds;
|
||||
return intResult;
|
||||
//long intResult = 0;
|
||||
|
||||
//System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
||||
//intResult = (long)(time - startTime).TotalSeconds;
|
||||
return long.Parse(Utils.GetTimeStamp());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
//比如MessageHandler<MessageContext>.GlobalGlobalMessageContext.ExpireMinutes = 3。
|
||||
GlobalMessageContext.ExpireMinutes = 3;
|
||||
|
||||
OnlyAllowEcryptMessage = true;//是否只允许接收加密消息,默认为 false
|
||||
//OnlyAllowEcryptMessage = true;//是否只允许接收加密消息,默认为 false
|
||||
|
||||
if (!string.IsNullOrEmpty(postModel.AppId))
|
||||
{
|
||||
@@ -189,17 +189,25 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnLocationRequestAsync(RequestMessageLocation requestMessage)
|
||||
{
|
||||
var locationService = new LocationService();
|
||||
var responseMessage = locationService.GetResponseMessage(requestMessage as RequestMessageLocation);
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var locationService = new LocationService();
|
||||
var responseMessage = locationService.GetResponseMessage(requestMessage as RequestMessageLocation);
|
||||
return responseMessage;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override async Task<IResponseMessageBase> OnShortVideoRequestAsync(RequestMessageShortVideo requestMessage)
|
||||
{
|
||||
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "您刚才发送的是小视频";
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "您刚才发送的是小视频";
|
||||
return responseMessage;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -228,14 +236,21 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
PicUrl = requestMessage.PicUrl,
|
||||
Url = "https://sdk.weixin.senparc.com"
|
||||
});
|
||||
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
//return responseMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageImage>();
|
||||
responseMessage.Image.MediaId = requestMessage.MediaId;
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
//return responseMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,8 +283,11 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
catch
|
||||
{
|
||||
}
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// 处理视频请求
|
||||
@@ -295,7 +313,7 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
// if (task.Exception != null)
|
||||
// {
|
||||
// WeixinTrace.Log("OnVideoRequest()储存Video过程发生错误:", task.Exception.Message);
|
||||
|
||||
|
||||
|
||||
// var msg = string.Format("上传素材出错:{0}\r\n{1}",
|
||||
// task.Exception.Message,
|
||||
@@ -307,8 +325,10 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
//});
|
||||
|
||||
#endregion
|
||||
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,7 +343,10 @@ namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
Title:{0}
|
||||
Description:{1}
|
||||
Url:{2}", requestMessage.Title, requestMessage.Description, requestMessage.Url);
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
public override async Task<IResponseMessageBase> OnFileRequestAsync(RequestMessageFile requestMessage)
|
||||
@@ -334,7 +357,10 @@ Url:{2}", requestMessage.Title, requestMessage.Description, requestMessage.Url);
|
||||
说明:{1}
|
||||
大小:{2}
|
||||
MD5:{3}", requestMessage.Title, requestMessage.Description, requestMessage.FileTotalLen, requestMessage.FileMd5);
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -362,7 +388,10 @@ MD5:{3}", requestMessage.Title, requestMessage.Description, requestMessage.FileT
|
||||
XTrace.WriteLine("未知请求消息类型", requestMessage.RequestDocument.ToString());
|
||||
//WeixinTrace.SendCustomLog("未知请求消息类型", requestMessage.RequestDocument.ToString());//记录到日志中
|
||||
|
||||
return responseMessage;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
-15
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
@@ -23,15 +25,18 @@ namespace COMCMS.Common
|
||||
encryptKey = GetSubString(encryptKey, 0, 32, "");
|
||||
encryptKey = encryptKey.PadRight(32, ' ');
|
||||
|
||||
RijndaelManaged rijndaelProvider = new RijndaelManaged();
|
||||
rijndaelProvider.Key = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 32));
|
||||
rijndaelProvider.IV = Keys;
|
||||
ICryptoTransform rijndaelEncrypt = rijndaelProvider.CreateEncryptor();
|
||||
|
||||
byte[] inputData = Encoding.UTF8.GetBytes(encryptString);
|
||||
byte[] encryptedData = rijndaelEncrypt.TransformFinalBlock(inputData, 0, inputData.Length);
|
||||
|
||||
return Convert.ToBase64String(encryptedData);
|
||||
using Aes aes = Aes.Create();
|
||||
aes.Key = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 32));
|
||||
aes.IV = Keys;
|
||||
|
||||
using MemoryStream ms = new MemoryStream();
|
||||
using CryptoStream cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write);
|
||||
|
||||
cs.Write(inputData, 0, inputData.Length);
|
||||
cs.FlushFinalBlock();
|
||||
return Convert.ToBase64String(ms.ToArray());
|
||||
}
|
||||
/// <summary>
|
||||
/// 解密
|
||||
@@ -46,15 +51,20 @@ namespace COMCMS.Common
|
||||
decryptKey = GetSubString(decryptKey, 0, 32, "");
|
||||
decryptKey = decryptKey.PadRight(32, ' ');
|
||||
|
||||
RijndaelManaged rijndaelProvider = new RijndaelManaged();
|
||||
rijndaelProvider.Key = Encoding.UTF8.GetBytes(decryptKey);
|
||||
rijndaelProvider.IV = Keys;
|
||||
ICryptoTransform rijndaelDecrypt = rijndaelProvider.CreateDecryptor();
|
||||
|
||||
byte[] inputData = Convert.FromBase64String(decryptString);
|
||||
byte[] decryptedData = rijndaelDecrypt.TransformFinalBlock(inputData, 0, inputData.Length);
|
||||
|
||||
return Encoding.UTF8.GetString(decryptedData);
|
||||
using Aes aes = Aes.Create();
|
||||
aes.Key = Encoding.UTF8.GetBytes(decryptKey);
|
||||
aes.IV = Keys;
|
||||
|
||||
using MemoryStream ms = new MemoryStream();
|
||||
using CryptoStream cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
|
||||
|
||||
cs.Write(inputData, 0, inputData.Length);
|
||||
cs.FlushFinalBlock();
|
||||
|
||||
|
||||
return Encoding.UTF8.GetString(ms.ToArray());
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="NewLife.Core" Version="8.4.2019.1212" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NewLife.Core" Version="11.5.2025.501" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.QrCode" Version="0.7.0" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace COMCMS.Common
|
||||
{
|
||||
Expires = DateTime.Now.AddMinutes(expires),
|
||||
Path = "/",
|
||||
HttpOnly = true
|
||||
HttpOnly = true,
|
||||
SameSite = SameSiteMode.Lax
|
||||
};
|
||||
MyHttpContext.Current.Response.Cookies.Append(strName, strValue, op);//用户名
|
||||
}
|
||||
@@ -56,7 +57,14 @@ namespace COMCMS.Common
|
||||
/// <param name="strKey"></param>
|
||||
public static void ClearCookies(string strKey)
|
||||
{
|
||||
MyHttpContext.Current.Response.Cookies.Delete(strKey);
|
||||
CookieOptions op = new CookieOptions
|
||||
{
|
||||
Expires = DateTime.Now.AddMinutes(-1),
|
||||
Path = "/",
|
||||
HttpOnly = true,
|
||||
SameSite = SameSiteMode.Lax
|
||||
};
|
||||
MyHttpContext.Current.Response.Cookies.Delete(strKey, op);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
+11
-10
@@ -38,22 +38,16 @@ namespace COMCMS.Common
|
||||
StringBuilder strPage = new StringBuilder();
|
||||
string pageLink = "";// url + "?id=" + HttpContext.Current.Request.QueryString["id"] + "&page={0}";
|
||||
string strQueryString = MyHttpContext.Current.Request.QueryString.ToString().ToLower();
|
||||
if (isRewrite != 5)
|
||||
if (isRewrite != 5 && isRewrite != 99)
|
||||
url = url.ToLower();
|
||||
pageLink = url + "?" + strQueryString;
|
||||
string currPage = MyHttpContext.Current.Request.Query["page"];
|
||||
string id = MyHttpContext.Current.Request.Query["id"];
|
||||
|
||||
if (isRewrite == 5)
|
||||
{
|
||||
url = $"/{filepath}/index.html";
|
||||
}
|
||||
if (url == "memberdownloads.aspx" && isRewrite == 2)
|
||||
{
|
||||
string t = MyHttpContext.Current.Request.Query["t"];
|
||||
if (string.IsNullOrEmpty(t) || !Utils.IsInt(t))
|
||||
t = "1";
|
||||
url = string.Format("memberdownloads-{0}.aspx", t);
|
||||
}
|
||||
|
||||
switch (isRewrite)
|
||||
{
|
||||
@@ -71,8 +65,15 @@ namespace COMCMS.Common
|
||||
pageLink = url.Replace(".", "-{0}.");
|
||||
break;
|
||||
case 3:
|
||||
url = url.Replace(".aspx", ".html");//避免设置错之后出现问题
|
||||
pageLink = url.Replace(".", "-{0}.");
|
||||
if(url.EndsWith(".html") || url.EndsWith(".aspx"))
|
||||
{
|
||||
url = url.Replace(".aspx", ".html");//避免设置错之后出现问题
|
||||
pageLink = url.Replace(".", "-{0}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
pageLink = url + "?page={0}";
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
pageLink = url.Replace(".", "-{0}.");
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DrawingCore.Drawing2D;
|
||||
using System.DrawingCore.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Text;
|
||||
using System.DrawingCore;
|
||||
using System.Drawing;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using NewLife.Log;
|
||||
using SkiaSharp;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using System.Net.Http;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
@@ -22,11 +26,11 @@ namespace COMCMS.Common
|
||||
/// <summary>
|
||||
/// 程序绝对目录
|
||||
/// </summary>
|
||||
private static string _ContentRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().ContentRootPath;
|
||||
private static string _ContentRootPath = Environment.CurrentDirectory;
|
||||
/// <summary>
|
||||
/// 静态文件
|
||||
/// </summary>
|
||||
private static string _WebRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().WebRootPath;
|
||||
private static string _WebRootPath = _ContentRootPath + DirectorySeparatorChar + "wwwroot" + DirectorySeparatorChar;
|
||||
|
||||
#region 方式
|
||||
public enum CutMode
|
||||
@@ -61,7 +65,8 @@ namespace COMCMS.Common
|
||||
/// <param name="mode">生成缩略图的方式</param>
|
||||
public static void MakeThumbnailImage(string fileName, string newFileName, int width, int height, CutMode mode)
|
||||
{
|
||||
Image originalImage = Image.FromFile(fileName);
|
||||
//Image originalImage = Image.FromFile(fileName);
|
||||
var originalImage = SKBitmap.Decode(fileName);
|
||||
int towidth = width;
|
||||
int toheight = height;
|
||||
|
||||
@@ -114,91 +119,70 @@ namespace COMCMS.Common
|
||||
break;
|
||||
}
|
||||
|
||||
//新建一个bmp图片
|
||||
Bitmap b = new Bitmap(towidth, toheight);
|
||||
try
|
||||
{
|
||||
//新建一个画板
|
||||
Graphics g = Graphics.FromImage(b);
|
||||
//设置高质量插值法
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
//设置高质量,低速度呈现平滑程度
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
//清空画布并以透明背景色填充
|
||||
g.Clear(Color.White);
|
||||
//g.Clear(Color.Transparent);
|
||||
//在指定位置并且按指定大小绘制原图片的指定部分
|
||||
g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
|
||||
|
||||
SaveImage(b, newFileName, GetCodecInfo("image/" + GetFormat(newFileName).ToString().ToLower()));
|
||||
}
|
||||
catch (System.Exception e)
|
||||
var newImg = originalImage.Resize(new SKSizeI(towidth, toheight), SKFilterQuality.Medium);
|
||||
using var fs = new FileStream(newFileName, FileMode.Create);
|
||||
//判断类型
|
||||
SKEncodedImageFormat imgType = new SKEncodedImageFormat();
|
||||
string sFullExtension = Utils.GetFileExtName(fileName).ToLower();//扩展名
|
||||
switch (sFullExtension)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
originalImage.Dispose();
|
||||
b.Dispose();
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
imgType = SKEncodedImageFormat.Jpeg;
|
||||
break;
|
||||
case ".png":
|
||||
imgType = SKEncodedImageFormat.Png;
|
||||
break;
|
||||
case ".gif":
|
||||
imgType = SKEncodedImageFormat.Gif;
|
||||
break;
|
||||
case ".webp":
|
||||
imgType = SKEncodedImageFormat.Webp;
|
||||
break;
|
||||
case ".bmp":
|
||||
imgType = SKEncodedImageFormat.Bmp;
|
||||
break;
|
||||
default:
|
||||
imgType = SKEncodedImageFormat.Png;
|
||||
break;
|
||||
}
|
||||
newImg.Encode(fs, imgType, 100);
|
||||
fs.Flush();
|
||||
|
||||
//新建一个bmp图片
|
||||
//Bitmap b = new Bitmap(towidth, toheight);
|
||||
//try
|
||||
//{
|
||||
// //新建一个画板
|
||||
// Graphics g = Graphics.FromImage(b);
|
||||
// //设置高质量插值法
|
||||
// g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
// //设置高质量,低速度呈现平滑程度
|
||||
// g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
// g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
// //清空画布并以透明背景色填充
|
||||
// g.Clear(Color.White);
|
||||
// //g.Clear(Color.Transparent);
|
||||
// //在指定位置并且按指定大小绘制原图片的指定部分
|
||||
// g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
|
||||
|
||||
// SaveImage(b, newFileName, GetCodecInfo("image/" + GetFormat(newFileName).ToString().ToLower()));
|
||||
//}
|
||||
//catch (System.Exception e)
|
||||
//{
|
||||
// throw e;
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
// originalImage.Dispose();
|
||||
// b.Dispose();
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 帮助方法
|
||||
/// <summary>
|
||||
/// 保存图片
|
||||
/// </summary>
|
||||
/// <param name="image">Image 对象</param>
|
||||
/// <param name="savePath">保存路径</param>
|
||||
/// <param name="ici">指定格式的编解码参数</param>
|
||||
private static void SaveImage(Image image, string savePath, ImageCodecInfo ici)
|
||||
{
|
||||
//设置 原图片 对象的 EncoderParameters 对象
|
||||
EncoderParameters parameters = new EncoderParameters(1);
|
||||
parameters.Param[0] = new EncoderParameter(System.DrawingCore.Imaging.Encoder.Quality, ((long)100));
|
||||
image.Save(savePath, ici, parameters);
|
||||
parameters.Dispose();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取图像编码解码器的所有相关信息
|
||||
/// </summary>
|
||||
/// <param name="mimeType">包含编码解码器的多用途网际邮件扩充协议 (MIME) 类型的字符串</param>
|
||||
/// <returns>返回图像编码解码器的所有相关信息</returns>
|
||||
private static ImageCodecInfo GetCodecInfo(string mimeType)
|
||||
{
|
||||
ImageCodecInfo[] CodecInfo = ImageCodecInfo.GetImageEncoders();
|
||||
foreach (ImageCodecInfo ici in CodecInfo)
|
||||
{
|
||||
if (ici.MimeType == mimeType)
|
||||
return ici;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 得到图片格式
|
||||
/// </summary>
|
||||
/// <param name="name">文件名称</param>
|
||||
/// <returns></returns>
|
||||
public static ImageFormat GetFormat(string name)
|
||||
{
|
||||
string ext = name.Substring(name.LastIndexOf(".") + 1);
|
||||
switch (ext.ToLower())
|
||||
{
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return ImageFormat.Jpeg;
|
||||
case "bmp":
|
||||
return ImageFormat.Bmp;
|
||||
case "png":
|
||||
return ImageFormat.Png;
|
||||
case "gif":
|
||||
return ImageFormat.Gif;
|
||||
default:
|
||||
return ImageFormat.Jpeg;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 内容远程保存图片
|
||||
@@ -212,8 +196,8 @@ namespace COMCMS.Common
|
||||
string recontent = content;
|
||||
if (string.IsNullOrEmpty(content))
|
||||
return "";
|
||||
WebClient client = new WebClient();
|
||||
|
||||
//WebClient client = new WebClient();
|
||||
var _httpClient = new HttpClient();
|
||||
Regex reg = new Regex("IMG[^>]*?src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|'(?<1>[^\']*)')", RegexOptions.IgnoreCase);
|
||||
MatchCollection m = reg.Matches(content);
|
||||
foreach (Match math in m)
|
||||
@@ -231,7 +215,7 @@ namespace COMCMS.Common
|
||||
else if (imgsrc.EndsWith("jpeg")) ext = "jpeg";
|
||||
else if (imgsrc.EndsWith("bmp")) ext = "bmp";
|
||||
string strNewImgName = Utils.GetOrderNum() + "." + ext;
|
||||
string savepath = $"{_WebRootPath}\\userfiles\\images\\auto\\{DateTime.Now.Year.ToString()}\\{DateTime.Now.ToString("MM")}";//
|
||||
string savepath = $"{_WebRootPath}{DirectorySeparatorChar}userfiles{DirectorySeparatorChar}images{DirectorySeparatorChar}auto{DirectorySeparatorChar}{DateTime.Now.Year.ToString()}\\{DateTime.Now.ToString("MM")}";//
|
||||
string imgNewSrc = $"/userfiles/images/auto/{DateTime.Now.Year.ToString()}/{DateTime.Now.ToString("MM")}/{strNewImgName}";//保存后路径
|
||||
//判断路径
|
||||
if (!Directory.Exists(savepath))
|
||||
@@ -239,8 +223,13 @@ namespace COMCMS.Common
|
||||
string fullpath = Path.Combine(savepath, strNewImgName);//图片
|
||||
try
|
||||
{
|
||||
System.IO.FileStream fs;
|
||||
byte[] urlContents = _httpClient.GetByteArrayAsync(imgUrl).Result;
|
||||
fs = new System.IO.FileStream(fullpath, FileMode.CreateNew);
|
||||
fs.Write(urlContents, 0, urlContents.Length);
|
||||
//保存图片
|
||||
client.DownloadFile(imgUrl, fullpath);
|
||||
//client.DownloadFile(imgUrl, fullpath);
|
||||
//_httpClient
|
||||
recontent = recontent.Replace(imgUrl, imgNewSrc);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
+301
-115
@@ -12,6 +12,9 @@ using Microsoft.Extensions.Configuration.Json;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using NewLife.Caching;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
@@ -63,7 +66,18 @@ namespace COMCMS.Common
|
||||
/// <summary>
|
||||
/// 与小程序验签的盐值
|
||||
/// </summary>
|
||||
public static readonly string SIGNSALT = "comcms";// ConfigurationManager.AppSettings["SignSalt"];
|
||||
public static string SIGNSALT
|
||||
{
|
||||
get
|
||||
{
|
||||
string strPrefixKey = Configuration["SystemSetting:SignSalt"];
|
||||
if (string.IsNullOrEmpty(strPrefixKey))
|
||||
{
|
||||
strPrefixKey = "comcms";
|
||||
}
|
||||
return strPrefixKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -104,6 +118,11 @@ namespace COMCMS.Common
|
||||
/// </summary>
|
||||
Home=99
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 内存缓存
|
||||
/// </summary>
|
||||
public static ICache MemoryCahce { get; set; } = Cache.Default;
|
||||
#endregion
|
||||
|
||||
#region 验证部分
|
||||
@@ -138,6 +157,15 @@ namespace COMCMS.Common
|
||||
//A-Z, a-z, 0-9, -, /, =
|
||||
return Regex.IsMatch(str, @"[A-Za-z0-9-\/]");
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断静态化文件名是否正确
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ChekHTMLFileNameIsOK(string filename)
|
||||
{
|
||||
return Regex.IsMatch(filename, @"^(?!index\b)[a-zA-Z0-9-]+(\.html)$");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证对象是否为货币格式
|
||||
@@ -181,6 +209,10 @@ namespace COMCMS.Common
|
||||
{
|
||||
http = "https://";
|
||||
}
|
||||
if (MyHttpContext.Current.Request.Headers["X-Scheme"].ToString() == "https")//增加判断反向代理
|
||||
{
|
||||
http = "https://";
|
||||
}
|
||||
string port = MyHttpContext.Current.Request.Host.Port.ToString();
|
||||
if (string.IsNullOrEmpty(port) || port == "80" || port == "443")
|
||||
return http + MyHttpContext.Current.Request.Host.Host;
|
||||
@@ -217,7 +249,7 @@ namespace COMCMS.Common
|
||||
{
|
||||
if (str.Length != 11)
|
||||
return false;
|
||||
return Regex.IsMatch(str, @"^1[3|4|5|7|8|9][0-9]\d{4,8}$");
|
||||
return Regex.IsMatch(str, @"^1[3|4|5|6|7|8|9][0-9]\d{4,8}$");
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否为ip
|
||||
@@ -345,6 +377,213 @@ namespace COMCMS.Common
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为日期型字符串
|
||||
/// </summary>
|
||||
/// <param name="StrSource">日期字符串(2008-05-08)</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDate(string StrSource)
|
||||
{
|
||||
return Regex.IsMatch(StrSource, @"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-9]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$");
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否为日期+时间型字符串
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDateTime(string StrSource)
|
||||
{
|
||||
return Regex.IsMatch(StrSource, @"^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$");
|
||||
}
|
||||
/// <summary>
|
||||
/// 正则手机型号
|
||||
/// </summary>
|
||||
private static readonly Regex RegexMobile =
|
||||
new Regex(@"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
/// <summary>
|
||||
/// 通过UserAgent 判断是否是移动端
|
||||
/// </summary>
|
||||
/// <param name="userAgent"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMobileRequest(string userAgent)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(userAgent) && RegexMobile.IsMatch(userAgent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取用户浏览器
|
||||
/// </summary>
|
||||
/// <param name="userAgent"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetBrowser(string userAgent)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userAgent))
|
||||
{
|
||||
return "未知";
|
||||
}
|
||||
userAgent = userAgent.ToLower();
|
||||
|
||||
if (userAgent.Contains("opera/ucweb"))
|
||||
{ return "UC Opera"; }
|
||||
else if (userAgent.Contains("openwave/ ucweb"))
|
||||
{ return "UCOpenwave"; }
|
||||
else if (userAgent.Contains("microMessenger"))
|
||||
{ return "微信浏览器"; }
|
||||
else if (userAgent.Contains("ucweb"))
|
||||
{ return "UC"; }
|
||||
else if (userAgent.Contains("360se"))
|
||||
{ return "360"; }
|
||||
else if (userAgent.Contains("metasr"))
|
||||
{ return "搜狗"; }
|
||||
else if (userAgent.Contains("maxthon"))
|
||||
{ return "遨游"; }
|
||||
else if (userAgent.Contains("the world"))
|
||||
{ return "世界之窗"; }
|
||||
else if (userAgent.Contains("tencenttraveler") || userAgent.Contains("qqbrowser"))
|
||||
{ return "腾讯"; }
|
||||
else if (userAgent.Contains("edge"))
|
||||
{ return "Edge"; }
|
||||
else if (userAgent.Contains("edg"))
|
||||
{ return "Microsoft Edge"; }
|
||||
else if (userAgent.Contains("chrome"))
|
||||
{ return "Chrome"; }
|
||||
else if (userAgent.Contains("safari"))
|
||||
{ return "safari"; }
|
||||
else if (userAgent.Contains("firefox"))
|
||||
{ return "Firefox"; }
|
||||
else if (userAgent.Contains("opera"))
|
||||
{ return "Opera"; }
|
||||
else if (userAgent.Contains("msie"))
|
||||
{ return "IE"; }
|
||||
else
|
||||
{ return "未知"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取客户端操作系统版本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetOSName(string userAgent)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userAgent))
|
||||
{
|
||||
return "未知";
|
||||
}
|
||||
userAgent = userAgent.ToLower();
|
||||
|
||||
if (userAgent.Contains("android"))
|
||||
{ return "Android"; }
|
||||
else if (userAgent.Contains("mac os x"))
|
||||
{ return "ios"; }
|
||||
else if (userAgent.Contains("windows phone"))
|
||||
{ return "Windows Phone"; }
|
||||
else if (userAgent.Contains("nt 11.0"))
|
||||
{ return "Windows 11"; }
|
||||
else if (userAgent.Contains("nt 10.0"))
|
||||
{ return "Windows 10"; }
|
||||
else if (userAgent.Contains("NT 6.3"))
|
||||
{ return "Windows8.1"; }
|
||||
else if (userAgent.Contains("NT 6.2"))
|
||||
{ return "Windows8"; }
|
||||
else if (userAgent.Contains("nt 6.1"))
|
||||
{ return "Windows 7"; }
|
||||
else if (userAgent.Contains("nt 6.0"))
|
||||
{ return "Windows Vista/Server 2008"; }
|
||||
else if (userAgent.Contains("nt 5.2"))
|
||||
{ return "Windows Server 2003"; }
|
||||
else if (userAgent.Contains("nt 5.1"))
|
||||
{ return "Windows XP"; }
|
||||
else if (userAgent.Contains("nt 5"))
|
||||
{ return "Windows 2000"; }
|
||||
else if (userAgent.Contains("nt 4"))
|
||||
{ return "Windows NT4"; }
|
||||
else if (userAgent.Contains("me"))
|
||||
{ return "Windows Me"; }
|
||||
else if (userAgent.Contains("98"))
|
||||
{ return "Windows 98"; }
|
||||
else if (userAgent.Contains("95"))
|
||||
{ return "Windows 95"; }
|
||||
else if (userAgent.Contains("mac"))
|
||||
{ return "Mac"; }
|
||||
else if (userAgent.Contains("unix"))
|
||||
{ return "UNIX"; }
|
||||
else if (userAgent.Contains("linux"))
|
||||
{ return "Linux"; }
|
||||
else if (userAgent.Contains("sunos"))
|
||||
{ return "SunOS"; }
|
||||
|
||||
return "未知";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证密码强度
|
||||
/// 0:6位无要求
|
||||
/// 1:至少八个字符,至少一个字母和一个数字
|
||||
/// 2:至少八个字符,至少一个字母,一个数字和一个特殊字符
|
||||
/// 3:最少八个字符,至少一个大写字母,一个小写字母和一个数字
|
||||
/// 4:至少八个字符,至少一个大写字母,一个小写字母,一个数字和一个特殊字符
|
||||
/// </summary>
|
||||
/// <param name="password">密码</param>
|
||||
/// <param name="t">验证强度</param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckPasswordStrength(string password,int t)
|
||||
{
|
||||
if(t == 0)
|
||||
{
|
||||
if (password.Length < 6)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if(t== 1) // 至少八个字符,至少一个字母和一个数字
|
||||
{
|
||||
return Regex.IsMatch(password, @"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,20}$");
|
||||
}
|
||||
else if(t== 2)//至少八个字符,至少一个字母,一个数字和一个特殊字符
|
||||
{
|
||||
return Regex.IsMatch(password, @"^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,20}$");
|
||||
}
|
||||
else if (t ==3)//最少八个字符,至少一个大写字母,一个小写字母和一个数字
|
||||
{
|
||||
return Regex.IsMatch(password, @"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,20}$");
|
||||
}
|
||||
else //至少八个字符,至少一个大写字母,一个小写字母,一个数字和一个特殊字符
|
||||
{
|
||||
return Regex.IsMatch(password, @"^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,20}$");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取密码强度提示
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetPasswordStrengthTip(int t)
|
||||
{
|
||||
if (t == 0)
|
||||
{
|
||||
return "至少六个字符";
|
||||
}
|
||||
else if (t == 1) // 至少八个字符,至少一个字母和一个数字
|
||||
{
|
||||
return "至少八个字符,至少一个字母和一个数字";
|
||||
}
|
||||
else if (t == 2)//至少八个字符,至少一个字母,一个数字和一个特殊字符
|
||||
{
|
||||
return "至少八个字符,至少一个字母,一个数字和一个特殊字符";
|
||||
}
|
||||
else if (t == 3)//最少八个字符,至少一个大写字母,一个小写字母和一个数字
|
||||
{
|
||||
return "最少八个字符,至少一个大写字母,一个小写字母和一个数字";
|
||||
}
|
||||
else //至少八个字符,至少一个大写字母,一个小写字母,一个数字和一个特殊字符
|
||||
{
|
||||
return "至少八个字符,至少一个大写字母,一个小写字母,一个数字和一个特殊字符";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取部分
|
||||
@@ -731,6 +970,14 @@ namespace COMCMS.Common
|
||||
string xForwardedForAddress = MyHttpContext.Current.Request.Headers["X-Forwarded-For"];
|
||||
if (!string.IsNullOrEmpty(userHostAddress) && !string.IsNullOrEmpty(xForwardedForAddress) && userHostAddress != xForwardedForAddress)
|
||||
{
|
||||
if (xForwardedForAddress.IndexOf(",") > -1)
|
||||
{
|
||||
string[] arrIP = xForwardedForAddress.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (arrIP.Length > 1)
|
||||
{
|
||||
return arrIP[0].Trim();
|
||||
}
|
||||
}
|
||||
return xForwardedForAddress;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(userHostAddress) && Utils.IsIP(userHostAddress))
|
||||
@@ -820,6 +1067,53 @@ namespace COMCMS.Common
|
||||
return price;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前系统运行平台
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetOSPlatform()
|
||||
{
|
||||
string osPlatform = "Unknown";
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
osPlatform = "Windows";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
osPlatform = "Linux";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
osPlatform = "OSX";
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
|
||||
{
|
||||
osPlatform = "FreeBSD";
|
||||
}
|
||||
|
||||
return osPlatform;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IP转换成为long的地址
|
||||
/// </summary>
|
||||
/// <param name="ip"></param>
|
||||
/// <returns></returns>
|
||||
public static long GetLongIP(string ip)
|
||||
{
|
||||
if (!IsIP(ip))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
string[] s = ip.Split('.');
|
||||
long l0 = long.Parse(s[0]) << 24;
|
||||
long l1 = long.Parse(s[1]) << 16;
|
||||
long l2 = long.Parse(s[2]) << 8;
|
||||
long l3 = long.Parse(s[3]);
|
||||
|
||||
return l0 + l1 + l2 + l3;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 处理部分
|
||||
@@ -933,127 +1227,19 @@ namespace COMCMS.Common
|
||||
/// <returns></returns>
|
||||
public static string HttpGet(string url)
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
request.Method = "GET";
|
||||
//request.ContentType = "application/x-www-form-urlencoded";
|
||||
request.Accept = "*/*";
|
||||
request.Proxy = null;
|
||||
request.Timeout = 15000;
|
||||
request.AllowAutoRedirect = false;
|
||||
|
||||
WebResponse response = null;
|
||||
//使用webclient http get
|
||||
string responseStr = null;
|
||||
|
||||
try
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
response = request.GetResponse();
|
||||
|
||||
if (response != null)
|
||||
var re = client.GetAsync(url).Result;
|
||||
if (re.IsSuccessStatusCode)
|
||||
{
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
|
||||
responseStr = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
responseStr = re.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteException(ex);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
request = null;
|
||||
response = null;
|
||||
}
|
||||
|
||||
return responseStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后台发送POST请求
|
||||
/// </summary>
|
||||
/// <param name="url">服务器地址</param>
|
||||
/// <param name="data">发送的数据</param>
|
||||
/// <returns></returns>
|
||||
public static Stream HttpPost(string url, string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
//创建post请求
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/json;charset=UTF-8";
|
||||
byte[] payload = Encoding.UTF8.GetBytes(data);
|
||||
request.ContentLength = payload.Length;
|
||||
|
||||
|
||||
//发送post的请求
|
||||
Stream writer = request.GetRequestStream();
|
||||
writer.Write(payload, 0, payload.Length);
|
||||
writer.Close();
|
||||
|
||||
//接受返回来的数据
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
Stream stream = response.GetResponseStream();
|
||||
return stream;
|
||||
//StreamReader reader = new StreamReader(stream, Encoding.UTF8);
|
||||
//string value = reader.ReadToEnd();
|
||||
|
||||
//reader.Close();
|
||||
//stream.Close();
|
||||
//response.Close();
|
||||
|
||||
//return value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteException(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后台发送POST请求
|
||||
/// </summary>
|
||||
/// <param name="url">服务器地址</param>
|
||||
/// <param name="data">发送的数据</param>
|
||||
/// <returns></returns>
|
||||
public static string HttpPostAndReturnString(string url, string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
//创建post请求
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/json;charset=UTF-8";
|
||||
byte[] payload = Encoding.UTF8.GetBytes(data);
|
||||
request.ContentLength = payload.Length;
|
||||
|
||||
|
||||
//发送post的请求
|
||||
Stream writer = request.GetRequestStream();
|
||||
writer.Write(payload, 0, payload.Length);
|
||||
writer.Close();
|
||||
|
||||
//接受返回来的数据
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
Stream stream = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
|
||||
string value = reader.ReadToEnd();
|
||||
|
||||
reader.Close();
|
||||
stream.Close();
|
||||
response.Close();
|
||||
|
||||
return value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteException(ex);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将对象转换为Int32类型
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
using NewLife.Caching;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NewLife.Log;
|
||||
using SkiaSharp;
|
||||
using NewLife.Security;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
public sealed class VerifyCodeHelper
|
||||
{
|
||||
#region 单例模式
|
||||
//Session Key
|
||||
public readonly string SESSION_KEY = "comcms_verifycode";
|
||||
//创建私有化静态obj锁
|
||||
private static readonly object _ObjLock = new object();
|
||||
//创建私有静态字段,接收类的实例化对象
|
||||
private static VerifyCodeHelper _VerifyCodeHelper = null;
|
||||
//构造函数私有化
|
||||
private VerifyCodeHelper() { }
|
||||
//创建单利对象资源并返回
|
||||
public static VerifyCodeHelper GetSingleObj()
|
||||
{
|
||||
if (_VerifyCodeHelper == null)
|
||||
{
|
||||
lock (_ObjLock)
|
||||
{
|
||||
if (_VerifyCodeHelper == null)
|
||||
_VerifyCodeHelper = new VerifyCodeHelper();
|
||||
}
|
||||
}
|
||||
return _VerifyCodeHelper;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生产验证码
|
||||
public enum VerifyCodeType { NumberVerifyCode, AbcVerifyCode, MixVerifyCode };
|
||||
|
||||
/// <summary>
|
||||
/// 1.数字验证码
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
private string CreateNumberVerifyCode(int length)
|
||||
{
|
||||
int[] randMembers = new int[length];
|
||||
int[] validateNums = new int[length];
|
||||
string validateNumberStr = "";
|
||||
//生成起始序列值
|
||||
int seekSeek = unchecked((int)DateTime.Now.Ticks);
|
||||
Random seekRand = new Random(seekSeek);
|
||||
int beginSeek = seekRand.Next(0, Int32.MaxValue - length * 10000);
|
||||
int[] seeks = new int[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
beginSeek += 10000;
|
||||
seeks[i] = beginSeek;
|
||||
}
|
||||
//生成随机数字
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
Random rand = new Random(seeks[i]);
|
||||
int pownum = 1 * (int)Math.Pow(10, length);
|
||||
randMembers[i] = rand.Next(pownum, Int32.MaxValue);
|
||||
}
|
||||
//抽取随机数字
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
string numStr = randMembers[i].ToString();
|
||||
int numLength = numStr.Length;
|
||||
Random rand = new Random();
|
||||
int numPosition = rand.Next(0, numLength - 1);
|
||||
validateNums[i] = Int32.Parse(numStr.Substring(numPosition, 1));
|
||||
}
|
||||
//生成验证码
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
validateNumberStr += validateNums[i].ToString();
|
||||
}
|
||||
return validateNumberStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2.字母验证码
|
||||
/// </summary>
|
||||
/// <param name="length">字符长度</param>
|
||||
/// <returns>验证码字符</returns>
|
||||
private string CreateAbcVerifyCode(int length)
|
||||
{
|
||||
char[] verification = new char[length];
|
||||
char[] dictionary = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
|
||||
};
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
verification[i] = dictionary[random.Next(dictionary.Length - 1)];
|
||||
}
|
||||
return new string(verification);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 3.混合验证码
|
||||
/// </summary>
|
||||
/// <param name="length">字符长度</param>
|
||||
/// <returns>验证码字符</returns>
|
||||
private string CreateMixVerifyCode(int length)
|
||||
{
|
||||
char[] verification = new char[length];
|
||||
char[] dictionary = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
|
||||
};
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
verification[i] = dictionary[random.Next(dictionary.Length - 1)];
|
||||
}
|
||||
return new string(verification);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 产生验证码(随机产生4-6位)
|
||||
/// </summary>
|
||||
/// <param name="type">验证码类型:数字,字符,符合</param>
|
||||
/// <returns></returns>
|
||||
public string CreateVerifyCode(VerifyCodeType type)
|
||||
{
|
||||
string verifyCode = string.Empty;
|
||||
Random random = new Random();
|
||||
int length = random.Next(4, 6);
|
||||
switch (type)
|
||||
{
|
||||
case VerifyCodeType.NumberVerifyCode:
|
||||
verifyCode = GetSingleObj().CreateNumberVerifyCode(length);
|
||||
break;
|
||||
case VerifyCodeType.AbcVerifyCode:
|
||||
verifyCode = GetSingleObj().CreateAbcVerifyCode(length);
|
||||
break;
|
||||
case VerifyCodeType.MixVerifyCode:
|
||||
verifyCode = GetSingleObj().CreateMixVerifyCode(length);
|
||||
break;
|
||||
}
|
||||
|
||||
//2019-03-02 增加存入缓存
|
||||
//var ic = new MemoryCache();
|
||||
//ic.Set<string>("code_" + verifyCode, verifyCode, 120);//2分钟自动过期
|
||||
//2019-03-04 增加Redis缓存
|
||||
Utils.MemoryCahce.Set<string>("code_" + verifyCode, verifyCode, 120);
|
||||
|
||||
return verifyCode;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证码图片
|
||||
///// <summary>
|
||||
///// 验证码图片 => Bitmap
|
||||
///// </summary>
|
||||
///// <param name="verifyCode">验证码</param>
|
||||
///// <param name="width">宽</param>
|
||||
///// <param name="height">高</param>
|
||||
///// <returns>Bitmap</returns>
|
||||
//public Bitmap CreateBitmapByImgVerifyCode(string verifyCode, int width, int height)
|
||||
//{
|
||||
// Font font = new Font("Arial", 14, (FontStyle.Bold | FontStyle.Italic));
|
||||
// Brush brush;
|
||||
// Bitmap bitmap = new Bitmap(width, height);
|
||||
// Graphics g = Graphics.FromImage(bitmap);
|
||||
// SizeF totalSizeF = g.MeasureString(verifyCode, font);
|
||||
// SizeF curCharSizeF;
|
||||
// PointF startPointF = new PointF(0, (height - totalSizeF.Height) / 2);
|
||||
// Random random = new Random(); //随机数产生器
|
||||
// g.Clear(Color.White); //清空图片背景色
|
||||
// for (int i = 0; i < verifyCode.Length; i++)
|
||||
// {
|
||||
// brush = new LinearGradientBrush(new Point(0, 0), new Point(1, 1), Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)), Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)));
|
||||
// g.DrawString(verifyCode[i].ToString(), font, brush, startPointF);
|
||||
// curCharSizeF = g.MeasureString(verifyCode[i].ToString(), font);
|
||||
// startPointF.X += curCharSizeF.Width;
|
||||
// }
|
||||
|
||||
// //画图片的干扰线
|
||||
// for (int i = 0; i < 10; i++)
|
||||
// {
|
||||
// int x1 = random.Next(bitmap.Width);
|
||||
// int x2 = random.Next(bitmap.Width);
|
||||
// int y1 = random.Next(bitmap.Height);
|
||||
// int y2 = random.Next(bitmap.Height);
|
||||
// g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
|
||||
// }
|
||||
|
||||
// //画图片的前景干扰点
|
||||
// for (int i = 0; i < 100; i++)
|
||||
// {
|
||||
// int x = random.Next(bitmap.Width);
|
||||
// int y = random.Next(bitmap.Height);
|
||||
// bitmap.SetPixel(x, y, Color.FromArgb(random.Next()));
|
||||
// }
|
||||
|
||||
// g.DrawRectangle(new Pen(Color.Silver), 0, 0, bitmap.Width - 1, bitmap.Height - 1); //画图片的边框线
|
||||
// g.Dispose();
|
||||
// return bitmap;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 验证码图片 => byte[]
|
||||
///// </summary>
|
||||
///// <param name="verifyCode">验证码</param>
|
||||
///// <param name="width">宽</param>
|
||||
///// <param name="height">高</param>
|
||||
///// <returns>byte[]</returns>
|
||||
//public byte[] CreateByteByImgVerifyCode(string verifyCode, int width, int height)
|
||||
//{
|
||||
// Font font = new Font("Arial", 14, (FontStyle.Bold | FontStyle.Italic));
|
||||
// Brush brush;
|
||||
// Bitmap bitmap = new Bitmap(width, height);
|
||||
// Graphics g = Graphics.FromImage(bitmap);
|
||||
// SizeF totalSizeF = g.MeasureString(verifyCode, font);
|
||||
// SizeF curCharSizeF;
|
||||
// PointF startPointF = new PointF(0, (height - totalSizeF.Height) / 2);
|
||||
// Random random = new Random(); //随机数产生器
|
||||
// g.Clear(Color.White); //清空图片背景色
|
||||
// for (int i = 0; i < verifyCode.Length; i++)
|
||||
// {
|
||||
// brush = new LinearGradientBrush(new Point(0, 0), new Point(1, 1), Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)), Color.FromArgb(random.Next(255), random.Next(255), random.Next(255)));
|
||||
// g.DrawString(verifyCode[i].ToString(), font, brush, startPointF);
|
||||
// curCharSizeF = g.MeasureString(verifyCode[i].ToString(), font);
|
||||
// startPointF.X += curCharSizeF.Width;
|
||||
// }
|
||||
|
||||
// //画图片的干扰线
|
||||
// for (int i = 0; i < 10; i++)
|
||||
// {
|
||||
// int x1 = random.Next(bitmap.Width);
|
||||
// int x2 = random.Next(bitmap.Width);
|
||||
// int y1 = random.Next(bitmap.Height);
|
||||
// int y2 = random.Next(bitmap.Height);
|
||||
// g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
|
||||
// }
|
||||
|
||||
// //画图片的前景干扰点
|
||||
// for (int i = 0; i < 100; i++)
|
||||
// {
|
||||
// int x = random.Next(bitmap.Width);
|
||||
// int y = random.Next(bitmap.Height);
|
||||
// bitmap.SetPixel(x, y, Color.FromArgb(random.Next()));
|
||||
// }
|
||||
|
||||
// g.DrawRectangle(new Pen(Color.Silver), 0, 0, bitmap.Width - 1, bitmap.Height - 1); //画图片的边框线
|
||||
// g.Dispose();
|
||||
|
||||
// //保存图片数据
|
||||
// MemoryStream stream = new MemoryStream();
|
||||
// bitmap.Save(stream, ImageFormat.Jpeg);
|
||||
// //输出图片流
|
||||
// return stream.ToArray();
|
||||
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 图片验证码
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <returns></returns>
|
||||
public byte[] GetVerifyCode(string text, int width, int height)
|
||||
{
|
||||
|
||||
Random random = new();
|
||||
|
||||
//创建bitmap位图
|
||||
using SKBitmap image = new(width, height, SKColorType.Bgra8888, SKAlphaType.Premul);
|
||||
//创建画笔
|
||||
using SKCanvas canvas = new(image);
|
||||
//填充背景颜色为白色
|
||||
canvas.DrawColor(SKColors.White);
|
||||
|
||||
//画图片的背景噪音线
|
||||
for (int i = 0; i < (width * height * 0.015); i++)
|
||||
{
|
||||
using SKPaint drawStyle = new();
|
||||
drawStyle.Color = new(Convert.ToUInt32(random.Next(Int32.MaxValue)));
|
||||
|
||||
canvas.DrawLine(random.Next(0, width), random.Next(0, height), random.Next(0, width), random.Next(0, height), drawStyle);
|
||||
}
|
||||
// 在图片上写验证码
|
||||
SKPaint textPaint = new SKPaint
|
||||
{
|
||||
IsAntialias = true,
|
||||
TextAlign = SKTextAlign.Left,
|
||||
Shader = SKShader.CreateLinearGradient(new SKPoint(0, 0), new SKPoint(width, height), new SKColor[] { SKColors.Blue, SKColors.DarkRed }, SKShaderTileMode.Clamp),
|
||||
TextSize = 22
|
||||
};
|
||||
canvas.DrawText(text, 4, 24, textPaint);
|
||||
|
||||
//将文字写到画布上
|
||||
//using (SKPaint drawStyle = new())
|
||||
//{
|
||||
// drawStyle.Color = SKColors.Red;
|
||||
// drawStyle.TextSize = height;
|
||||
// drawStyle.StrokeWidth = 1;
|
||||
|
||||
// float emHeight = height - (float)height * (float)0.14;
|
||||
// float emWidth = ((float)width / text.Length) - ((float)width * (float)0.13);
|
||||
|
||||
// canvas.DrawText(text, emWidth, emHeight, drawStyle);
|
||||
//}
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
canvas.DrawLine(new SKPoint(random.Next(width), random.Next(height)), new SKPoint(random.Next(width), random.Next(height)), new SKPaint() { Color = SKColor.FromHsv(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)) });
|
||||
}
|
||||
|
||||
// 在图片上随机画100个随机颜色点
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
canvas.DrawPoint(new SKPoint(random.Next(width), random.Next(height)), SKColor.FromHsv(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
}
|
||||
|
||||
//画图片的前景噪音点
|
||||
//for (int i = 0; i < (width * height * 0.6); i++)
|
||||
//{
|
||||
// image.SetPixel(random.Next(0, width), random.Next(0, height), new SKColor(Convert.ToUInt32(random.Next(Int32.MaxValue))));
|
||||
//}
|
||||
|
||||
using var img = SKImage.FromBitmap(image);
|
||||
using SKData p = img.Encode(SKEncodedImageFormat.Png, 100);
|
||||
return p.ToArray();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证验证码
|
||||
/// <summary>
|
||||
/// 验证验证码是否成功
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public bool VerifyCodeIsOK(string code)
|
||||
{
|
||||
string vc = SessionHelper.GetSession(SESSION_KEY)?.ToString();
|
||||
//2019-03-02 增加缓存判断
|
||||
if (string.IsNullOrEmpty(vc))
|
||||
{
|
||||
//如果Session为空,则使用缓存判断
|
||||
//var ic = new MemoryCache();
|
||||
//vc = ic.Get<string>("code_" + code);
|
||||
//var ic = Utils.RedisCahce;//Redis.Create(Utils.RedisServer, Utils.RedisIndex);
|
||||
vc = Utils.MemoryCahce.Get<string>("code_" + code);// ic.Get<string>("code_" + code);
|
||||
//XTrace.WriteLine($"从缓存中获取验证码:code_{code}:{vc}");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(vc) && !string.IsNullOrEmpty(code))
|
||||
{
|
||||
if (vc.ToUpper() == code.ToUpper())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DrawingCore;
|
||||
using System.DrawingCore.Imaging;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
@@ -11,51 +14,30 @@ namespace COMCMS.Common
|
||||
/// </summary>
|
||||
public class WatermarkHelper
|
||||
{
|
||||
|
||||
#region 加图片水印
|
||||
/// <summary>
|
||||
/// 加图片水印
|
||||
/// </summary>
|
||||
/// <p
|
||||
/// <param name="filename">文件名</param>
|
||||
/// <param name="watermarkFilename">水印文件名</param>
|
||||
/// <param name="watermarkStatus">图片水印位置</param>
|
||||
public static void AddImageSignPic(Image img, string filename, string watermarkFilename, int watermarkStatus, int quality, int watermarkTransparency)
|
||||
public static void AddImageSignPic(string copyfullpath, string filename, string watermarkFilename, int watermarkStatus, int quality, int watermarkTransparency)
|
||||
{
|
||||
Graphics g = Graphics.FromImage(img);
|
||||
var img = SKBitmap.Decode(copyfullpath);
|
||||
using SKCanvas canvas = new(img);
|
||||
|
||||
//设置高质量插值法
|
||||
//g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||
//设置高质量,低速度呈现平滑程度
|
||||
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
System.DrawingCore.Image watermark = new Bitmap(watermarkFilename);
|
||||
var watermarkBitmap = SKBitmap.Decode(watermarkFilename);
|
||||
SKImage watermark = SKImage.FromBitmap(watermarkBitmap);
|
||||
|
||||
if (watermark.Height >= img.Height || watermark.Width >= img.Width)
|
||||
return;
|
||||
|
||||
ImageAttributes imageAttributes = new ImageAttributes();
|
||||
ColorMap colorMap = new ColorMap();
|
||||
|
||||
colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);
|
||||
colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
|
||||
ColorMap[] remapTable = { colorMap };
|
||||
|
||||
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
|
||||
|
||||
float transparency = 0.5F;
|
||||
if (watermarkTransparency >= 1 && watermarkTransparency <= 10)
|
||||
transparency = (watermarkTransparency / 10.0F);
|
||||
|
||||
|
||||
float[][] colorMatrixElements = {
|
||||
new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},
|
||||
new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},
|
||||
new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},
|
||||
new float[] {0.0f, 0.0f, 0.0f, transparency, 0.0f},
|
||||
new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
|
||||
};
|
||||
|
||||
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
|
||||
|
||||
imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||
|
||||
int xpos = 0;
|
||||
int ypos = 0;
|
||||
|
||||
@@ -98,124 +80,74 @@ namespace COMCMS.Common
|
||||
ypos = (int)((img.Height * (float).99) - watermark.Height);
|
||||
break;
|
||||
}
|
||||
|
||||
g.DrawImage(watermark, new Rectangle(xpos, ypos, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, imageAttributes);
|
||||
|
||||
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
|
||||
ImageCodecInfo ici = null;
|
||||
foreach (ImageCodecInfo codec in codecs)
|
||||
SKPoint point = new SKPoint()
|
||||
{
|
||||
if (codec.MimeType.IndexOf("jpeg") > -1)
|
||||
ici = codec;
|
||||
X = xpos,
|
||||
Y = ypos
|
||||
};
|
||||
|
||||
canvas.DrawImage(watermark, point);
|
||||
|
||||
//var newImg = SKImage.fo originalImage.Resize(new SKSizeI(towidth, toheight), SKFilterQuality.Medium);
|
||||
//canvas.
|
||||
using var fs = new FileStream(filename, FileMode.Create);
|
||||
SKEncodedImageFormat imgType = new SKEncodedImageFormat();
|
||||
string sFullExtension = Utils.GetFileExtName(filename).ToLower();//扩展名
|
||||
switch (sFullExtension)
|
||||
{
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
imgType = SKEncodedImageFormat.Jpeg;
|
||||
break;
|
||||
case ".png":
|
||||
imgType = SKEncodedImageFormat.Png;
|
||||
break;
|
||||
case ".gif":
|
||||
imgType = SKEncodedImageFormat.Gif;
|
||||
break;
|
||||
case ".webp":
|
||||
imgType = SKEncodedImageFormat.Webp;
|
||||
break;
|
||||
case ".bmp":
|
||||
imgType = SKEncodedImageFormat.Bmp;
|
||||
break;
|
||||
default:
|
||||
imgType = SKEncodedImageFormat.Png;
|
||||
break;
|
||||
}
|
||||
EncoderParameters encoderParams = new EncoderParameters();
|
||||
long[] qualityParam = new long[1];
|
||||
if (quality < 0 || quality > 100)
|
||||
quality = 80;
|
||||
img.Encode(fs, imgType, 100);
|
||||
fs.Flush();
|
||||
|
||||
qualityParam[0] = quality;
|
||||
|
||||
EncoderParameter encoderParam = new EncoderParameter(System.DrawingCore.Imaging.Encoder.Quality, qualityParam);
|
||||
encoderParams.Param[0] = encoderParam;
|
||||
////g.DrawImage(watermark, new Rectangle(xpos, ypos, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, imageAttributes);
|
||||
|
||||
if (ici != null)
|
||||
img.Save(filename, ici, encoderParams);
|
||||
else
|
||||
img.Save(filename);
|
||||
//ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
|
||||
//ImageCodecInfo ici = null;
|
||||
//foreach (ImageCodecInfo codec in codecs)
|
||||
//{
|
||||
// if (codec.MimeType.IndexOf("jpeg") > -1)
|
||||
// ici = codec;
|
||||
//}
|
||||
//EncoderParameters encoderParams = new EncoderParameters();
|
||||
//long[] qualityParam = new long[1];
|
||||
//if (quality < 0 || quality > 100)
|
||||
// quality = 80;
|
||||
|
||||
//qualityParam[0] = quality;
|
||||
|
||||
//EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam);
|
||||
//encoderParams.Param[0] = encoderParam;
|
||||
|
||||
//if (ici != null)
|
||||
// img.Save(filename, ici, encoderParams);
|
||||
//else
|
||||
// img.Save(filename);
|
||||
|
||||
g.Dispose();
|
||||
img.Dispose();
|
||||
watermark.Dispose();
|
||||
imageAttributes.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 增加文字水印
|
||||
/// <summary>
|
||||
/// 增加图片文字水印
|
||||
/// </summary>
|
||||
/// <param name="filename">文件名</param>
|
||||
/// <param name="watermarkText">水印文字</param>
|
||||
/// <param name="watermarkStatus">图片水印位置</param>
|
||||
public static void AddImageSignText(System.DrawingCore.Image img, string filename, string watermarkText, int watermarkStatus, int quality, string fontname, int fontsize)
|
||||
{
|
||||
Graphics g = Graphics.FromImage(img);
|
||||
Font drawFont = new Font(fontname, fontsize, FontStyle.Regular, GraphicsUnit.Pixel);
|
||||
SizeF crSize;
|
||||
crSize = g.MeasureString(watermarkText, drawFont);
|
||||
|
||||
float xpos = 0;
|
||||
float ypos = 0;
|
||||
|
||||
switch (watermarkStatus)
|
||||
{
|
||||
case 1:
|
||||
xpos = (float)img.Width * (float).01;
|
||||
ypos = (float)img.Height * (float).01;
|
||||
break;
|
||||
case 2:
|
||||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
|
||||
ypos = (float)img.Height * (float).01;
|
||||
break;
|
||||
case 3:
|
||||
xpos = ((float)img.Width * (float).99) - crSize.Width;
|
||||
ypos = (float)img.Height * (float).01;
|
||||
break;
|
||||
case 4:
|
||||
xpos = (float)img.Width * (float).01;
|
||||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
|
||||
break;
|
||||
case 5:
|
||||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
|
||||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
|
||||
break;
|
||||
case 6:
|
||||
xpos = ((float)img.Width * (float).99) - crSize.Width;
|
||||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2);
|
||||
break;
|
||||
case 7:
|
||||
xpos = (float)img.Width * (float).01;
|
||||
ypos = ((float)img.Height * (float).99) - crSize.Height;
|
||||
break;
|
||||
case 8:
|
||||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2);
|
||||
ypos = ((float)img.Height * (float).99) - crSize.Height;
|
||||
break;
|
||||
case 9:
|
||||
xpos = ((float)img.Width * (float).99) - crSize.Width;
|
||||
ypos = ((float)img.Height * (float).99) - crSize.Height;
|
||||
break;
|
||||
}
|
||||
|
||||
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.White), xpos + 1, ypos + 1);
|
||||
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.Black), xpos, ypos);
|
||||
|
||||
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
|
||||
ImageCodecInfo ici = null;
|
||||
foreach (ImageCodecInfo codec in codecs)
|
||||
{
|
||||
if (codec.MimeType.IndexOf("jpeg") > -1)
|
||||
ici = codec;
|
||||
}
|
||||
EncoderParameters encoderParams = new EncoderParameters();
|
||||
long[] qualityParam = new long[1];
|
||||
if (quality < 0 || quality > 100)
|
||||
quality = 80;
|
||||
|
||||
qualityParam[0] = quality;
|
||||
|
||||
EncoderParameter encoderParam = new EncoderParameter(System.DrawingCore.Imaging.Encoder.Quality, qualityParam);
|
||||
encoderParams.Param[0] = encoderParam;
|
||||
|
||||
if (ici != null)
|
||||
img.Save(filename, ici, encoderParams);
|
||||
else
|
||||
img.Save(filename);
|
||||
|
||||
g.Dispose();
|
||||
img.Dispose();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,9 +150,25 @@ namespace COMCMS.Core
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>
|
||||
/// 通过FileName查找
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <param name="kid"></param>
|
||||
/// <returns></returns>
|
||||
public static Article FindByFileName(string filename,int kid=0)
|
||||
{
|
||||
var where = _.FileName == filename;
|
||||
if (kid > 0) where &= _.KId == kid;
|
||||
return Find(where);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取上一条记录/前一条记录
|
||||
/// </summary>
|
||||
@@ -212,6 +228,36 @@ namespace COMCMS.Core
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取前几条文章
|
||||
/// </summary>
|
||||
/// <param name="kid">栏目id</param>
|
||||
/// <param name="records">条数</param>
|
||||
/// <returns></returns>
|
||||
public static IList<Article> FindTopList(int kid, int records, bool isShowSub = false)
|
||||
{
|
||||
if (!isShowSub)
|
||||
return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records);
|
||||
else
|
||||
{
|
||||
Expression ex = _.IsHide == 0;
|
||||
List<int> kids = new List<int>();
|
||||
kids.Add(kid);
|
||||
IList<ArticleCategory> subkinds = ArticleCategory.FindByParentID(kid);
|
||||
if (subkinds != null && subkinds.Count > 0)
|
||||
{
|
||||
foreach (var item in subkinds)
|
||||
{
|
||||
kids.Add(item.Id);
|
||||
}
|
||||
}
|
||||
ex &= Article._.KId.In(kids);
|
||||
|
||||
return FindAll(ex, _.Id.Desc(), null, 0, records);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+165
-145
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
@@ -20,288 +21,296 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private Int32 _KId;
|
||||
/// <summary>栏目ID</summary>
|
||||
[DisplayName("栏目ID")]
|
||||
[Description("栏目ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("KId", "栏目ID", "int")]
|
||||
public Int32 KId { get { return _KId; } set { if (OnPropertyChanging(__.KId, value)) { _KId = value; OnPropertyChanged(__.KId); } } }
|
||||
[BindColumn("KId", "栏目ID", "")]
|
||||
public Int32 KId { get => _KId; set { if (OnPropertyChanging(__.KId, value)) { _KId = value; OnPropertyChanged(__.KId); } } }
|
||||
|
||||
private String _Title;
|
||||
/// <summary>标题</summary>
|
||||
[DisplayName("标题")]
|
||||
[Description("标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Title", "标题", "nvarchar(250)", Master = true)]
|
||||
public String Title { get { return _Title; } set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
[BindColumn("Title", "标题", "", Master = true)]
|
||||
public String Title { get => _Title; set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
/// <summary>副标题</summary>
|
||||
[DisplayName("副标题")]
|
||||
[Description("副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "副标题", "nvarchar(250)")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
[BindColumn("SubTitle", "副标题", "")]
|
||||
public String SubTitle { get => _SubTitle; set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
|
||||
private String _Content;
|
||||
/// <summary>内容</summary>
|
||||
[DisplayName("内容")]
|
||||
[Description("内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Content", "内容", "ntext")]
|
||||
public String Content { get { return _Content; } set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } } }
|
||||
[BindColumn("Content", "内容", "")]
|
||||
public String Content { get => _Content; set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } } }
|
||||
|
||||
private String _Keyword;
|
||||
/// <summary>描述</summary>
|
||||
[DisplayName("描述")]
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "nvarchar(250)")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get => _Keyword; set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>介绍</summary>
|
||||
[DisplayName("介绍")]
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "nvarchar(250)")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
/// <summary>跳转链接</summary>
|
||||
[DisplayName("跳转链接")]
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "nvarchar(250)")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get => _LinkURL; set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
/// <summary>类别名称颜色</summary>
|
||||
[DisplayName("类别名称颜色")]
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "nvarchar(50)")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get => _TitleColor; set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
/// <summary>模板</summary>
|
||||
[DisplayName("模板")]
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "nvarchar(250)")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get => _TemplateFile; set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
|
||||
private Int32 _IsRecommend;
|
||||
/// <summary>是否推荐</summary>
|
||||
[DisplayName("是否推荐")]
|
||||
[Description("是否推荐")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsRecommend", "是否推荐", "int")]
|
||||
public Int32 IsRecommend { get { return _IsRecommend; } set { if (OnPropertyChanging(__.IsRecommend, value)) { _IsRecommend = value; OnPropertyChanged(__.IsRecommend); } } }
|
||||
[BindColumn("IsRecommend", "是否推荐", "")]
|
||||
public Int32 IsRecommend { get => _IsRecommend; set { if (OnPropertyChanging(__.IsRecommend, value)) { _IsRecommend = value; OnPropertyChanged(__.IsRecommend); } } }
|
||||
|
||||
private Int32 _IsNew;
|
||||
/// <summary>是否最新</summary>
|
||||
[DisplayName("是否最新")]
|
||||
[Description("是否最新")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsNew", "是否最新", "int")]
|
||||
public Int32 IsNew { get { return _IsNew; } set { if (OnPropertyChanging(__.IsNew, value)) { _IsNew = value; OnPropertyChanged(__.IsNew); } } }
|
||||
[BindColumn("IsNew", "是否最新", "")]
|
||||
public Int32 IsNew { get => _IsNew; set { if (OnPropertyChanging(__.IsNew, value)) { _IsNew = value; OnPropertyChanged(__.IsNew); } } }
|
||||
|
||||
private Int32 _IsBest;
|
||||
/// <summary>是否推荐</summary>
|
||||
[DisplayName("是否推荐")]
|
||||
[Description("是否推荐")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsBest", "是否推荐", "int")]
|
||||
public Int32 IsBest { get { return _IsBest; } set { if (OnPropertyChanging(__.IsBest, value)) { _IsBest = value; OnPropertyChanged(__.IsBest); } } }
|
||||
[BindColumn("IsBest", "是否推荐", "")]
|
||||
public Int32 IsBest { get => _IsBest; set { if (OnPropertyChanging(__.IsBest, value)) { _IsBest = value; OnPropertyChanged(__.IsBest); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
/// <summary>是否隐藏</summary>
|
||||
[DisplayName("是否隐藏")]
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "int")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get => _IsHide; set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
/// <summary>是否锁定,不允许删除</summary>
|
||||
[DisplayName("是否锁定")]
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "int")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get => _IsLock; set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
/// <summary>是否删除,已经删除到回收站</summary>
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "int")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get => _IsDel; set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
|
||||
private Int32 _IsTop;
|
||||
/// <summary>是否置顶</summary>
|
||||
[DisplayName("是否置顶")]
|
||||
[Description("是否置顶")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsTop", "是否置顶", "int")]
|
||||
public Int32 IsTop { get { return _IsTop; } set { if (OnPropertyChanging(__.IsTop, value)) { _IsTop = value; OnPropertyChanged(__.IsTop); } } }
|
||||
[BindColumn("IsTop", "是否置顶", "")]
|
||||
public Int32 IsTop { get => _IsTop; set { if (OnPropertyChanging(__.IsTop, value)) { _IsTop = value; OnPropertyChanged(__.IsTop); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
/// <summary>是否允许评论</summary>
|
||||
[DisplayName("是否允许评论")]
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "int")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get => _IsComment; set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
/// <summary>是否会员栏目</summary>
|
||||
[DisplayName("是否会员栏目")]
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "int")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get => _IsMember; set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
|
||||
private Int32 _Hits;
|
||||
/// <summary>点击数量</summary>
|
||||
[DisplayName("点击数量")]
|
||||
[Description("点击数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Hits", "点击数量", "int")]
|
||||
public Int32 Hits { get { return _Hits; } set { if (OnPropertyChanging(__.Hits, value)) { _Hits = value; OnPropertyChanged(__.Hits); } } }
|
||||
[BindColumn("Hits", "点击数量", "")]
|
||||
public Int32 Hits { get => _Hits; set { if (OnPropertyChanging(__.Hits, value)) { _Hits = value; OnPropertyChanged(__.Hits); } } }
|
||||
|
||||
private Int32 _Sequence;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Sequence", "排序", "int")]
|
||||
public Int32 Sequence { get { return _Sequence; } set { if (OnPropertyChanging(__.Sequence, value)) { _Sequence = value; OnPropertyChanged(__.Sequence); } } }
|
||||
[BindColumn("Sequence", "排序", "")]
|
||||
public Int32 Sequence { get => _Sequence; set { if (OnPropertyChanging(__.Sequence, value)) { _Sequence = value; OnPropertyChanged(__.Sequence); } } }
|
||||
|
||||
private Int32 _CommentCount;
|
||||
/// <summary>评论数量</summary>
|
||||
[DisplayName("评论数量")]
|
||||
[Description("评论数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CommentCount", "评论数量", "int")]
|
||||
public Int32 CommentCount { get { return _CommentCount; } set { if (OnPropertyChanging(__.CommentCount, value)) { _CommentCount = value; OnPropertyChanged(__.CommentCount); } } }
|
||||
[BindColumn("CommentCount", "评论数量", "")]
|
||||
public Int32 CommentCount { get => _CommentCount; set { if (OnPropertyChanging(__.CommentCount, value)) { _CommentCount = value; OnPropertyChanged(__.CommentCount); } } }
|
||||
|
||||
private String _Icon;
|
||||
/// <summary>图标</summary>
|
||||
[DisplayName("图标")]
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "nvarchar(100)")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get => _Icon; set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
|
||||
private String _ClassName;
|
||||
/// <summary>样式名称</summary>
|
||||
[DisplayName("样式名称")]
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "nvarchar(50)")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get => _ClassName; set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
/// <summary>banner图片</summary>
|
||||
[DisplayName("banner图片")]
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "nvarchar(250)")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get => _BannerImg; set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
|
||||
private String _Pic;
|
||||
/// <summary>图片</summary>
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "nvarchar(250)")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get => _Pic; set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
/// <summary>广告ID</summary>
|
||||
[DisplayName("广告ID")]
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "int")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get => _AdsId; set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
|
||||
private String _Tags;
|
||||
/// <summary>TAG</summary>
|
||||
[DisplayName("TAG")]
|
||||
[Description("TAG")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Tags", "TAG", "nvarchar(250)")]
|
||||
public String Tags { get { return _Tags; } set { if (OnPropertyChanging(__.Tags, value)) { _Tags = value; OnPropertyChanged(__.Tags); } } }
|
||||
[BindColumn("Tags", "TAG", "")]
|
||||
public String Tags { get => _Tags; set { if (OnPropertyChanging(__.Tags, value)) { _Tags = value; OnPropertyChanged(__.Tags); } } }
|
||||
|
||||
private String _Origin;
|
||||
/// <summary>来源</summary>
|
||||
[DisplayName("来源")]
|
||||
[Description("来源")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Origin", "来源", "nvarchar(250)")]
|
||||
public String Origin { get { return _Origin; } set { if (OnPropertyChanging(__.Origin, value)) { _Origin = value; OnPropertyChanged(__.Origin); } } }
|
||||
[BindColumn("Origin", "来源", "")]
|
||||
public String Origin { get => _Origin; set { if (OnPropertyChanging(__.Origin, value)) { _Origin = value; OnPropertyChanged(__.Origin); } } }
|
||||
|
||||
private String _OriginURL;
|
||||
/// <summary>来源地址</summary>
|
||||
[DisplayName("来源地址")]
|
||||
[Description("来源地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("OriginURL", "来源地址", "nvarchar(250)")]
|
||||
public String OriginURL { get { return _OriginURL; } set { if (OnPropertyChanging(__.OriginURL, value)) { _OriginURL = value; OnPropertyChanged(__.OriginURL); } } }
|
||||
[BindColumn("OriginURL", "来源地址", "")]
|
||||
public String OriginURL { get => _OriginURL; set { if (OnPropertyChanging(__.OriginURL, value)) { _OriginURL = value; OnPropertyChanged(__.OriginURL); } } }
|
||||
|
||||
private String _ItemImg;
|
||||
/// <summary>更多图片</summary>
|
||||
[DisplayName("更多图片")]
|
||||
[Description("更多图片")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("ItemImg", "更多图片", "ntext")]
|
||||
public String ItemImg { get { return _ItemImg; } set { if (OnPropertyChanging(__.ItemImg, value)) { _ItemImg = value; OnPropertyChanged(__.ItemImg); } } }
|
||||
[BindColumn("ItemImg", "更多图片", "")]
|
||||
public String ItemImg { get => _ItemImg; set { if (OnPropertyChanging(__.ItemImg, value)) { _ItemImg = value; OnPropertyChanged(__.ItemImg); } } }
|
||||
|
||||
private Int32 _AuthorId;
|
||||
/// <summary>添加管理员ID</summary>
|
||||
[DisplayName("添加管理员ID")]
|
||||
[Description("添加管理员ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AuthorId", "添加管理员ID", "int")]
|
||||
public Int32 AuthorId { get { return _AuthorId; } set { if (OnPropertyChanging(__.AuthorId, value)) { _AuthorId = value; OnPropertyChanged(__.AuthorId); } } }
|
||||
[BindColumn("AuthorId", "添加管理员ID", "")]
|
||||
public Int32 AuthorId { get => _AuthorId; set { if (OnPropertyChanging(__.AuthorId, value)) { _AuthorId = value; OnPropertyChanged(__.AuthorId); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "datetime")]
|
||||
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>时间</summary>
|
||||
[DisplayName("时间")]
|
||||
[Description("时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "时间", "datetime")]
|
||||
public DateTime UpdateTime { get { return _UpdateTime; } set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
[BindColumn("UpdateTime", "时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
|
||||
private String _Location;
|
||||
/// <summary>路径</summary>
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "nvarchar(100)")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get => _Location; set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
|
||||
private String _FilePath;
|
||||
/// <summary>存放目录</summary>
|
||||
[DisplayName("存放目录")]
|
||||
[Description("存放目录")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("FilePath", "存放目录", "nvarchar(100)")]
|
||||
public String FilePath { get { return _FilePath; } set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
[BindColumn("FilePath", "存放目录", "")]
|
||||
public String FilePath { get => _FilePath; set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
|
||||
private String _FileName;
|
||||
/// <summary>文件名称</summary>
|
||||
[DisplayName("文件名称")]
|
||||
[Description("文件名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("FileName", "文件名称", "")]
|
||||
public String FileName { get => _FileName; set { if (OnPropertyChanging(__.FileName, value)) { _FileName = value; OnPropertyChanged(__.FileName); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -314,42 +323,43 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.KId : return _KId;
|
||||
case __.Title : return _Title;
|
||||
case __.SubTitle : return _SubTitle;
|
||||
case __.Content : return _Content;
|
||||
case __.Keyword : return _Keyword;
|
||||
case __.Description : return _Description;
|
||||
case __.LinkURL : return _LinkURL;
|
||||
case __.TitleColor : return _TitleColor;
|
||||
case __.TemplateFile : return _TemplateFile;
|
||||
case __.IsRecommend : return _IsRecommend;
|
||||
case __.IsNew : return _IsNew;
|
||||
case __.IsBest : return _IsBest;
|
||||
case __.IsHide : return _IsHide;
|
||||
case __.IsLock : return _IsLock;
|
||||
case __.IsDel : return _IsDel;
|
||||
case __.IsTop : return _IsTop;
|
||||
case __.IsComment : return _IsComment;
|
||||
case __.IsMember : return _IsMember;
|
||||
case __.Hits : return _Hits;
|
||||
case __.Sequence : return _Sequence;
|
||||
case __.CommentCount : return _CommentCount;
|
||||
case __.Icon : return _Icon;
|
||||
case __.ClassName : return _ClassName;
|
||||
case __.BannerImg : return _BannerImg;
|
||||
case __.Pic : return _Pic;
|
||||
case __.AdsId : return _AdsId;
|
||||
case __.Tags : return _Tags;
|
||||
case __.Origin : return _Origin;
|
||||
case __.OriginURL : return _OriginURL;
|
||||
case __.ItemImg : return _ItemImg;
|
||||
case __.AuthorId : return _AuthorId;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.UpdateTime : return _UpdateTime;
|
||||
case __.Location : return _Location;
|
||||
case __.FilePath : return _FilePath;
|
||||
case __.Id: return _Id;
|
||||
case __.KId: return _KId;
|
||||
case __.Title: return _Title;
|
||||
case __.SubTitle: return _SubTitle;
|
||||
case __.Content: return _Content;
|
||||
case __.Keyword: return _Keyword;
|
||||
case __.Description: return _Description;
|
||||
case __.LinkURL: return _LinkURL;
|
||||
case __.TitleColor: return _TitleColor;
|
||||
case __.TemplateFile: return _TemplateFile;
|
||||
case __.IsRecommend: return _IsRecommend;
|
||||
case __.IsNew: return _IsNew;
|
||||
case __.IsBest: return _IsBest;
|
||||
case __.IsHide: return _IsHide;
|
||||
case __.IsLock: return _IsLock;
|
||||
case __.IsDel: return _IsDel;
|
||||
case __.IsTop: return _IsTop;
|
||||
case __.IsComment: return _IsComment;
|
||||
case __.IsMember: return _IsMember;
|
||||
case __.Hits: return _Hits;
|
||||
case __.Sequence: return _Sequence;
|
||||
case __.CommentCount: return _CommentCount;
|
||||
case __.Icon: return _Icon;
|
||||
case __.ClassName: return _ClassName;
|
||||
case __.BannerImg: return _BannerImg;
|
||||
case __.Pic: return _Pic;
|
||||
case __.AdsId: return _AdsId;
|
||||
case __.Tags: return _Tags;
|
||||
case __.Origin: return _Origin;
|
||||
case __.OriginURL: return _OriginURL;
|
||||
case __.ItemImg: return _ItemImg;
|
||||
case __.AuthorId: return _AuthorId;
|
||||
case __.AddTime: return _AddTime;
|
||||
case __.UpdateTime: return _UpdateTime;
|
||||
case __.Location: return _Location;
|
||||
case __.FilePath: return _FilePath;
|
||||
case __.FileName: return _FileName;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -357,42 +367,43 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.KId : _KId = Convert.ToInt32(value); break;
|
||||
case __.Title : _Title = Convert.ToString(value); break;
|
||||
case __.SubTitle : _SubTitle = Convert.ToString(value); break;
|
||||
case __.Content : _Content = Convert.ToString(value); break;
|
||||
case __.Keyword : _Keyword = Convert.ToString(value); break;
|
||||
case __.Description : _Description = Convert.ToString(value); break;
|
||||
case __.LinkURL : _LinkURL = Convert.ToString(value); break;
|
||||
case __.TitleColor : _TitleColor = Convert.ToString(value); break;
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.IsRecommend : _IsRecommend = Convert.ToInt32(value); break;
|
||||
case __.IsNew : _IsNew = Convert.ToInt32(value); break;
|
||||
case __.IsBest : _IsBest = Convert.ToInt32(value); break;
|
||||
case __.IsHide : _IsHide = Convert.ToInt32(value); break;
|
||||
case __.IsLock : _IsLock = Convert.ToInt32(value); break;
|
||||
case __.IsDel : _IsDel = Convert.ToInt32(value); break;
|
||||
case __.IsTop : _IsTop = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsMember : _IsMember = Convert.ToInt32(value); break;
|
||||
case __.Hits : _Hits = Convert.ToInt32(value); break;
|
||||
case __.Sequence : _Sequence = Convert.ToInt32(value); break;
|
||||
case __.CommentCount : _CommentCount = Convert.ToInt32(value); break;
|
||||
case __.Icon : _Icon = Convert.ToString(value); break;
|
||||
case __.ClassName : _ClassName = Convert.ToString(value); break;
|
||||
case __.BannerImg : _BannerImg = Convert.ToString(value); break;
|
||||
case __.Pic : _Pic = Convert.ToString(value); break;
|
||||
case __.AdsId : _AdsId = Convert.ToInt32(value); break;
|
||||
case __.Tags : _Tags = Convert.ToString(value); break;
|
||||
case __.Origin : _Origin = Convert.ToString(value); break;
|
||||
case __.OriginURL : _OriginURL = Convert.ToString(value); break;
|
||||
case __.ItemImg : _ItemImg = Convert.ToString(value); break;
|
||||
case __.AuthorId : _AuthorId = Convert.ToInt32(value); break;
|
||||
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
|
||||
case __.UpdateTime : _UpdateTime = Convert.ToDateTime(value); break;
|
||||
case __.Location : _Location = Convert.ToString(value); break;
|
||||
case __.FilePath : _FilePath = Convert.ToString(value); break;
|
||||
case __.Id: _Id = value.ToInt(); break;
|
||||
case __.KId: _KId = value.ToInt(); break;
|
||||
case __.Title: _Title = Convert.ToString(value); break;
|
||||
case __.SubTitle: _SubTitle = Convert.ToString(value); break;
|
||||
case __.Content: _Content = Convert.ToString(value); break;
|
||||
case __.Keyword: _Keyword = Convert.ToString(value); break;
|
||||
case __.Description: _Description = Convert.ToString(value); break;
|
||||
case __.LinkURL: _LinkURL = Convert.ToString(value); break;
|
||||
case __.TitleColor: _TitleColor = Convert.ToString(value); break;
|
||||
case __.TemplateFile: _TemplateFile = Convert.ToString(value); break;
|
||||
case __.IsRecommend: _IsRecommend = value.ToInt(); break;
|
||||
case __.IsNew: _IsNew = value.ToInt(); break;
|
||||
case __.IsBest: _IsBest = value.ToInt(); break;
|
||||
case __.IsHide: _IsHide = value.ToInt(); break;
|
||||
case __.IsLock: _IsLock = value.ToInt(); break;
|
||||
case __.IsDel: _IsDel = value.ToInt(); break;
|
||||
case __.IsTop: _IsTop = value.ToInt(); break;
|
||||
case __.IsComment: _IsComment = value.ToInt(); break;
|
||||
case __.IsMember: _IsMember = value.ToInt(); break;
|
||||
case __.Hits: _Hits = value.ToInt(); break;
|
||||
case __.Sequence: _Sequence = value.ToInt(); break;
|
||||
case __.CommentCount: _CommentCount = value.ToInt(); break;
|
||||
case __.Icon: _Icon = Convert.ToString(value); break;
|
||||
case __.ClassName: _ClassName = Convert.ToString(value); break;
|
||||
case __.BannerImg: _BannerImg = Convert.ToString(value); break;
|
||||
case __.Pic: _Pic = Convert.ToString(value); break;
|
||||
case __.AdsId: _AdsId = value.ToInt(); break;
|
||||
case __.Tags: _Tags = Convert.ToString(value); break;
|
||||
case __.Origin: _Origin = Convert.ToString(value); break;
|
||||
case __.OriginURL: _OriginURL = Convert.ToString(value); break;
|
||||
case __.ItemImg: _ItemImg = Convert.ToString(value); break;
|
||||
case __.AuthorId: _AuthorId = value.ToInt(); break;
|
||||
case __.AddTime: _AddTime = value.ToDateTime(); break;
|
||||
case __.UpdateTime: _UpdateTime = value.ToDateTime(); break;
|
||||
case __.Location: _Location = Convert.ToString(value); break;
|
||||
case __.FilePath: _FilePath = Convert.ToString(value); break;
|
||||
case __.FileName: _FileName = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -511,7 +522,10 @@ namespace COMCMS.Core
|
||||
/// <summary>存放目录</summary>
|
||||
public static readonly Field FilePath = FindByName(__.FilePath);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
/// <summary>文件名称</summary>
|
||||
public static readonly Field FileName = FindByName(__.FileName);
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得文章字段名称的快捷方式</summary>
|
||||
@@ -624,6 +638,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>存放目录</summary>
|
||||
public const String FilePath = "FilePath";
|
||||
|
||||
/// <summary>文件名称</summary>
|
||||
public const String FileName = "FileName";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -739,6 +756,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>存放目录</summary>
|
||||
String FilePath { get; set; }
|
||||
|
||||
/// <summary>文件名称</summary>
|
||||
String FileName { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using COMCMS.Common;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
@@ -359,7 +360,7 @@ namespace COMCMS.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
re += " > " + string.Format(tpl, "/article/index/" + model.Id, model.KindName);
|
||||
re += " > " + string.Format(tpl, ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory, kid), model.KindName);
|
||||
if (model.PId != 0)
|
||||
{
|
||||
re = GetNav(model.PId) + re;
|
||||
|
||||
+150
-239
@@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
@@ -12,7 +16,7 @@ namespace COMCMS.Core
|
||||
[DataObject]
|
||||
[Description("文章栏目")]
|
||||
[BindTable("ArticleCategory", Description = "文章栏目", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class ArticleCategory : IArticleCategory
|
||||
public partial class ArticleCategory
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
@@ -21,7 +25,7 @@ namespace COMCMS.Core
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
|
||||
|
||||
private String _KindName;
|
||||
/// <summary>栏目名称</summary>
|
||||
@@ -29,7 +33,7 @@ namespace COMCMS.Core
|
||||
[Description("栏目名称")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindName", "栏目名称", "")]
|
||||
public String KindName { get { return _KindName; } set { if (OnPropertyChanging(__.KindName, value)) { _KindName = value; OnPropertyChanged(__.KindName); } } }
|
||||
public String KindName { get => _KindName; set { if (OnPropertyChanging("KindName", value)) { _KindName = value; OnPropertyChanged("KindName"); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
/// <summary>栏目副标题</summary>
|
||||
@@ -37,7 +41,7 @@ namespace COMCMS.Core
|
||||
[Description("栏目副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "栏目副标题", "")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
public String SubTitle { get => _SubTitle; set { if (OnPropertyChanging("SubTitle", value)) { _SubTitle = value; OnPropertyChanged("SubTitle"); } } }
|
||||
|
||||
private String _KindTitle;
|
||||
/// <summary>栏目标题,填写则在浏览器替换此标题</summary>
|
||||
@@ -45,7 +49,7 @@ namespace COMCMS.Core
|
||||
[Description("栏目标题,填写则在浏览器替换此标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "")]
|
||||
public String KindTitle { get { return _KindTitle; } set { if (OnPropertyChanging(__.KindTitle, value)) { _KindTitle = value; OnPropertyChanged(__.KindTitle); } } }
|
||||
public String KindTitle { get => _KindTitle; set { if (OnPropertyChanging("KindTitle", value)) { _KindTitle = value; OnPropertyChanged("KindTitle"); } } }
|
||||
|
||||
private String _Keyword;
|
||||
/// <summary>描述</summary>
|
||||
@@ -53,7 +57,7 @@ namespace COMCMS.Core
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
public String Keyword { get => _Keyword; set { if (OnPropertyChanging("Keyword", value)) { _Keyword = value; OnPropertyChanged("Keyword"); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>介绍</summary>
|
||||
@@ -61,7 +65,7 @@ namespace COMCMS.Core
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging("Description", value)) { _Description = value; OnPropertyChanged("Description"); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
/// <summary>跳转链接</summary>
|
||||
@@ -69,7 +73,7 @@ namespace COMCMS.Core
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
public String LinkURL { get => _LinkURL; set { if (OnPropertyChanging("LinkURL", value)) { _LinkURL = value; OnPropertyChanged("LinkURL"); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
/// <summary>类别名称颜色</summary>
|
||||
@@ -77,7 +81,7 @@ namespace COMCMS.Core
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
public String TitleColor { get => _TitleColor; set { if (OnPropertyChanging("TitleColor", value)) { _TitleColor = value; OnPropertyChanged("TitleColor"); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
/// <summary>模板</summary>
|
||||
@@ -85,7 +89,7 @@ namespace COMCMS.Core
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
public String TemplateFile { get => _TemplateFile; set { if (OnPropertyChanging("TemplateFile", value)) { _TemplateFile = value; OnPropertyChanged("TemplateFile"); } } }
|
||||
|
||||
private String _DetailTemplateFile;
|
||||
/// <summary>详情模板</summary>
|
||||
@@ -93,7 +97,7 @@ namespace COMCMS.Core
|
||||
[Description("详情模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "")]
|
||||
public String DetailTemplateFile { get { return _DetailTemplateFile; } set { if (OnPropertyChanging(__.DetailTemplateFile, value)) { _DetailTemplateFile = value; OnPropertyChanged(__.DetailTemplateFile); } } }
|
||||
public String DetailTemplateFile { get => _DetailTemplateFile; set { if (OnPropertyChanging("DetailTemplateFile", value)) { _DetailTemplateFile = value; OnPropertyChanged("DetailTemplateFile"); } } }
|
||||
|
||||
private String _KindDomain;
|
||||
/// <summary>类别域名(保留)</summary>
|
||||
@@ -101,7 +105,7 @@ namespace COMCMS.Core
|
||||
[Description("类别域名(保留)")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "")]
|
||||
public String KindDomain { get { return _KindDomain; } set { if (OnPropertyChanging(__.KindDomain, value)) { _KindDomain = value; OnPropertyChanged(__.KindDomain); } } }
|
||||
public String KindDomain { get => _KindDomain; set { if (OnPropertyChanging("KindDomain", value)) { _KindDomain = value; OnPropertyChanged("KindDomain"); } } }
|
||||
|
||||
private Int32 _IsList;
|
||||
/// <summary>是否为列表页面</summary>
|
||||
@@ -109,7 +113,7 @@ namespace COMCMS.Core
|
||||
[Description("是否为列表页面")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsList", "是否为列表页面", "")]
|
||||
public Int32 IsList { get { return _IsList; } set { if (OnPropertyChanging(__.IsList, value)) { _IsList = value; OnPropertyChanged(__.IsList); } } }
|
||||
public Int32 IsList { get => _IsList; set { if (OnPropertyChanging("IsList", value)) { _IsList = value; OnPropertyChanged("IsList"); } } }
|
||||
|
||||
private Int32 _PageSize;
|
||||
/// <summary>每页显示数量</summary>
|
||||
@@ -117,7 +121,7 @@ namespace COMCMS.Core
|
||||
[Description("每页显示数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PageSize", "每页显示数量", "")]
|
||||
public Int32 PageSize { get { return _PageSize; } set { if (OnPropertyChanging(__.PageSize, value)) { _PageSize = value; OnPropertyChanged(__.PageSize); } } }
|
||||
public Int32 PageSize { get => _PageSize; set { if (OnPropertyChanging("PageSize", value)) { _PageSize = value; OnPropertyChanged("PageSize"); } } }
|
||||
|
||||
private Int32 _PId;
|
||||
/// <summary>上级ID</summary>
|
||||
@@ -125,7 +129,7 @@ namespace COMCMS.Core
|
||||
[Description("上级ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PId", "上级ID", "")]
|
||||
public Int32 PId { get { return _PId; } set { if (OnPropertyChanging(__.PId, value)) { _PId = value; OnPropertyChanged(__.PId); } } }
|
||||
public Int32 PId { get => _PId; set { if (OnPropertyChanging("PId", value)) { _PId = value; OnPropertyChanged("PId"); } } }
|
||||
|
||||
private Int32 _Level;
|
||||
/// <summary>级别</summary>
|
||||
@@ -133,7 +137,7 @@ namespace COMCMS.Core
|
||||
[Description("级别")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Level", "级别", "")]
|
||||
public Int32 Level { get { return _Level; } set { if (OnPropertyChanging(__.Level, value)) { _Level = value; OnPropertyChanged(__.Level); } } }
|
||||
public Int32 Level { get => _Level; set { if (OnPropertyChanging("Level", value)) { _Level = value; OnPropertyChanged("Level"); } } }
|
||||
|
||||
private String _Location;
|
||||
/// <summary>路径</summary>
|
||||
@@ -141,7 +145,7 @@ namespace COMCMS.Core
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
public String Location { get => _Location; set { if (OnPropertyChanging("Location", value)) { _Location = value; OnPropertyChanged("Location"); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
/// <summary>是否隐藏</summary>
|
||||
@@ -149,7 +153,7 @@ namespace COMCMS.Core
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
public Int32 IsHide { get => _IsHide; set { if (OnPropertyChanging("IsHide", value)) { _IsHide = value; OnPropertyChanged("IsHide"); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
/// <summary>是否锁定,不允许删除</summary>
|
||||
@@ -157,7 +161,7 @@ namespace COMCMS.Core
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
public Int32 IsLock { get => _IsLock; set { if (OnPropertyChanging("IsLock", value)) { _IsLock = value; OnPropertyChanged("IsLock"); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
/// <summary>是否删除,已经删除到回收站</summary>
|
||||
@@ -165,7 +169,7 @@ namespace COMCMS.Core
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
public Int32 IsDel { get => _IsDel; set { if (OnPropertyChanging("IsDel", value)) { _IsDel = value; OnPropertyChanged("IsDel"); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
/// <summary>是否允许评论</summary>
|
||||
@@ -173,7 +177,7 @@ namespace COMCMS.Core
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
public Int32 IsComment { get => _IsComment; set { if (OnPropertyChanging("IsComment", value)) { _IsComment = value; OnPropertyChanged("IsComment"); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
/// <summary>是否会员栏目</summary>
|
||||
@@ -181,7 +185,7 @@ namespace COMCMS.Core
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
public Int32 IsMember { get => _IsMember; set { if (OnPropertyChanging("IsMember", value)) { _IsMember = value; OnPropertyChanged("IsMember"); } } }
|
||||
|
||||
private Int32 _IsShowSubDetail;
|
||||
/// <summary>是否显示下级栏目内容</summary>
|
||||
@@ -189,7 +193,7 @@ namespace COMCMS.Core
|
||||
[Description("是否显示下级栏目内容")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "")]
|
||||
public Int32 IsShowSubDetail { get { return _IsShowSubDetail; } set { if (OnPropertyChanging(__.IsShowSubDetail, value)) { _IsShowSubDetail = value; OnPropertyChanged(__.IsShowSubDetail); } } }
|
||||
public Int32 IsShowSubDetail { get => _IsShowSubDetail; set { if (OnPropertyChanging("IsShowSubDetail", value)) { _IsShowSubDetail = value; OnPropertyChanged("IsShowSubDetail"); } } }
|
||||
|
||||
private Int32 _CatalogId;
|
||||
/// <summary>模型ID</summary>
|
||||
@@ -197,7 +201,7 @@ namespace COMCMS.Core
|
||||
[Description("模型ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CatalogId", "模型ID", "")]
|
||||
public Int32 CatalogId { get { return _CatalogId; } set { if (OnPropertyChanging(__.CatalogId, value)) { _CatalogId = value; OnPropertyChanged(__.CatalogId); } } }
|
||||
public Int32 CatalogId { get => _CatalogId; set { if (OnPropertyChanging("CatalogId", value)) { _CatalogId = value; OnPropertyChanged("CatalogId"); } } }
|
||||
|
||||
private Int32 _Counts;
|
||||
/// <summary>详情数量,缓存</summary>
|
||||
@@ -205,7 +209,7 @@ namespace COMCMS.Core
|
||||
[Description("详情数量,缓存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Counts", "详情数量,缓存", "")]
|
||||
public Int32 Counts { get { return _Counts; } set { if (OnPropertyChanging(__.Counts, value)) { _Counts = value; OnPropertyChanged(__.Counts); } } }
|
||||
public Int32 Counts { get => _Counts; set { if (OnPropertyChanging("Counts", value)) { _Counts = value; OnPropertyChanged("Counts"); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
@@ -213,7 +217,7 @@ namespace COMCMS.Core
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _Rank; } set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
public Int32 Rank { get => _Rank; set { if (OnPropertyChanging("Rank", value)) { _Rank = value; OnPropertyChanged("Rank"); } } }
|
||||
|
||||
private String _Icon;
|
||||
/// <summary>图标</summary>
|
||||
@@ -221,7 +225,7 @@ namespace COMCMS.Core
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
public String Icon { get => _Icon; set { if (OnPropertyChanging("Icon", value)) { _Icon = value; OnPropertyChanged("Icon"); } } }
|
||||
|
||||
private String _ClassName;
|
||||
/// <summary>样式名称</summary>
|
||||
@@ -229,7 +233,7 @@ namespace COMCMS.Core
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
public String ClassName { get => _ClassName; set { if (OnPropertyChanging("ClassName", value)) { _ClassName = value; OnPropertyChanged("ClassName"); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
/// <summary>banner图片</summary>
|
||||
@@ -237,7 +241,7 @@ namespace COMCMS.Core
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
public String BannerImg { get => _BannerImg; set { if (OnPropertyChanging("BannerImg", value)) { _BannerImg = value; OnPropertyChanged("BannerImg"); } } }
|
||||
|
||||
private String _KindInfo;
|
||||
/// <summary>栏目详细介绍</summary>
|
||||
@@ -245,7 +249,7 @@ namespace COMCMS.Core
|
||||
[Description("栏目详细介绍")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "")]
|
||||
public String KindInfo { get { return _KindInfo; } set { if (OnPropertyChanging(__.KindInfo, value)) { _KindInfo = value; OnPropertyChanged(__.KindInfo); } } }
|
||||
public String KindInfo { get => _KindInfo; set { if (OnPropertyChanging("KindInfo", value)) { _KindInfo = value; OnPropertyChanged("KindInfo"); } } }
|
||||
|
||||
private String _Pic;
|
||||
/// <summary>图片</summary>
|
||||
@@ -253,7 +257,7 @@ namespace COMCMS.Core
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
public String Pic { get => _Pic; set { if (OnPropertyChanging("Pic", value)) { _Pic = value; OnPropertyChanged("Pic"); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
/// <summary>广告ID</summary>
|
||||
@@ -261,7 +265,7 @@ namespace COMCMS.Core
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
public Int32 AdsId { get => _AdsId; set { if (OnPropertyChanging("AdsId", value)) { _AdsId = value; OnPropertyChanged("AdsId"); } } }
|
||||
|
||||
private String _FilePath;
|
||||
/// <summary>目录路径</summary>
|
||||
@@ -269,7 +273,15 @@ namespace COMCMS.Core
|
||||
[Description("目录路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("FilePath", "目录路径", "")]
|
||||
public String FilePath { get { return _FilePath; } set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
public String FilePath { get => _FilePath; set { if (OnPropertyChanging("FilePath", value)) { _FilePath = value; OnPropertyChanged("FilePath"); } } }
|
||||
|
||||
private String _AllowIp;
|
||||
/// <summary>IP地址限制。每一行一条记录,可以用“-”分割</summary>
|
||||
[DisplayName("IP地址限制")]
|
||||
[Description("IP地址限制。每一行一条记录,可以用“-”分割")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("AllowIp", "IP地址限制。每一行一条记录,可以用“-”分割", "")]
|
||||
public String AllowIp { get => _AllowIp; set { if (OnPropertyChanging("AllowIp", value)) { _AllowIp = value; OnPropertyChanged("AllowIp"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -282,38 +294,39 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.KindName : return _KindName;
|
||||
case __.SubTitle : return _SubTitle;
|
||||
case __.KindTitle : return _KindTitle;
|
||||
case __.Keyword : return _Keyword;
|
||||
case __.Description : return _Description;
|
||||
case __.LinkURL : return _LinkURL;
|
||||
case __.TitleColor : return _TitleColor;
|
||||
case __.TemplateFile : return _TemplateFile;
|
||||
case __.DetailTemplateFile : return _DetailTemplateFile;
|
||||
case __.KindDomain : return _KindDomain;
|
||||
case __.IsList : return _IsList;
|
||||
case __.PageSize : return _PageSize;
|
||||
case __.PId : return _PId;
|
||||
case __.Level : return _Level;
|
||||
case __.Location : return _Location;
|
||||
case __.IsHide : return _IsHide;
|
||||
case __.IsLock : return _IsLock;
|
||||
case __.IsDel : return _IsDel;
|
||||
case __.IsComment : return _IsComment;
|
||||
case __.IsMember : return _IsMember;
|
||||
case __.IsShowSubDetail : return _IsShowSubDetail;
|
||||
case __.CatalogId : return _CatalogId;
|
||||
case __.Counts : return _Counts;
|
||||
case __.Rank : return _Rank;
|
||||
case __.Icon : return _Icon;
|
||||
case __.ClassName : return _ClassName;
|
||||
case __.BannerImg : return _BannerImg;
|
||||
case __.KindInfo : return _KindInfo;
|
||||
case __.Pic : return _Pic;
|
||||
case __.AdsId : return _AdsId;
|
||||
case __.FilePath : return _FilePath;
|
||||
case "Id": return _Id;
|
||||
case "KindName": return _KindName;
|
||||
case "SubTitle": return _SubTitle;
|
||||
case "KindTitle": return _KindTitle;
|
||||
case "Keyword": return _Keyword;
|
||||
case "Description": return _Description;
|
||||
case "LinkURL": return _LinkURL;
|
||||
case "TitleColor": return _TitleColor;
|
||||
case "TemplateFile": return _TemplateFile;
|
||||
case "DetailTemplateFile": return _DetailTemplateFile;
|
||||
case "KindDomain": return _KindDomain;
|
||||
case "IsList": return _IsList;
|
||||
case "PageSize": return _PageSize;
|
||||
case "PId": return _PId;
|
||||
case "Level": return _Level;
|
||||
case "Location": return _Location;
|
||||
case "IsHide": return _IsHide;
|
||||
case "IsLock": return _IsLock;
|
||||
case "IsDel": return _IsDel;
|
||||
case "IsComment": return _IsComment;
|
||||
case "IsMember": return _IsMember;
|
||||
case "IsShowSubDetail": return _IsShowSubDetail;
|
||||
case "CatalogId": return _CatalogId;
|
||||
case "Counts": return _Counts;
|
||||
case "Rank": return _Rank;
|
||||
case "Icon": return _Icon;
|
||||
case "ClassName": return _ClassName;
|
||||
case "BannerImg": return _BannerImg;
|
||||
case "KindInfo": return _KindInfo;
|
||||
case "Pic": return _Pic;
|
||||
case "AdsId": return _AdsId;
|
||||
case "FilePath": return _FilePath;
|
||||
case "AllowIp": return _AllowIp;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -321,38 +334,39 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.KindName : _KindName = Convert.ToString(value); break;
|
||||
case __.SubTitle : _SubTitle = Convert.ToString(value); break;
|
||||
case __.KindTitle : _KindTitle = Convert.ToString(value); break;
|
||||
case __.Keyword : _Keyword = Convert.ToString(value); break;
|
||||
case __.Description : _Description = Convert.ToString(value); break;
|
||||
case __.LinkURL : _LinkURL = Convert.ToString(value); break;
|
||||
case __.TitleColor : _TitleColor = Convert.ToString(value); break;
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.DetailTemplateFile : _DetailTemplateFile = Convert.ToString(value); break;
|
||||
case __.KindDomain : _KindDomain = Convert.ToString(value); break;
|
||||
case __.IsList : _IsList = value.ToInt(); break;
|
||||
case __.PageSize : _PageSize = value.ToInt(); break;
|
||||
case __.PId : _PId = value.ToInt(); break;
|
||||
case __.Level : _Level = value.ToInt(); break;
|
||||
case __.Location : _Location = Convert.ToString(value); break;
|
||||
case __.IsHide : _IsHide = value.ToInt(); break;
|
||||
case __.IsLock : _IsLock = value.ToInt(); break;
|
||||
case __.IsDel : _IsDel = value.ToInt(); break;
|
||||
case __.IsComment : _IsComment = value.ToInt(); break;
|
||||
case __.IsMember : _IsMember = value.ToInt(); break;
|
||||
case __.IsShowSubDetail : _IsShowSubDetail = value.ToInt(); break;
|
||||
case __.CatalogId : _CatalogId = value.ToInt(); break;
|
||||
case __.Counts : _Counts = value.ToInt(); break;
|
||||
case __.Rank : _Rank = value.ToInt(); break;
|
||||
case __.Icon : _Icon = Convert.ToString(value); break;
|
||||
case __.ClassName : _ClassName = Convert.ToString(value); break;
|
||||
case __.BannerImg : _BannerImg = Convert.ToString(value); break;
|
||||
case __.KindInfo : _KindInfo = Convert.ToString(value); break;
|
||||
case __.Pic : _Pic = Convert.ToString(value); break;
|
||||
case __.AdsId : _AdsId = value.ToInt(); break;
|
||||
case __.FilePath : _FilePath = Convert.ToString(value); break;
|
||||
case "Id": _Id = value.ToInt(); break;
|
||||
case "KindName": _KindName = Convert.ToString(value); break;
|
||||
case "SubTitle": _SubTitle = Convert.ToString(value); break;
|
||||
case "KindTitle": _KindTitle = Convert.ToString(value); break;
|
||||
case "Keyword": _Keyword = Convert.ToString(value); break;
|
||||
case "Description": _Description = Convert.ToString(value); break;
|
||||
case "LinkURL": _LinkURL = Convert.ToString(value); break;
|
||||
case "TitleColor": _TitleColor = Convert.ToString(value); break;
|
||||
case "TemplateFile": _TemplateFile = Convert.ToString(value); break;
|
||||
case "DetailTemplateFile": _DetailTemplateFile = Convert.ToString(value); break;
|
||||
case "KindDomain": _KindDomain = Convert.ToString(value); break;
|
||||
case "IsList": _IsList = value.ToInt(); break;
|
||||
case "PageSize": _PageSize = value.ToInt(); break;
|
||||
case "PId": _PId = value.ToInt(); break;
|
||||
case "Level": _Level = value.ToInt(); break;
|
||||
case "Location": _Location = Convert.ToString(value); break;
|
||||
case "IsHide": _IsHide = value.ToInt(); break;
|
||||
case "IsLock": _IsLock = value.ToInt(); break;
|
||||
case "IsDel": _IsDel = value.ToInt(); break;
|
||||
case "IsComment": _IsComment = value.ToInt(); break;
|
||||
case "IsMember": _IsMember = value.ToInt(); break;
|
||||
case "IsShowSubDetail": _IsShowSubDetail = value.ToInt(); break;
|
||||
case "CatalogId": _CatalogId = value.ToInt(); break;
|
||||
case "Counts": _Counts = value.ToInt(); break;
|
||||
case "Rank": _Rank = value.ToInt(); break;
|
||||
case "Icon": _Icon = Convert.ToString(value); break;
|
||||
case "ClassName": _ClassName = Convert.ToString(value); break;
|
||||
case "BannerImg": _BannerImg = Convert.ToString(value); break;
|
||||
case "KindInfo": _KindInfo = Convert.ToString(value); break;
|
||||
case "Pic": _Pic = Convert.ToString(value); break;
|
||||
case "AdsId": _AdsId = value.ToInt(); break;
|
||||
case "FilePath": _FilePath = Convert.ToString(value); break;
|
||||
case "AllowIp": _AllowIp = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -364,102 +378,105 @@ namespace COMCMS.Core
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName(__.Id);
|
||||
public static readonly Field Id = FindByName("Id");
|
||||
|
||||
/// <summary>栏目名称</summary>
|
||||
public static readonly Field KindName = FindByName(__.KindName);
|
||||
public static readonly Field KindName = FindByName("KindName");
|
||||
|
||||
/// <summary>栏目副标题</summary>
|
||||
public static readonly Field SubTitle = FindByName(__.SubTitle);
|
||||
public static readonly Field SubTitle = FindByName("SubTitle");
|
||||
|
||||
/// <summary>栏目标题,填写则在浏览器替换此标题</summary>
|
||||
public static readonly Field KindTitle = FindByName(__.KindTitle);
|
||||
public static readonly Field KindTitle = FindByName("KindTitle");
|
||||
|
||||
/// <summary>描述</summary>
|
||||
public static readonly Field Keyword = FindByName(__.Keyword);
|
||||
public static readonly Field Keyword = FindByName("Keyword");
|
||||
|
||||
/// <summary>介绍</summary>
|
||||
public static readonly Field Description = FindByName(__.Description);
|
||||
public static readonly Field Description = FindByName("Description");
|
||||
|
||||
/// <summary>跳转链接</summary>
|
||||
public static readonly Field LinkURL = FindByName(__.LinkURL);
|
||||
public static readonly Field LinkURL = FindByName("LinkURL");
|
||||
|
||||
/// <summary>类别名称颜色</summary>
|
||||
public static readonly Field TitleColor = FindByName(__.TitleColor);
|
||||
public static readonly Field TitleColor = FindByName("TitleColor");
|
||||
|
||||
/// <summary>模板</summary>
|
||||
public static readonly Field TemplateFile = FindByName(__.TemplateFile);
|
||||
public static readonly Field TemplateFile = FindByName("TemplateFile");
|
||||
|
||||
/// <summary>详情模板</summary>
|
||||
public static readonly Field DetailTemplateFile = FindByName(__.DetailTemplateFile);
|
||||
public static readonly Field DetailTemplateFile = FindByName("DetailTemplateFile");
|
||||
|
||||
/// <summary>类别域名(保留)</summary>
|
||||
public static readonly Field KindDomain = FindByName(__.KindDomain);
|
||||
public static readonly Field KindDomain = FindByName("KindDomain");
|
||||
|
||||
/// <summary>是否为列表页面</summary>
|
||||
public static readonly Field IsList = FindByName(__.IsList);
|
||||
public static readonly Field IsList = FindByName("IsList");
|
||||
|
||||
/// <summary>每页显示数量</summary>
|
||||
public static readonly Field PageSize = FindByName(__.PageSize);
|
||||
public static readonly Field PageSize = FindByName("PageSize");
|
||||
|
||||
/// <summary>上级ID</summary>
|
||||
public static readonly Field PId = FindByName(__.PId);
|
||||
public static readonly Field PId = FindByName("PId");
|
||||
|
||||
/// <summary>级别</summary>
|
||||
public static readonly Field Level = FindByName(__.Level);
|
||||
public static readonly Field Level = FindByName("Level");
|
||||
|
||||
/// <summary>路径</summary>
|
||||
public static readonly Field Location = FindByName(__.Location);
|
||||
public static readonly Field Location = FindByName("Location");
|
||||
|
||||
/// <summary>是否隐藏</summary>
|
||||
public static readonly Field IsHide = FindByName(__.IsHide);
|
||||
public static readonly Field IsHide = FindByName("IsHide");
|
||||
|
||||
/// <summary>是否锁定,不允许删除</summary>
|
||||
public static readonly Field IsLock = FindByName(__.IsLock);
|
||||
public static readonly Field IsLock = FindByName("IsLock");
|
||||
|
||||
/// <summary>是否删除,已经删除到回收站</summary>
|
||||
public static readonly Field IsDel = FindByName(__.IsDel);
|
||||
public static readonly Field IsDel = FindByName("IsDel");
|
||||
|
||||
/// <summary>是否允许评论</summary>
|
||||
public static readonly Field IsComment = FindByName(__.IsComment);
|
||||
public static readonly Field IsComment = FindByName("IsComment");
|
||||
|
||||
/// <summary>是否会员栏目</summary>
|
||||
public static readonly Field IsMember = FindByName(__.IsMember);
|
||||
public static readonly Field IsMember = FindByName("IsMember");
|
||||
|
||||
/// <summary>是否显示下级栏目内容</summary>
|
||||
public static readonly Field IsShowSubDetail = FindByName(__.IsShowSubDetail);
|
||||
public static readonly Field IsShowSubDetail = FindByName("IsShowSubDetail");
|
||||
|
||||
/// <summary>模型ID</summary>
|
||||
public static readonly Field CatalogId = FindByName(__.CatalogId);
|
||||
public static readonly Field CatalogId = FindByName("CatalogId");
|
||||
|
||||
/// <summary>详情数量,缓存</summary>
|
||||
public static readonly Field Counts = FindByName(__.Counts);
|
||||
public static readonly Field Counts = FindByName("Counts");
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
public static readonly Field Rank = FindByName("Rank");
|
||||
|
||||
/// <summary>图标</summary>
|
||||
public static readonly Field Icon = FindByName(__.Icon);
|
||||
public static readonly Field Icon = FindByName("Icon");
|
||||
|
||||
/// <summary>样式名称</summary>
|
||||
public static readonly Field ClassName = FindByName(__.ClassName);
|
||||
public static readonly Field ClassName = FindByName("ClassName");
|
||||
|
||||
/// <summary>banner图片</summary>
|
||||
public static readonly Field BannerImg = FindByName(__.BannerImg);
|
||||
public static readonly Field BannerImg = FindByName("BannerImg");
|
||||
|
||||
/// <summary>栏目详细介绍</summary>
|
||||
public static readonly Field KindInfo = FindByName(__.KindInfo);
|
||||
public static readonly Field KindInfo = FindByName("KindInfo");
|
||||
|
||||
/// <summary>图片</summary>
|
||||
public static readonly Field Pic = FindByName(__.Pic);
|
||||
public static readonly Field Pic = FindByName("Pic");
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
public static readonly Field AdsId = FindByName(__.AdsId);
|
||||
public static readonly Field AdsId = FindByName("AdsId");
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public static readonly Field FilePath = FindByName(__.FilePath);
|
||||
public static readonly Field FilePath = FindByName("FilePath");
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
/// <summary>IP地址限制。每一行一条记录,可以用“-”分割</summary>
|
||||
public static readonly Field AllowIp = FindByName("AllowIp");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得文章栏目字段名称的快捷方式</summary>
|
||||
@@ -560,116 +577,10 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public const String FilePath = "FilePath";
|
||||
|
||||
/// <summary>IP地址限制。每一行一条记录,可以用“-”分割</summary>
|
||||
public const String AllowIp = "AllowIp";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>文章栏目接口</summary>
|
||||
public partial interface IArticleCategory
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>栏目名称</summary>
|
||||
String KindName { get; set; }
|
||||
|
||||
/// <summary>栏目副标题</summary>
|
||||
String SubTitle { get; set; }
|
||||
|
||||
/// <summary>栏目标题,填写则在浏览器替换此标题</summary>
|
||||
String KindTitle { get; set; }
|
||||
|
||||
/// <summary>描述</summary>
|
||||
String Keyword { get; set; }
|
||||
|
||||
/// <summary>介绍</summary>
|
||||
String Description { get; set; }
|
||||
|
||||
/// <summary>跳转链接</summary>
|
||||
String LinkURL { get; set; }
|
||||
|
||||
/// <summary>类别名称颜色</summary>
|
||||
String TitleColor { get; set; }
|
||||
|
||||
/// <summary>模板</summary>
|
||||
String TemplateFile { get; set; }
|
||||
|
||||
/// <summary>详情模板</summary>
|
||||
String DetailTemplateFile { get; set; }
|
||||
|
||||
/// <summary>类别域名(保留)</summary>
|
||||
String KindDomain { get; set; }
|
||||
|
||||
/// <summary>是否为列表页面</summary>
|
||||
Int32 IsList { get; set; }
|
||||
|
||||
/// <summary>每页显示数量</summary>
|
||||
Int32 PageSize { get; set; }
|
||||
|
||||
/// <summary>上级ID</summary>
|
||||
Int32 PId { get; set; }
|
||||
|
||||
/// <summary>级别</summary>
|
||||
Int32 Level { get; set; }
|
||||
|
||||
/// <summary>路径</summary>
|
||||
String Location { get; set; }
|
||||
|
||||
/// <summary>是否隐藏</summary>
|
||||
Int32 IsHide { get; set; }
|
||||
|
||||
/// <summary>是否锁定,不允许删除</summary>
|
||||
Int32 IsLock { get; set; }
|
||||
|
||||
/// <summary>是否删除,已经删除到回收站</summary>
|
||||
Int32 IsDel { get; set; }
|
||||
|
||||
/// <summary>是否允许评论</summary>
|
||||
Int32 IsComment { get; set; }
|
||||
|
||||
/// <summary>是否会员栏目</summary>
|
||||
Int32 IsMember { get; set; }
|
||||
|
||||
/// <summary>是否显示下级栏目内容</summary>
|
||||
Int32 IsShowSubDetail { get; set; }
|
||||
|
||||
/// <summary>模型ID</summary>
|
||||
Int32 CatalogId { get; set; }
|
||||
|
||||
/// <summary>详情数量,缓存</summary>
|
||||
Int32 Counts { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>图标</summary>
|
||||
String Icon { get; set; }
|
||||
|
||||
/// <summary>样式名称</summary>
|
||||
String ClassName { get; set; }
|
||||
|
||||
/// <summary>banner图片</summary>
|
||||
String BannerImg { get; set; }
|
||||
|
||||
/// <summary>栏目详细介绍</summary>
|
||||
String KindInfo { get; set; }
|
||||
|
||||
/// <summary>图片</summary>
|
||||
String Pic { get; set; }
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
Int32 AdsId { get; set; }
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
String FilePath { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.1212" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NewLife.XCode" Version="11.19.2025.501" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
using COMCMS.Common;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>Tag标签</summary>
|
||||
public partial class Tags : Entity<Tags>
|
||||
{
|
||||
#region 对象操作
|
||||
static Tags()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(Counts));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 建议先调用基类方法,基类方法会做一些统一处理
|
||||
base.Valid(isNew);
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Tags[Tag标签]数据……");
|
||||
|
||||
// var entity = new Tags();
|
||||
// entity.Id = 0;
|
||||
// entity.TagName = "abc";
|
||||
// entity.Keywords = "abc";
|
||||
// entity.Description = "abc";
|
||||
// entity.Counts = 0;
|
||||
// entity.Hits = 0;
|
||||
// entity.IsTop = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Tags[Tag标签]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Tags FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>根据Tag标签名称查找</summary>
|
||||
/// <param name="tagName">Tag标签名称</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<Tags> FindAllByTagName(String tagName)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TagName == tagName);
|
||||
|
||||
return FindAll(_.TagName == tagName);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="tagName">Tag标签名称</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<Tags> Search(String tagName, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (!tagName.IsNullOrEmpty()) exp &= _.TagName == tagName;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.Keywords.Contains(key) | _.Description.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(Id) as Id,TagName From Tags Where CreateTime>'2020-01-24 00:00:00' Group By TagName Order By Id Desc limit 20
|
||||
static readonly FieldCache<Tags> _TagNameCache = new FieldCache<Tags>(nameof(TagName))
|
||||
{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
};
|
||||
|
||||
/// <summary>获取Tag标签名称列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
/// <returns></returns>
|
||||
public static IDictionary<String, String> GetTagNameList() => _TagNameCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>
|
||||
/// 添加新的TAG标签
|
||||
/// </summary>
|
||||
/// <param name="listtag">标签,原始,用“,”隔开的字符串</param>
|
||||
/// <param name="xtypeid">类型</param>
|
||||
/// <param name="rid">目标ID,文章ID,商品ID等...</param>
|
||||
/// <param name="tagtitle">目标标题,文章标题,商品标题等(缓存用的)</param>
|
||||
public static void InsertTags(string listtag, Utils.CMSType xtypeid, int rid, string tagtitle)
|
||||
{
|
||||
//流程:分割TAG,遍历标签;判断是否存在;插入。
|
||||
//1、分割标签
|
||||
if (!string.IsNullOrEmpty(listtag))
|
||||
{
|
||||
string[] arrtags = listtag.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (arrtags != null && arrtags.Length > 0)
|
||||
{
|
||||
foreach (string s in arrtags)
|
||||
{
|
||||
//2、单个标签处理
|
||||
if (!string.IsNullOrEmpty(s) && Utils.GetStringLength(s.Trim()) < 100)
|
||||
{
|
||||
TagsDetail tagsDetail = new TagsDetail();
|
||||
Tags tmptag = new Tags();
|
||||
|
||||
//判断是否存在这个标签
|
||||
if (FindCount(_.TagName == s.Trim(), null, null, 0, 0) > 0)
|
||||
{
|
||||
tmptag = Find(_.TagName == s.Trim()); //GetModel(s.Trim());
|
||||
tmptag.Counts = tmptag.Counts + 1;
|
||||
tmptag.Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
tmptag = new Tags()
|
||||
{
|
||||
AddTime = DateTime.Now,
|
||||
Counts = 1,
|
||||
Description = "",
|
||||
Hits = 0,
|
||||
IsTop = 0,
|
||||
Keywords = "",
|
||||
TagName = s.Trim(),
|
||||
};
|
||||
tmptag.Insert();
|
||||
}
|
||||
tagsDetail.RId = rid;
|
||||
tagsDetail.TypeId = xtypeid.ToInt();
|
||||
tagsDetail.TagName = s.Trim();
|
||||
tagsDetail.TagsId = tmptag.Id;
|
||||
tagsDetail.Title = tagtitle;
|
||||
tagsDetail.Hits = 0;
|
||||
tagsDetail.AddTime = DateTime.Now;
|
||||
tagsDetail.Insert();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 编辑标签
|
||||
/// <summary>
|
||||
/// 编辑Tag标签
|
||||
/// </summary>
|
||||
/// <param name="listtag">标签,原始,用“,”隔开的字符串</param>
|
||||
/// <param name="xtypeid">类型</param>
|
||||
/// <param name="rid">目标ID,文章ID,商品ID等...</param>
|
||||
/// <param name="tagtitle">目标标题,文章标题,商品标题等(缓存用的)</param>
|
||||
public static void ModifyTags(string listtag, Utils.CMSType xtypeid, int rid, string tagtitle)
|
||||
{
|
||||
IList<TagsDetail> listdetail = TagsDetail.FindAll(TagsDetail._.RId == rid & TagsDetail._.TypeId == (int)xtypeid, null, null, 0, 0);
|
||||
if (!string.IsNullOrEmpty(listtag))
|
||||
{
|
||||
string[] arrtags = listtag.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (arrtags != null && arrtags.Length > 0)
|
||||
{
|
||||
foreach (string s in arrtags)
|
||||
{
|
||||
//2、单个标签处理 只有 添加或者 删除。没有修改的
|
||||
if (!string.IsNullOrEmpty(s) && Utils.GetStringLength(s.Trim()) < 100)
|
||||
{
|
||||
//判断是否存在
|
||||
var td = listdetail.Find(x => x.TagName == s.Trim());
|
||||
if(td == null)
|
||||
{
|
||||
TagsDetail tagsDetail = new TagsDetail();
|
||||
Tags tmptag = new Tags();
|
||||
|
||||
//判断是否存在这个标签
|
||||
if (FindCount(_.TagName == s.Trim(), null, null, 0, 0) > 0)
|
||||
{
|
||||
tmptag = Find(_.TagName == s.Trim()); //GetModel(s.Trim());
|
||||
tmptag.Counts = tmptag.Counts + 1;
|
||||
tmptag.Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
tmptag = new Tags()
|
||||
{
|
||||
AddTime = DateTime.Now,
|
||||
Counts = 1,
|
||||
Description = "",
|
||||
Hits = 0,
|
||||
IsTop = 0,
|
||||
Keywords = "",
|
||||
TagName = s.Trim(),
|
||||
};
|
||||
tmptag.Insert();
|
||||
}
|
||||
tagsDetail.RId = rid;
|
||||
tagsDetail.TypeId = xtypeid.ToInt();
|
||||
tagsDetail.TagName = s.Trim();
|
||||
tagsDetail.TagsId = tmptag.Id;
|
||||
tagsDetail.Title = tagtitle;
|
||||
tagsDetail.Hits = 0;
|
||||
tagsDetail.AddTime = DateTime.Now;
|
||||
tagsDetail.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
listdetail.Remove(td);
|
||||
|
||||
var tmptag = Find(_.TagName == s.Trim());
|
||||
if(tmptag != null)
|
||||
{
|
||||
long counts = TagsDetail.FindCount(TagsDetail._.TagName == s.Trim(), null, null, 0, 0);
|
||||
if (counts == 0)
|
||||
tmptag.Delete();
|
||||
else
|
||||
{
|
||||
tmptag.Counts = (int)counts;
|
||||
tmptag.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除标签
|
||||
/// <summary>
|
||||
/// 删除标签
|
||||
/// </summary>
|
||||
/// <param name="listtag">标签集合</param>
|
||||
public static void DeleteTag(string listtag, Utils.CMSType xtypeid, int rid)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(listtag))
|
||||
{
|
||||
|
||||
string[] arrtags = listtag.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
if (arrtags != null && arrtags.Length > 0)
|
||||
{
|
||||
foreach (var s in arrtags)
|
||||
{
|
||||
var tmp = TagsDetail.Find(TagsDetail._.TypeId == xtypeid.ToInt() & TagsDetail._.TagName == s.Trim() & TagsDetail._.RId == rid);
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>Tag标签</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("Tag标签")]
|
||||
[BindIndex("IX_Tags_TagName", false, "TagName")]
|
||||
[BindTable("Tags", Description = "Tag标签", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class Tags
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
|
||||
|
||||
private String _TagName;
|
||||
/// <summary>Tag标签名称</summary>
|
||||
[DisplayName("Tag标签名称")]
|
||||
[Description("Tag标签名称")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("TagName", "Tag标签名称", "")]
|
||||
public String TagName { get => _TagName; set { if (OnPropertyChanging("TagName", value)) { _TagName = value; OnPropertyChanged("TagName"); } } }
|
||||
|
||||
private String _Keywords;
|
||||
/// <summary>标签关键词</summary>
|
||||
[DisplayName("标签关键词")]
|
||||
[Description("标签关键词")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keywords", "标签关键词", "")]
|
||||
public String Keywords { get => _Keywords; set { if (OnPropertyChanging("Keywords", value)) { _Keywords = value; OnPropertyChanged("Keywords"); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>标签描述</summary>
|
||||
[DisplayName("标签描述")]
|
||||
[Description("标签描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "标签描述", "")]
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging("Description", value)) { _Description = value; OnPropertyChanged("Description"); } } }
|
||||
|
||||
private Int32 _Counts;
|
||||
/// <summary>数量</summary>
|
||||
[DisplayName("数量")]
|
||||
[Description("数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Counts", "数量", "")]
|
||||
public Int32 Counts { get => _Counts; set { if (OnPropertyChanging("Counts", value)) { _Counts = value; OnPropertyChanged("Counts"); } } }
|
||||
|
||||
private Int32 _Hits;
|
||||
/// <summary>点击量</summary>
|
||||
[DisplayName("点击量")]
|
||||
[Description("点击量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Hits", "点击量", "")]
|
||||
public Int32 Hits { get => _Hits; set { if (OnPropertyChanging("Hits", value)) { _Hits = value; OnPropertyChanged("Hits"); } } }
|
||||
|
||||
private Int32 _IsTop;
|
||||
/// <summary>置顶否</summary>
|
||||
[DisplayName("置顶否")]
|
||||
[Description("置顶否")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsTop", "置顶否", "")]
|
||||
public Int32 IsTop { get => _IsTop; set { if (OnPropertyChanging("IsTop", value)) { _IsTop = value; OnPropertyChanged("IsTop"); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging("AddTime", value)) { _AddTime = value; OnPropertyChanged("AddTime"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": return _Id;
|
||||
case "TagName": return _TagName;
|
||||
case "Keywords": return _Keywords;
|
||||
case "Description": return _Description;
|
||||
case "Counts": return _Counts;
|
||||
case "Hits": return _Hits;
|
||||
case "IsTop": return _IsTop;
|
||||
case "AddTime": return _AddTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": _Id = value.ToInt(); break;
|
||||
case "TagName": _TagName = Convert.ToString(value); break;
|
||||
case "Keywords": _Keywords = Convert.ToString(value); break;
|
||||
case "Description": _Description = Convert.ToString(value); break;
|
||||
case "Counts": _Counts = value.ToInt(); break;
|
||||
case "Hits": _Hits = value.ToInt(); break;
|
||||
case "IsTop": _IsTop = value.ToInt(); break;
|
||||
case "AddTime": _AddTime = value.ToDateTime(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得Tag标签字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName("Id");
|
||||
|
||||
/// <summary>Tag标签名称</summary>
|
||||
public static readonly Field TagName = FindByName("TagName");
|
||||
|
||||
/// <summary>标签关键词</summary>
|
||||
public static readonly Field Keywords = FindByName("Keywords");
|
||||
|
||||
/// <summary>标签描述</summary>
|
||||
public static readonly Field Description = FindByName("Description");
|
||||
|
||||
/// <summary>数量</summary>
|
||||
public static readonly Field Counts = FindByName("Counts");
|
||||
|
||||
/// <summary>点击量</summary>
|
||||
public static readonly Field Hits = FindByName("Hits");
|
||||
|
||||
/// <summary>置顶否</summary>
|
||||
public static readonly Field IsTop = FindByName("IsTop");
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName("AddTime");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得Tag标签字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>Tag标签名称</summary>
|
||||
public const String TagName = "TagName";
|
||||
|
||||
/// <summary>标签关键词</summary>
|
||||
public const String Keywords = "Keywords";
|
||||
|
||||
/// <summary>标签描述</summary>
|
||||
public const String Description = "Description";
|
||||
|
||||
/// <summary>数量</summary>
|
||||
public const String Counts = "Counts";
|
||||
|
||||
/// <summary>点击量</summary>
|
||||
public const String Hits = "Hits";
|
||||
|
||||
/// <summary>置顶否</summary>
|
||||
public const String IsTop = "IsTop";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>Tag标签详情</summary>
|
||||
public partial class TagsDetail : Entity<TagsDetail>
|
||||
{
|
||||
#region 对象操作
|
||||
static TagsDetail()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(TagsId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 建议先调用基类方法,基类方法会做一些统一处理
|
||||
base.Valid(isNew);
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化TagsDetail[Tag标签详情]数据……");
|
||||
|
||||
// var entity = new TagsDetail();
|
||||
// entity.Id = 0;
|
||||
// entity.TagsId = 0;
|
||||
// entity.TagName = "abc";
|
||||
// entity.TypeId = 0;
|
||||
// entity.Title = "abc";
|
||||
// entity.Hits = 0;
|
||||
// entity.RId = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化TagsDetail[Tag标签详情]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static TagsDetail FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>根据类型查找</summary>
|
||||
/// <param name="typeId">类型</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<TagsDetail> FindAllByTypeId(Int32 typeId)
|
||||
{
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.FindAll(e => e.TypeId == typeId);
|
||||
|
||||
return FindAll(_.TypeId == typeId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>高级查询</summary>
|
||||
/// <param name="typeId">类型</param>
|
||||
/// <param name="key">关键字</param>
|
||||
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
|
||||
/// <returns>实体列表</returns>
|
||||
public static IList<TagsDetail> Search(Int32 typeId, String key, PageParameter page)
|
||||
{
|
||||
var exp = new WhereExpression();
|
||||
|
||||
if (typeId >= 0) exp &= _.TypeId == typeId;
|
||||
if (!key.IsNullOrEmpty()) exp &= _.TagName.Contains(key) | _.Title.Contains(key);
|
||||
|
||||
return FindAll(exp, page);
|
||||
}
|
||||
|
||||
// Select Count(Id) as Id,Category From TagsDetail Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By Id Desc limit 20
|
||||
//static readonly FieldCache<TagsDetail> _CategoryCache = new FieldCache<TagsDetail>(nameof(Category))
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>Tag标签详情</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("Tag标签详情")]
|
||||
[BindIndex("IX_TagsDetail_TypeId", false, "TypeId")]
|
||||
[BindTable("TagsDetail", Description = "Tag标签详情", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class TagsDetail
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
|
||||
|
||||
private Int32 _TagsId;
|
||||
/// <summary>所属标签ID</summary>
|
||||
[DisplayName("所属标签ID")]
|
||||
[Description("所属标签ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TagsId", "所属标签ID", "")]
|
||||
public Int32 TagsId { get => _TagsId; set { if (OnPropertyChanging("TagsId", value)) { _TagsId = value; OnPropertyChanged("TagsId"); } } }
|
||||
|
||||
private String _TagName;
|
||||
/// <summary>Tag标签名称</summary>
|
||||
[DisplayName("Tag标签名称")]
|
||||
[Description("Tag标签名称")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("TagName", "Tag标签名称", "")]
|
||||
public String TagName { get => _TagName; set { if (OnPropertyChanging("TagName", value)) { _TagName = value; OnPropertyChanged("TagName"); } } }
|
||||
|
||||
private Int32 _TypeId;
|
||||
/// <summary>类型</summary>
|
||||
[DisplayName("类型")]
|
||||
[Description("类型")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TypeId", "类型", "")]
|
||||
public Int32 TypeId { get => _TypeId; set { if (OnPropertyChanging("TypeId", value)) { _TypeId = value; OnPropertyChanged("TypeId"); } } }
|
||||
|
||||
private String _Title;
|
||||
/// <summary>标题</summary>
|
||||
[DisplayName("标题")]
|
||||
[Description("标题")]
|
||||
[DataObjectField(false, false, true, 255)]
|
||||
[BindColumn("Title", "标题", "", Master = true)]
|
||||
public String Title { get => _Title; set { if (OnPropertyChanging("Title", value)) { _Title = value; OnPropertyChanged("Title"); } } }
|
||||
|
||||
private Int32 _Hits;
|
||||
/// <summary>点击量</summary>
|
||||
[DisplayName("点击量")]
|
||||
[Description("点击量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Hits", "点击量", "")]
|
||||
public Int32 Hits { get => _Hits; set { if (OnPropertyChanging("Hits", value)) { _Hits = value; OnPropertyChanged("Hits"); } } }
|
||||
|
||||
private Int32 _RId;
|
||||
/// <summary>目标Id</summary>
|
||||
[DisplayName("目标Id")]
|
||||
[Description("目标Id")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("RId", "目标Id", "")]
|
||||
public Int32 RId { get => _RId; set { if (OnPropertyChanging("RId", value)) { _RId = value; OnPropertyChanged("RId"); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging("AddTime", value)) { _AddTime = value; OnPropertyChanged("AddTime"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": return _Id;
|
||||
case "TagsId": return _TagsId;
|
||||
case "TagName": return _TagName;
|
||||
case "TypeId": return _TypeId;
|
||||
case "Title": return _Title;
|
||||
case "Hits": return _Hits;
|
||||
case "RId": return _RId;
|
||||
case "AddTime": return _AddTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": _Id = value.ToInt(); break;
|
||||
case "TagsId": _TagsId = value.ToInt(); break;
|
||||
case "TagName": _TagName = Convert.ToString(value); break;
|
||||
case "TypeId": _TypeId = value.ToInt(); break;
|
||||
case "Title": _Title = Convert.ToString(value); break;
|
||||
case "Hits": _Hits = value.ToInt(); break;
|
||||
case "RId": _RId = value.ToInt(); break;
|
||||
case "AddTime": _AddTime = value.ToDateTime(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得Tag标签详情字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName("Id");
|
||||
|
||||
/// <summary>所属标签ID</summary>
|
||||
public static readonly Field TagsId = FindByName("TagsId");
|
||||
|
||||
/// <summary>Tag标签名称</summary>
|
||||
public static readonly Field TagName = FindByName("TagName");
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public static readonly Field TypeId = FindByName("TypeId");
|
||||
|
||||
/// <summary>标题</summary>
|
||||
public static readonly Field Title = FindByName("Title");
|
||||
|
||||
/// <summary>点击量</summary>
|
||||
public static readonly Field Hits = FindByName("Hits");
|
||||
|
||||
/// <summary>目标Id</summary>
|
||||
public static readonly Field RId = FindByName("RId");
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName("AddTime");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得Tag标签详情字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>所属标签ID</summary>
|
||||
public const String TagsId = "TagsId";
|
||||
|
||||
/// <summary>Tag标签名称</summary>
|
||||
public const String TagName = "TagName";
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public const String TypeId = "TypeId";
|
||||
|
||||
/// <summary>标题</summary>
|
||||
public const String Title = "Title";
|
||||
|
||||
/// <summary>点击量</summary>
|
||||
public const String Hits = "Hits";
|
||||
|
||||
/// <summary>目标Id</summary>
|
||||
public const String RId = "RId";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using COMCMS.Core;
|
||||
using COMCMS.Common;
|
||||
using XCode;
|
||||
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 识图方法
|
||||
/// </summary>
|
||||
public class ViewsHelper
|
||||
{
|
||||
#region 获取分类链接
|
||||
/// <summary>
|
||||
/// 文章分类
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(ArticleCategory model)
|
||||
{
|
||||
if (model == null)
|
||||
return "javascript:;";
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
return model.FilePath + "/index.html";
|
||||
else
|
||||
return $"/article/index/{model.Id}";
|
||||
}
|
||||
/// <summary>
|
||||
/// 商品分类
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(Category model)
|
||||
{
|
||||
if (model == null)
|
||||
return "javascript:;";
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
return model.FilePath + "/index.html";
|
||||
else
|
||||
return $"/product/index/{model.Id}";
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成文章详情地址
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(Article model)
|
||||
{
|
||||
if (model == null)
|
||||
return "javascript:;";
|
||||
|
||||
ArticleCategory categoty = ArticleCategory.FindById(model.KId);
|
||||
|
||||
if (categoty != null && !string.IsNullOrEmpty(categoty.FilePath))
|
||||
{
|
||||
string url = $"{categoty.FilePath}/{model.Id}.html";
|
||||
if (!string.IsNullOrEmpty(model.FileName))
|
||||
{
|
||||
url = $"{categoty.FilePath}/{model.FileName}";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
else
|
||||
return $"/article/detail/{model.Id}";
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 商品
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(Product model)
|
||||
{
|
||||
if (model == null)
|
||||
return "javascript:;";
|
||||
|
||||
Category categoty = Category.FindById(model.KId);
|
||||
|
||||
if (categoty != null && !string.IsNullOrEmpty(categoty.FilePath))
|
||||
{
|
||||
string url = $"{categoty.FilePath}/{model.Id}.html";
|
||||
if (!string.IsNullOrEmpty(model.FileName))
|
||||
{
|
||||
url = $"{categoty.FilePath}/{model.FileName}";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
else
|
||||
return $"/product/detail/{model.Id}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="ctype"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(Utils.CMSType ctype, int id)
|
||||
{
|
||||
string url = "/";
|
||||
switch (ctype)
|
||||
{
|
||||
case Utils.CMSType.ArticleCategory:
|
||||
ArticleCategory ac = ArticleCategory.FindById(id);
|
||||
url = EchoURL(ac);
|
||||
break;
|
||||
case Utils.CMSType.ProductCategory:
|
||||
Category pc = Category.FindById(id);
|
||||
url = EchoURL(pc);
|
||||
break;
|
||||
case Utils.CMSType.Article:
|
||||
Article a = Article.FindById(id);
|
||||
url = EchoURL(a);
|
||||
break;
|
||||
case Utils.CMSType.Product:
|
||||
Product p = Product.FindById(id);
|
||||
url = EchoURL(p);
|
||||
break;
|
||||
default:
|
||||
url = "/";
|
||||
break;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生成详情地址
|
||||
/// <summary>
|
||||
/// 生成文章详情地址
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoArticleURL(Article model)
|
||||
{
|
||||
if (model == null)
|
||||
return "javascript:;";
|
||||
|
||||
if (!string.IsNullOrEmpty(model.ArticleKind.FilePath))
|
||||
{
|
||||
string url = $"{model.ArticleKind.FilePath}/{model.Id}.html";
|
||||
if (!string.IsNullOrEmpty(model.FileName))
|
||||
{
|
||||
url = $"{model.ArticleKind.FilePath}/{model.FileName}";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
else
|
||||
return $"/article/detail/{model.Id}";
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成文章详情地址
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoArticleURL(int id)
|
||||
{
|
||||
Article model = Article.FindById(id);
|
||||
return EchoArticleURL(model);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生成商品地址
|
||||
/// <summary>
|
||||
/// 生成商品分类地址
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoCategoryURL(int id)
|
||||
{
|
||||
Category model = Category.FindById(id);
|
||||
return EchoURL(model);
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成商品详情地址
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoProductURL(int id)
|
||||
{
|
||||
Product model = Product.FindById(id);
|
||||
return EchoURL(model);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>小程序Session</summary>
|
||||
public partial class WXAppSession : Entity<WXAppSession>
|
||||
{
|
||||
#region 对象操作
|
||||
static WXAppSession()
|
||||
{
|
||||
// 累加字段
|
||||
//Meta.Factory.AdditionalFields.Add(__.Logins);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化WXAppSession[小程序Session]数据……");
|
||||
|
||||
// var entity = new WXAppSession();
|
||||
// entity.Id = 0;
|
||||
// entity.UId = 0;
|
||||
// entity.IP = "abc";
|
||||
// entity.Key = "abc";
|
||||
// entity.SessionKey = "abc";
|
||||
// entity.OpenId = "abc";
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化WXAppSession[小程序Session]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static WXAppSession FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache[id];
|
||||
|
||||
return Find(_.Id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>小程序Session</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("小程序Session")]
|
||||
[BindTable("WXAppSession", Description = "小程序Session", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class WXAppSession : IWXAppSession
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private Int32 _UId;
|
||||
/// <summary>用户ID</summary>
|
||||
[DisplayName("用户ID")]
|
||||
[Description("用户ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UId", "用户ID", "int")]
|
||||
public Int32 UId { get { return _UId; } set { if (OnPropertyChanging(__.UId, value)) { _UId = value; OnPropertyChanged(__.UId); } } }
|
||||
|
||||
private String _IP;
|
||||
/// <summary>登录IP</summary>
|
||||
[DisplayName("登录IP")]
|
||||
[Description("登录IP")]
|
||||
[DataObjectField(false, false, true, 20)]
|
||||
[BindColumn("IP", "登录IP", "nvarchar(20)")]
|
||||
public String IP { get { return _IP; } set { if (OnPropertyChanging(__.IP, value)) { _IP = value; OnPropertyChanged(__.IP); } } }
|
||||
|
||||
private String _Key;
|
||||
/// <summary>系统生成Key</summary>
|
||||
[DisplayName("系统生成Key")]
|
||||
[Description("系统生成Key")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Key", "系统生成Key", "nvarchar(50)")]
|
||||
public String Key { get { return _Key; } set { if (OnPropertyChanging(__.Key, value)) { _Key = value; OnPropertyChanged(__.Key); } } }
|
||||
|
||||
private String _SessionKey;
|
||||
/// <summary>微信SessionKey</summary>
|
||||
[DisplayName("微信SessionKey")]
|
||||
[Description("微信SessionKey")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("SessionKey", "微信SessionKey", "nvarchar(50)")]
|
||||
public String SessionKey { get { return _SessionKey; } set { if (OnPropertyChanging(__.SessionKey, value)) { _SessionKey = value; OnPropertyChanged(__.SessionKey); } } }
|
||||
|
||||
private String _OpenId;
|
||||
/// <summary>微信小程序OpenId</summary>
|
||||
[DisplayName("微信小程序OpenId")]
|
||||
[Description("微信小程序OpenId")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("OpenId", "微信小程序OpenId", "nvarchar(50)")]
|
||||
public String OpenId { get { return _OpenId; } set { if (OnPropertyChanging(__.OpenId, value)) { _OpenId = value; OnPropertyChanged(__.OpenId); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "datetime")]
|
||||
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.UId : return _UId;
|
||||
case __.IP : return _IP;
|
||||
case __.Key : return _Key;
|
||||
case __.SessionKey : return _SessionKey;
|
||||
case __.OpenId : return _OpenId;
|
||||
case __.AddTime : return _AddTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.UId : _UId = Convert.ToInt32(value); break;
|
||||
case __.IP : _IP = Convert.ToString(value); break;
|
||||
case __.Key : _Key = Convert.ToString(value); break;
|
||||
case __.SessionKey : _SessionKey = Convert.ToString(value); break;
|
||||
case __.OpenId : _OpenId = Convert.ToString(value); break;
|
||||
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得小程序Session字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName(__.Id);
|
||||
|
||||
/// <summary>用户ID</summary>
|
||||
public static readonly Field UId = FindByName(__.UId);
|
||||
|
||||
/// <summary>登录IP</summary>
|
||||
public static readonly Field IP = FindByName(__.IP);
|
||||
|
||||
/// <summary>系统生成Key</summary>
|
||||
public static readonly Field Key = FindByName(__.Key);
|
||||
|
||||
/// <summary>微信SessionKey</summary>
|
||||
public static readonly Field SessionKey = FindByName(__.SessionKey);
|
||||
|
||||
/// <summary>微信小程序OpenId</summary>
|
||||
public static readonly Field OpenId = FindByName(__.OpenId);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
/// <summary>取得小程序Session字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>用户ID</summary>
|
||||
public const String UId = "UId";
|
||||
|
||||
/// <summary>登录IP</summary>
|
||||
public const String IP = "IP";
|
||||
|
||||
/// <summary>系统生成Key</summary>
|
||||
public const String Key = "Key";
|
||||
|
||||
/// <summary>微信SessionKey</summary>
|
||||
public const String SessionKey = "SessionKey";
|
||||
|
||||
/// <summary>微信小程序OpenId</summary>
|
||||
public const String OpenId = "OpenId";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>小程序Session接口</summary>
|
||||
public partial interface IWXAppSession
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>用户ID</summary>
|
||||
Int32 UId { get; set; }
|
||||
|
||||
/// <summary>登录IP</summary>
|
||||
String IP { get; set; }
|
||||
|
||||
/// <summary>系统生成Key</summary>
|
||||
String Key { get; set; }
|
||||
|
||||
/// <summary>微信SessionKey</summary>
|
||||
String SessionKey { get; set; }
|
||||
|
||||
/// <summary>微信小程序OpenId</summary>
|
||||
String OpenId { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>数据字典</summary>
|
||||
public partial class DataDictionary : Entity<DataDictionary>
|
||||
{
|
||||
#region 对象操作
|
||||
static DataDictionary()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(__.Rank);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化DataDictionary[数据字典]数据……");
|
||||
|
||||
// var entity = new DataDictionary();
|
||||
// entity.Id = 0;
|
||||
// entity.Key = "abc";
|
||||
// entity.Description = "abc";
|
||||
// entity.Rank = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化DataDictionary[数据字典]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static DataDictionary FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.Id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
|
||||
// Select Count(Id) as Id,Category From DataDictionary Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By Id Desc limit 20
|
||||
//static readonly FieldCache<DataDictionary> _CategoryCache = new FieldCache<DataDictionary>(_.Category)
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>
|
||||
/// 获取数据字典到Select控件
|
||||
/// </summary>
|
||||
/// <param name="dictKey">字典key</param>
|
||||
/// <param name="selectedVal">选中值</param>
|
||||
/// <param name="id">下拉表单的Id和Name</param>
|
||||
/// <param name="className">样式名称</param>
|
||||
/// <returns></returns>
|
||||
public static String GetDataDictSelect(string dictKey,string selectedVal,string id,string className= "form-control")
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"<select name=\"{id}\" id=\"{id}\" class=\"{className}\">");
|
||||
|
||||
var entity = DataDictionary.Find(DataDictionary._.Key == dictKey);
|
||||
if (entity != null)
|
||||
{
|
||||
IList<DataDictionaryDetail> list = DataDictionaryDetail.FindAll(DataDictionaryDetail._.DataDictionaryId == entity.Id, DataDictionaryDetail._.Rank.Asc().And(DataDictionaryDetail._.Id.Desc()), null, 0, 0);
|
||||
foreach (var item in list)
|
||||
{
|
||||
string selected = item.Val == selectedVal ? "selected=\"selected\"" : "";
|
||||
sb.Append($"<option value=\"{item.Val}\" {selected} >{item.Title}</option>");
|
||||
}
|
||||
}
|
||||
sb.Append("</select>");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>数据字典</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("数据字典")]
|
||||
[BindTable("DataDictionary", Description = "数据字典", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class DataDictionary : IDataDictionary
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _Key;
|
||||
/// <summary>字典key</summary>
|
||||
[DisplayName("字典key")]
|
||||
[Description("字典key")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Key", "字典key", "")]
|
||||
public String Key { get => _Key; set { if (OnPropertyChanging(__.Key, value)) { _Key = value; OnPropertyChanged(__.Key); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>字典介绍</summary>
|
||||
[DisplayName("字典介绍")]
|
||||
[Description("字典介绍")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Description", "字典介绍", "")]
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get => _Rank; set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id: return _Id;
|
||||
case __.Key: return _Key;
|
||||
case __.Description: return _Description;
|
||||
case __.Rank: return _Rank;
|
||||
case __.AddTime: return _AddTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id: _Id = value.ToInt(); break;
|
||||
case __.Key: _Key = Convert.ToString(value); break;
|
||||
case __.Description: _Description = Convert.ToString(value); break;
|
||||
case __.Rank: _Rank = value.ToInt(); break;
|
||||
case __.AddTime: _AddTime = value.ToDateTime(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得数据字典字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName(__.Id);
|
||||
|
||||
/// <summary>字典key</summary>
|
||||
public static readonly Field Key = FindByName(__.Key);
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
public static readonly Field Description = FindByName(__.Description);
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得数据字典字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>字典key</summary>
|
||||
public const String Key = "Key";
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
public const String Description = "Description";
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public const String Rank = "Rank";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>数据字典接口</summary>
|
||||
public partial interface IDataDictionary
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>字典key</summary>
|
||||
String Key { get; set; }
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
String Description { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>数据字典详情</summary>
|
||||
public partial class DataDictionaryDetail : Entity<DataDictionaryDetail>
|
||||
{
|
||||
#region 对象操作
|
||||
static DataDictionaryDetail()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(__.DataDictionaryId);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化DataDictionaryDetail[数据字典详情]数据……");
|
||||
|
||||
// var entity = new DataDictionaryDetail();
|
||||
// entity.Id = 0;
|
||||
// entity.DataDictionaryId = 0;
|
||||
// entity.Val = "abc";
|
||||
// entity.Title = "abc";
|
||||
// entity.Description = "abc";
|
||||
// entity.Rank = 0;
|
||||
// entity.IsDefault = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化DataDictionaryDetail[数据字典详情]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
///// <summary>字典ID</summary>
|
||||
//[XmlIgnore, IgnoreDataMember]
|
||||
////[ScriptIgnore]
|
||||
//public DataDictionary DataDictionary => Extends.Get(nameof(DataDictionary), k => DataDictionary.FindById(DataDictionaryId));
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static DataDictionaryDetail FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.Id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
|
||||
// Select Count(Id) as Id,Category From DataDictionaryDetail Where CreateTime>'2020-01-24 00:00:00' Group By Category Order By Id Desc limit 20
|
||||
//static readonly FieldCache<DataDictionaryDetail> _CategoryCache = new FieldCache<DataDictionaryDetail>(_.Category)
|
||||
//{
|
||||
//Where = _.CreateTime > DateTime.Today.AddDays(-30) & Expression.Empty
|
||||
//};
|
||||
|
||||
///// <summary>获取类别列表,字段缓存10分钟,分组统计数据最多的前20种,用于魔方前台下拉选择</summary>
|
||||
///// <returns></returns>
|
||||
//public static IDictionary<String, String> GetCategoryList() => _CategoryCache.FindAllName();
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>数据字典详情</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("数据字典详情")]
|
||||
[BindTable("DataDictionaryDetail", Description = "数据字典详情", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class DataDictionaryDetail : IDataDictionaryDetail
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private Int32 _DataDictionaryId;
|
||||
/// <summary>字典ID</summary>
|
||||
[DisplayName("字典ID")]
|
||||
[Description("字典ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("DataDictionaryId", "字典ID", "")]
|
||||
public Int32 DataDictionaryId { get => _DataDictionaryId; set { if (OnPropertyChanging(__.DataDictionaryId, value)) { _DataDictionaryId = value; OnPropertyChanged(__.DataDictionaryId); } } }
|
||||
|
||||
private String _Val;
|
||||
/// <summary>字典值</summary>
|
||||
[DisplayName("字典值")]
|
||||
[Description("字典值")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Val", "字典值", "")]
|
||||
public String Val { get => _Val; set { if (OnPropertyChanging(__.Val, value)) { _Val = value; OnPropertyChanged(__.Val); } } }
|
||||
|
||||
private String _Title;
|
||||
/// <summary>字典标签</summary>
|
||||
[DisplayName("字典标签")]
|
||||
[Description("字典标签")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Title", "字典标签", "", Master = true)]
|
||||
public String Title { get => _Title; set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>字典介绍</summary>
|
||||
[DisplayName("字典介绍")]
|
||||
[Description("字典介绍")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Description", "字典介绍", "")]
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get => _Rank; set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
|
||||
private Int32 _IsDefault;
|
||||
/// <summary>是否默认值</summary>
|
||||
[DisplayName("是否默认值")]
|
||||
[Description("是否默认值")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDefault", "是否默认值", "")]
|
||||
public Int32 IsDefault { get => _IsDefault; set { if (OnPropertyChanging(__.IsDefault, value)) { _IsDefault = value; OnPropertyChanged(__.IsDefault); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id: return _Id;
|
||||
case __.DataDictionaryId: return _DataDictionaryId;
|
||||
case __.Val: return _Val;
|
||||
case __.Title: return _Title;
|
||||
case __.Description: return _Description;
|
||||
case __.Rank: return _Rank;
|
||||
case __.IsDefault: return _IsDefault;
|
||||
case __.AddTime: return _AddTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id: _Id = value.ToInt(); break;
|
||||
case __.DataDictionaryId: _DataDictionaryId = value.ToInt(); break;
|
||||
case __.Val: _Val = Convert.ToString(value); break;
|
||||
case __.Title: _Title = Convert.ToString(value); break;
|
||||
case __.Description: _Description = Convert.ToString(value); break;
|
||||
case __.Rank: _Rank = value.ToInt(); break;
|
||||
case __.IsDefault: _IsDefault = value.ToInt(); break;
|
||||
case __.AddTime: _AddTime = value.ToDateTime(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得数据字典详情字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName(__.Id);
|
||||
|
||||
/// <summary>字典ID</summary>
|
||||
public static readonly Field DataDictionaryId = FindByName(__.DataDictionaryId);
|
||||
|
||||
/// <summary>字典值</summary>
|
||||
public static readonly Field Val = FindByName(__.Val);
|
||||
|
||||
/// <summary>字典标签</summary>
|
||||
public static readonly Field Title = FindByName(__.Title);
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
public static readonly Field Description = FindByName(__.Description);
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
|
||||
/// <summary>是否默认值</summary>
|
||||
public static readonly Field IsDefault = FindByName(__.IsDefault);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得数据字典详情字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>字典ID</summary>
|
||||
public const String DataDictionaryId = "DataDictionaryId";
|
||||
|
||||
/// <summary>字典值</summary>
|
||||
public const String Val = "Val";
|
||||
|
||||
/// <summary>字典标签</summary>
|
||||
public const String Title = "Title";
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
public const String Description = "Description";
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public const String Rank = "Rank";
|
||||
|
||||
/// <summary>是否默认值</summary>
|
||||
public const String IsDefault = "IsDefault";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>数据字典详情接口</summary>
|
||||
public partial interface IDataDictionaryDetail
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>字典ID</summary>
|
||||
Int32 DataDictionaryId { get; set; }
|
||||
|
||||
/// <summary>字典值</summary>
|
||||
String Val { get; set; }
|
||||
|
||||
/// <summary>字典标签</summary>
|
||||
String Title { get; set; }
|
||||
|
||||
/// <summary>字典介绍</summary>
|
||||
String Description { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>是否默认值</summary>
|
||||
Int32 IsDefault { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -46,29 +46,29 @@ namespace COMCMS.Core
|
||||
}
|
||||
|
||||
/// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected override void InitData()
|
||||
{
|
||||
// InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
if (Meta.Count > 0) return;
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Count > 0) return;
|
||||
|
||||
if (XTrace.Debug) XTrace.WriteLine("开始初始化TargetEvent[目标事件]数据……");
|
||||
IList<TargetEvent> list = new List<TargetEvent>();
|
||||
list.Add(new TargetEvent() { EventKey = "add", EventName = "添加", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "edit", EventName = "修改", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "del", EventName = "删除", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "view", EventName = "查看", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "viewlist", EventName = "查看列表", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "import", EventName = "导入", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "export", EventName = "导出", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "filter", EventName = "搜索", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "batch", EventName = "批量操作", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "recycle", EventName = "回收站", IsDisable = 0, Rank = 0 });
|
||||
list.Add(new TargetEvent() { EventKey = "confirm", EventName = "确认", IsDisable = 0, Rank = 0 });
|
||||
list.Insert(true);
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化TargetEvent[目标事件]数据……");
|
||||
// IList<TargetEvent> list = new List<TargetEvent>();
|
||||
// list.Add(new TargetEvent() { EventKey = "add", EventName = "添加", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "edit", EventName = "修改", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "del", EventName = "删除", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "view", EventName = "查看", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "viewlist", EventName = "查看列表", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "import", EventName = "导入", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "export", EventName = "导出", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "filter", EventName = "搜索", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "batch", EventName = "批量操作", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "recycle", EventName = "回收站", IsDisable = 0, Rank = 0 });
|
||||
// list.Add(new TargetEvent() { EventKey = "confirm", EventName = "确认", IsDisable = 0, Rank = 0 });
|
||||
// list.Insert(true);
|
||||
|
||||
if (XTrace.Debug) XTrace.WriteLine("完成初始化TargetEvent[目标事件]数据!");
|
||||
}
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化TargetEvent[目标事件]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -412,19 +412,22 @@ namespace COMCMS.Core
|
||||
{
|
||||
if (IsAdminLogin())
|
||||
{
|
||||
//string adminLogId = SessionHelper.GetSession(sessionAdminLogIDKey).ToString();
|
||||
string adminLogId = AuthenticationHelper.GetClaim(sessionAdminLogIDKey);
|
||||
string adminLogId = SessionHelper.GetSession(sessionAdminLogIDKey).ToString();
|
||||
//string adminLogId = AuthenticationHelper.GetClaim(sessionAdminLogIDKey);
|
||||
if (string.IsNullOrEmpty(adminLogId))
|
||||
{
|
||||
//adminLogId = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
||||
adminLogId = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
||||
adminLogId = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
||||
//adminLogId = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
||||
}
|
||||
if (!string.IsNullOrEmpty(adminLogId))
|
||||
{
|
||||
AdminLog log = AdminLog.FindByGUID(adminLogId);
|
||||
if (log != null)
|
||||
{
|
||||
log.Actions = log.Actions + $"|||{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}: {action}";
|
||||
if (string.IsNullOrEmpty(log.Actions))
|
||||
log.Actions = $"{DateTime.Now:yyyy-MM-dd HH:mm}: {action}";
|
||||
else
|
||||
log.Actions = log.Actions + $"|||{DateTime.Now:yyyy-MM-dd HH:mm}: {action}";
|
||||
log.LastUpdateTime = DateTime.Now;
|
||||
log.Update();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
+125
-103
@@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
@@ -12,7 +16,7 @@ namespace COMCMS.Core
|
||||
[DataObject]
|
||||
[Description("管理角色")]
|
||||
[BindTable("AdminRoles", Description = "管理角色", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class AdminRoles : IAdminRoles
|
||||
public partial class AdminRoles
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
@@ -20,88 +24,120 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
|
||||
|
||||
private Int32 _RoleType;
|
||||
/// <summary>角色类型</summary>
|
||||
[DisplayName("角色类型")]
|
||||
[Description("角色类型")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("RoleType", "角色类型", "int")]
|
||||
public Int32 RoleType { get { return _RoleType; } set { if (OnPropertyChanging(__.RoleType, value)) { _RoleType = value; OnPropertyChanged(__.RoleType); } } }
|
||||
[BindColumn("RoleType", "角色类型", "")]
|
||||
public Int32 RoleType { get => _RoleType; set { if (OnPropertyChanging("RoleType", value)) { _RoleType = value; OnPropertyChanged("RoleType"); } } }
|
||||
|
||||
private String _RoleName;
|
||||
/// <summary>角色名称</summary>
|
||||
[DisplayName("角色名称")]
|
||||
[Description("角色名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("RoleName", "角色名称", "nvarchar(50)", Master = true)]
|
||||
public String RoleName { get { return _RoleName; } set { if (OnPropertyChanging(__.RoleName, value)) { _RoleName = value; OnPropertyChanged(__.RoleName); } } }
|
||||
[BindColumn("RoleName", "角色名称", "", Master = true)]
|
||||
public String RoleName { get => _RoleName; set { if (OnPropertyChanging("RoleName", value)) { _RoleName = value; OnPropertyChanged("RoleName"); } } }
|
||||
|
||||
private String _RoleDescription;
|
||||
/// <summary>角色简单介绍</summary>
|
||||
[DisplayName("角色简单介绍")]
|
||||
[Description("角色简单介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("RoleDescription", "角色简单介绍", "nvarchar(250)", Master = true)]
|
||||
public String RoleDescription { get { return _RoleDescription; } set { if (OnPropertyChanging(__.RoleDescription, value)) { _RoleDescription = value; OnPropertyChanged(__.RoleDescription); } } }
|
||||
[BindColumn("RoleDescription", "角色简单介绍", "", Master = true)]
|
||||
public String RoleDescription { get => _RoleDescription; set { if (OnPropertyChanging("RoleDescription", value)) { _RoleDescription = value; OnPropertyChanged("RoleDescription"); } } }
|
||||
|
||||
private Int32 _IsSuperAdmin;
|
||||
/// <summary>是否是超级管理员</summary>
|
||||
[DisplayName("是否是超级管理员")]
|
||||
[Description("是否是超级管理员")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsSuperAdmin", "是否是超级管理员", "int")]
|
||||
public Int32 IsSuperAdmin { get { return _IsSuperAdmin; } set { if (OnPropertyChanging(__.IsSuperAdmin, value)) { _IsSuperAdmin = value; OnPropertyChanged(__.IsSuperAdmin); } } }
|
||||
[BindColumn("IsSuperAdmin", "是否是超级管理员", "")]
|
||||
public Int32 IsSuperAdmin { get => _IsSuperAdmin; set { if (OnPropertyChanging("IsSuperAdmin", value)) { _IsSuperAdmin = value; OnPropertyChanged("IsSuperAdmin"); } } }
|
||||
|
||||
private Int32 _Stars;
|
||||
/// <summary>星级</summary>
|
||||
[DisplayName("星级")]
|
||||
[Description("星级")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Stars", "星级", "int")]
|
||||
public Int32 Stars { get { return _Stars; } set { if (OnPropertyChanging(__.Stars, value)) { _Stars = value; OnPropertyChanged(__.Stars); } } }
|
||||
[BindColumn("Stars", "星级", "")]
|
||||
public Int32 Stars { get => _Stars; set { if (OnPropertyChanging("Stars", value)) { _Stars = value; OnPropertyChanged("Stars"); } } }
|
||||
|
||||
private Int32 _NotAllowDel;
|
||||
/// <summary>是否不允许删除</summary>
|
||||
[DisplayName("是否不允许删除")]
|
||||
[Description("是否不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("NotAllowDel", "是否不允许删除", "int")]
|
||||
public Int32 NotAllowDel { get { return _NotAllowDel; } set { if (OnPropertyChanging(__.NotAllowDel, value)) { _NotAllowDel = value; OnPropertyChanged(__.NotAllowDel); } } }
|
||||
[BindColumn("NotAllowDel", "是否不允许删除", "")]
|
||||
public Int32 NotAllowDel { get => _NotAllowDel; set { if (OnPropertyChanging("NotAllowDel", value)) { _NotAllowDel = value; OnPropertyChanged("NotAllowDel"); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "int")]
|
||||
public Int32 Rank { get { return _Rank; } set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get => _Rank; set { if (OnPropertyChanging("Rank", value)) { _Rank = value; OnPropertyChanged("Rank"); } } }
|
||||
|
||||
private String _Color;
|
||||
/// <summary>颜色</summary>
|
||||
[DisplayName("颜色")]
|
||||
[Description("颜色")]
|
||||
[DataObjectField(false, false, true, 20)]
|
||||
[BindColumn("Color", "颜色", "nvarchar(20)", Master = true)]
|
||||
public String Color { get { return _Color; } set { if (OnPropertyChanging(__.Color, value)) { _Color = value; OnPropertyChanged(__.Color); } } }
|
||||
[BindColumn("Color", "颜色", "", Master = true)]
|
||||
public String Color { get => _Color; set { if (OnPropertyChanging("Color", value)) { _Color = value; OnPropertyChanged("Color"); } } }
|
||||
|
||||
private String _Menus;
|
||||
/// <summary>管理菜单</summary>
|
||||
[DisplayName("管理菜单")]
|
||||
[Description("管理菜单")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Menus", "管理菜单", "ntext", Master = true)]
|
||||
public String Menus { get { return _Menus; } set { if (OnPropertyChanging(__.Menus, value)) { _Menus = value; OnPropertyChanged(__.Menus); } } }
|
||||
[BindColumn("Menus", "管理菜单", "", Master = true)]
|
||||
public String Menus { get => _Menus; set { if (OnPropertyChanging("Menus", value)) { _Menus = value; OnPropertyChanged("Menus"); } } }
|
||||
|
||||
private String _Powers;
|
||||
/// <summary>权限</summary>
|
||||
[DisplayName("权限")]
|
||||
[Description("权限")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Powers", "权限", "ntext", Master = true)]
|
||||
public String Powers { get { return _Powers; } set { if (OnPropertyChanging(__.Powers, value)) { _Powers = value; OnPropertyChanged(__.Powers); } } }
|
||||
[BindColumn("Powers", "权限", "", Master = true)]
|
||||
public String Powers { get => _Powers; set { if (OnPropertyChanging("Powers", value)) { _Powers = value; OnPropertyChanged("Powers"); } } }
|
||||
|
||||
private String _AuthorizedArticleCagegory;
|
||||
/// <summary>已授权文章栏目</summary>
|
||||
[DisplayName("已授权文章栏目")]
|
||||
[Description("已授权文章栏目")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("AuthorizedArticleCagegory", "已授权文章栏目", "", Master = true)]
|
||||
public String AuthorizedArticleCagegory { get => _AuthorizedArticleCagegory; set { if (OnPropertyChanging("AuthorizedArticleCagegory", value)) { _AuthorizedArticleCagegory = value; OnPropertyChanged("AuthorizedArticleCagegory"); } } }
|
||||
|
||||
private String _AuthorizedCagegory;
|
||||
/// <summary>已授权商品栏目</summary>
|
||||
[DisplayName("已授权商品栏目")]
|
||||
[Description("已授权商品栏目")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("AuthorizedCagegory", "已授权商品栏目", "", Master = true)]
|
||||
public String AuthorizedCagegory { get => _AuthorizedCagegory; set { if (OnPropertyChanging("AuthorizedCagegory", value)) { _AuthorizedCagegory = value; OnPropertyChanged("AuthorizedCagegory"); } } }
|
||||
|
||||
private Int32 _OnlyEditMyselfArticle;
|
||||
/// <summary>是否只允许编辑自己的文章</summary>
|
||||
[DisplayName("是否只允许编辑自己的文章")]
|
||||
[Description("是否只允许编辑自己的文章")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("OnlyEditMyselfArticle", "是否只允许编辑自己的文章", "")]
|
||||
public Int32 OnlyEditMyselfArticle { get => _OnlyEditMyselfArticle; set { if (OnPropertyChanging("OnlyEditMyselfArticle", value)) { _OnlyEditMyselfArticle = value; OnPropertyChanged("OnlyEditMyselfArticle"); } } }
|
||||
|
||||
private Int32 _OnlyEditMyselfProduct;
|
||||
/// <summary>是否只允许编辑自己的产品</summary>
|
||||
[DisplayName("是否只允许编辑自己的产品")]
|
||||
[Description("是否只允许编辑自己的产品")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("OnlyEditMyselfProduct", "是否只允许编辑自己的产品", "")]
|
||||
public Int32 OnlyEditMyselfProduct { get => _OnlyEditMyselfProduct; set { if (OnPropertyChanging("OnlyEditMyselfProduct", value)) { _OnlyEditMyselfProduct = value; OnPropertyChanged("OnlyEditMyselfProduct"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -114,17 +150,21 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.RoleType : return _RoleType;
|
||||
case __.RoleName : return _RoleName;
|
||||
case __.RoleDescription : return _RoleDescription;
|
||||
case __.IsSuperAdmin : return _IsSuperAdmin;
|
||||
case __.Stars : return _Stars;
|
||||
case __.NotAllowDel : return _NotAllowDel;
|
||||
case __.Rank : return _Rank;
|
||||
case __.Color : return _Color;
|
||||
case __.Menus : return _Menus;
|
||||
case __.Powers : return _Powers;
|
||||
case "Id": return _Id;
|
||||
case "RoleType": return _RoleType;
|
||||
case "RoleName": return _RoleName;
|
||||
case "RoleDescription": return _RoleDescription;
|
||||
case "IsSuperAdmin": return _IsSuperAdmin;
|
||||
case "Stars": return _Stars;
|
||||
case "NotAllowDel": return _NotAllowDel;
|
||||
case "Rank": return _Rank;
|
||||
case "Color": return _Color;
|
||||
case "Menus": return _Menus;
|
||||
case "Powers": return _Powers;
|
||||
case "AuthorizedArticleCagegory": return _AuthorizedArticleCagegory;
|
||||
case "AuthorizedCagegory": return _AuthorizedCagegory;
|
||||
case "OnlyEditMyselfArticle": return _OnlyEditMyselfArticle;
|
||||
case "OnlyEditMyselfProduct": return _OnlyEditMyselfProduct;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -132,17 +172,21 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.RoleType : _RoleType = Convert.ToInt32(value); break;
|
||||
case __.RoleName : _RoleName = Convert.ToString(value); break;
|
||||
case __.RoleDescription : _RoleDescription = Convert.ToString(value); break;
|
||||
case __.IsSuperAdmin : _IsSuperAdmin = Convert.ToInt32(value); break;
|
||||
case __.Stars : _Stars = Convert.ToInt32(value); break;
|
||||
case __.NotAllowDel : _NotAllowDel = Convert.ToInt32(value); break;
|
||||
case __.Rank : _Rank = Convert.ToInt32(value); break;
|
||||
case __.Color : _Color = Convert.ToString(value); break;
|
||||
case __.Menus : _Menus = Convert.ToString(value); break;
|
||||
case __.Powers : _Powers = Convert.ToString(value); break;
|
||||
case "Id": _Id = value.ToInt(); break;
|
||||
case "RoleType": _RoleType = value.ToInt(); break;
|
||||
case "RoleName": _RoleName = Convert.ToString(value); break;
|
||||
case "RoleDescription": _RoleDescription = Convert.ToString(value); break;
|
||||
case "IsSuperAdmin": _IsSuperAdmin = value.ToInt(); break;
|
||||
case "Stars": _Stars = value.ToInt(); break;
|
||||
case "NotAllowDel": _NotAllowDel = value.ToInt(); break;
|
||||
case "Rank": _Rank = value.ToInt(); break;
|
||||
case "Color": _Color = Convert.ToString(value); break;
|
||||
case "Menus": _Menus = Convert.ToString(value); break;
|
||||
case "Powers": _Powers = Convert.ToString(value); break;
|
||||
case "AuthorizedArticleCagegory": _AuthorizedArticleCagegory = Convert.ToString(value); break;
|
||||
case "AuthorizedCagegory": _AuthorizedCagegory = Convert.ToString(value); break;
|
||||
case "OnlyEditMyselfArticle": _OnlyEditMyselfArticle = value.ToInt(); break;
|
||||
case "OnlyEditMyselfProduct": _OnlyEditMyselfProduct = value.ToInt(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -154,39 +198,51 @@ namespace COMCMS.Core
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName(__.Id);
|
||||
public static readonly Field Id = FindByName("Id");
|
||||
|
||||
/// <summary>角色类型</summary>
|
||||
public static readonly Field RoleType = FindByName(__.RoleType);
|
||||
public static readonly Field RoleType = FindByName("RoleType");
|
||||
|
||||
/// <summary>角色名称</summary>
|
||||
public static readonly Field RoleName = FindByName(__.RoleName);
|
||||
public static readonly Field RoleName = FindByName("RoleName");
|
||||
|
||||
/// <summary>角色简单介绍</summary>
|
||||
public static readonly Field RoleDescription = FindByName(__.RoleDescription);
|
||||
public static readonly Field RoleDescription = FindByName("RoleDescription");
|
||||
|
||||
/// <summary>是否是超级管理员</summary>
|
||||
public static readonly Field IsSuperAdmin = FindByName(__.IsSuperAdmin);
|
||||
public static readonly Field IsSuperAdmin = FindByName("IsSuperAdmin");
|
||||
|
||||
/// <summary>星级</summary>
|
||||
public static readonly Field Stars = FindByName(__.Stars);
|
||||
public static readonly Field Stars = FindByName("Stars");
|
||||
|
||||
/// <summary>是否不允许删除</summary>
|
||||
public static readonly Field NotAllowDel = FindByName(__.NotAllowDel);
|
||||
public static readonly Field NotAllowDel = FindByName("NotAllowDel");
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
public static readonly Field Rank = FindByName("Rank");
|
||||
|
||||
/// <summary>颜色</summary>
|
||||
public static readonly Field Color = FindByName(__.Color);
|
||||
public static readonly Field Color = FindByName("Color");
|
||||
|
||||
/// <summary>管理菜单</summary>
|
||||
public static readonly Field Menus = FindByName(__.Menus);
|
||||
public static readonly Field Menus = FindByName("Menus");
|
||||
|
||||
/// <summary>权限</summary>
|
||||
public static readonly Field Powers = FindByName(__.Powers);
|
||||
public static readonly Field Powers = FindByName("Powers");
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
/// <summary>已授权文章栏目</summary>
|
||||
public static readonly Field AuthorizedArticleCagegory = FindByName("AuthorizedArticleCagegory");
|
||||
|
||||
/// <summary>已授权商品栏目</summary>
|
||||
public static readonly Field AuthorizedCagegory = FindByName("AuthorizedCagegory");
|
||||
|
||||
/// <summary>是否只允许编辑自己的文章</summary>
|
||||
public static readonly Field OnlyEditMyselfArticle = FindByName("OnlyEditMyselfArticle");
|
||||
|
||||
/// <summary>是否只允许编辑自己的产品</summary>
|
||||
public static readonly Field OnlyEditMyselfProduct = FindByName("OnlyEditMyselfProduct");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得管理角色字段名称的快捷方式</summary>
|
||||
@@ -224,53 +280,19 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>权限</summary>
|
||||
public const String Powers = "Powers";
|
||||
|
||||
/// <summary>已授权文章栏目</summary>
|
||||
public const String AuthorizedArticleCagegory = "AuthorizedArticleCagegory";
|
||||
|
||||
/// <summary>已授权商品栏目</summary>
|
||||
public const String AuthorizedCagegory = "AuthorizedCagegory";
|
||||
|
||||
/// <summary>是否只允许编辑自己的文章</summary>
|
||||
public const String OnlyEditMyselfArticle = "OnlyEditMyselfArticle";
|
||||
|
||||
/// <summary>是否只允许编辑自己的产品</summary>
|
||||
public const String OnlyEditMyselfProduct = "OnlyEditMyselfProduct";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>管理角色接口</summary>
|
||||
public partial interface IAdminRoles
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>角色类型</summary>
|
||||
Int32 RoleType { get; set; }
|
||||
|
||||
/// <summary>角色名称</summary>
|
||||
String RoleName { get; set; }
|
||||
|
||||
/// <summary>角色简单介绍</summary>
|
||||
String RoleDescription { get; set; }
|
||||
|
||||
/// <summary>是否是超级管理员</summary>
|
||||
Int32 IsSuperAdmin { get; set; }
|
||||
|
||||
/// <summary>星级</summary>
|
||||
Int32 Stars { get; set; }
|
||||
|
||||
/// <summary>是否不允许删除</summary>
|
||||
Int32 NotAllowDel { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>颜色</summary>
|
||||
String Color { get; set; }
|
||||
|
||||
/// <summary>管理菜单</summary>
|
||||
String Menus { get; set; }
|
||||
|
||||
/// <summary>权限</summary>
|
||||
String Powers { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>部门</summary>
|
||||
public partial class Department : Entity<Department>
|
||||
{
|
||||
#region 对象操作
|
||||
static Department()
|
||||
{
|
||||
// 累加字段,生成 Update xx Set Count=Count+1234 Where xxx
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(nameof(PId));
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Department[部门]数据……");
|
||||
|
||||
// var entity = new Department();
|
||||
// entity.Id = 0;
|
||||
// entity.DepartmentName = "abc";
|
||||
// entity.PId = 0;
|
||||
// entity.Level = 0;
|
||||
// entity.Location = "abc";
|
||||
// entity.DepartmentDescription = "abc";
|
||||
// entity.Pic = "abc";
|
||||
// entity.Rank = 0;
|
||||
// entity.IsNotAllowDel = 0;
|
||||
// entity.Powers = "abc";
|
||||
// entity.IsDel = 0;
|
||||
// entity.Tel = "abc";
|
||||
// entity.Fax = "abc";
|
||||
// entity.Email = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Department[部门]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Department FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Session.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
return Meta.SingleCache[id];
|
||||
|
||||
//return Find(_.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据父ID查询所有子项
|
||||
/// </summary>
|
||||
/// <param name="ID">父ID</param>
|
||||
/// <returns>所有子栏目,按Rank正序排列</returns>
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public static IList<Department> FindByParentID(Int32 ID)
|
||||
{
|
||||
|
||||
IList<Department> list = Meta.Cache.Entities.Where(x => x.PId == ID && x.IsDel==0).OrderBy(x => x.Id).OrderBy(x => x.Rank).ToList();
|
||||
if (list == null || list.Count < 1) return null;
|
||||
|
||||
//list.Sort(_.Rank, true);
|
||||
//list.OrderBy(x => x.Rank);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有子栏目(递归)
|
||||
/// </summary>
|
||||
/// <param name="ID">栏目ID</param>
|
||||
/// <returns>所有子栏目</returns>
|
||||
public static IList<Department> FindAllSubKinds(Int32 ID)
|
||||
{
|
||||
List<Department> alllist = new List<Department>();
|
||||
IList<Department> list = FindByParentID(ID);
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
alllist.AddRange(list);
|
||||
foreach (Department ak in list)
|
||||
{
|
||||
if (Department.FindByParentID(ak.Id) != null)
|
||||
{
|
||||
alllist.AddRange(FindAllSubKinds(ak.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
return alllist;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
|
||||
/// <summary>
|
||||
/// 获取路径
|
||||
/// </summary>
|
||||
/// <param name="PId"></param>
|
||||
/// <returns></returns>
|
||||
public static String GetNewLocation(int PId)
|
||||
{
|
||||
if (PId == 0)
|
||||
return "0,";
|
||||
else
|
||||
{
|
||||
var pa = FindById(PId);
|
||||
if (pa != null)
|
||||
{
|
||||
return GetNewLocation(pa.PId) + pa.Id + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
return pa.Id + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取Level
|
||||
/// </summary>
|
||||
/// <param name="PId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetNewLevel(int PId)
|
||||
{
|
||||
if (PId == 0)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
var pa = FindById(PId);
|
||||
if (pa != null)
|
||||
{
|
||||
return GetNewLevel(pa.PId) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pa.Level + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>
|
||||
/// 获取树
|
||||
/// </summary>
|
||||
/// <param name="pid">上级ID,0为全部</param>
|
||||
/// <param name="maxLevel">最大级别0为1级类别;-1为所有下级</param>
|
||||
/// <param name="isIndentation">是否缩进</param>
|
||||
/// <param name="showhide">是否显示隐藏菜单</param>
|
||||
/// <returns></returns>
|
||||
public static IList<Department> GetListTree(int pid, int maxLevel, bool isIndentation, bool showhide = true)
|
||||
{
|
||||
List<Department> listTree = new List<Department>();
|
||||
IList<Department> list = FindByParentID(pid);
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
foreach (Department p in list)
|
||||
{
|
||||
if (!showhide && p.IsDel == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
listTree.Add(p.CloneEntity());
|
||||
if ((maxLevel == -1 || p.Level < maxLevel) && Department.FindCount(_.PId == p.Id, null, null, 0, 0) > 0)
|
||||
{
|
||||
IList<Department> listtmp = GetListTree(p.Id, maxLevel, false);
|
||||
foreach (Department a in listtmp)
|
||||
{
|
||||
if (!showhide && a.IsDel == 1) continue;//如果不显示隐藏,跳过
|
||||
Department tmpa = a.CloneEntity();
|
||||
if (a.Level > 0 && isIndentation)
|
||||
{
|
||||
tmpa.DepartmentName = new string(' ', tmpa.Level * 2) + tmpa.DepartmentName;
|
||||
}
|
||||
listTree.Add(tmpa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return listTree;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>部门</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("部门")]
|
||||
[BindTable("Department", Description = "部门", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class Department : IDepartment
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
|
||||
|
||||
private String _DepartmentName;
|
||||
/// <summary>部门名称</summary>
|
||||
[DisplayName("部门名称")]
|
||||
[Description("部门名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("DepartmentName", "部门名称", "")]
|
||||
public String DepartmentName { get => _DepartmentName; set { if (OnPropertyChanging("DepartmentName", value)) { _DepartmentName = value; OnPropertyChanged("DepartmentName"); } } }
|
||||
|
||||
private Int32 _PId;
|
||||
/// <summary>上级部门ID</summary>
|
||||
[DisplayName("上级部门ID")]
|
||||
[Description("上级部门ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PId", "上级部门ID", "")]
|
||||
public Int32 PId { get => _PId; set { if (OnPropertyChanging("PId", value)) { _PId = value; OnPropertyChanged("PId"); } } }
|
||||
|
||||
private Int32 _Level;
|
||||
/// <summary>级别</summary>
|
||||
[DisplayName("级别")]
|
||||
[Description("级别")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Level", "级别", "")]
|
||||
public Int32 Level { get => _Level; set { if (OnPropertyChanging("Level", value)) { _Level = value; OnPropertyChanged("Level"); } } }
|
||||
|
||||
private String _Location;
|
||||
/// <summary>路径</summary>
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get => _Location; set { if (OnPropertyChanging("Location", value)) { _Location = value; OnPropertyChanged("Location"); } } }
|
||||
|
||||
private String _DepartmentDescription;
|
||||
/// <summary>部门说明</summary>
|
||||
[DisplayName("部门说明")]
|
||||
[Description("部门说明")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DepartmentDescription", "部门说明", "")]
|
||||
public String DepartmentDescription { get => _DepartmentDescription; set { if (OnPropertyChanging("DepartmentDescription", value)) { _DepartmentDescription = value; OnPropertyChanged("DepartmentDescription"); } } }
|
||||
|
||||
private String _Pic;
|
||||
/// <summary>部门图片</summary>
|
||||
[DisplayName("部门图片")]
|
||||
[Description("部门图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "部门图片", "")]
|
||||
public String Pic { get => _Pic; set { if (OnPropertyChanging("Pic", value)) { _Pic = value; OnPropertyChanged("Pic"); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get => _Rank; set { if (OnPropertyChanging("Rank", value)) { _Rank = value; OnPropertyChanged("Rank"); } } }
|
||||
|
||||
private Int32 _IsNotAllowDel;
|
||||
/// <summary>是否不允许删除</summary>
|
||||
[DisplayName("是否不允许删除")]
|
||||
[Description("是否不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsNotAllowDel", "是否不允许删除", "")]
|
||||
public Int32 IsNotAllowDel { get => _IsNotAllowDel; set { if (OnPropertyChanging("IsNotAllowDel", value)) { _IsNotAllowDel = value; OnPropertyChanged("IsNotAllowDel"); } } }
|
||||
|
||||
private String _Powers;
|
||||
/// <summary>部门权限</summary>
|
||||
[DisplayName("部门权限")]
|
||||
[Description("部门权限")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Powers", "部门权限", "", Master = true)]
|
||||
public String Powers { get => _Powers; set { if (OnPropertyChanging("Powers", value)) { _Powers = value; OnPropertyChanged("Powers"); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
/// <summary>是否删除</summary>
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除", "")]
|
||||
public Int32 IsDel { get => _IsDel; set { if (OnPropertyChanging("IsDel", value)) { _IsDel = value; OnPropertyChanged("IsDel"); } } }
|
||||
|
||||
private String _Tel;
|
||||
/// <summary>联系电话</summary>
|
||||
[DisplayName("联系电话")]
|
||||
[Description("联系电话")]
|
||||
[DataObjectField(false, false, true, 30)]
|
||||
[BindColumn("Tel", "联系电话", "")]
|
||||
public String Tel { get => _Tel; set { if (OnPropertyChanging("Tel", value)) { _Tel = value; OnPropertyChanged("Tel"); } } }
|
||||
|
||||
private String _Fax;
|
||||
/// <summary>传真</summary>
|
||||
[DisplayName("传真")]
|
||||
[Description("传真")]
|
||||
[DataObjectField(false, false, true, 30)]
|
||||
[BindColumn("Fax", "传真", "")]
|
||||
public String Fax { get => _Fax; set { if (OnPropertyChanging("Fax", value)) { _Fax = value; OnPropertyChanged("Fax"); } } }
|
||||
|
||||
private String _Email;
|
||||
/// <summary>邮件</summary>
|
||||
[DisplayName("邮件")]
|
||||
[Description("邮件")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Email", "邮件", "")]
|
||||
public String Email { get => _Email; set { if (OnPropertyChanging("Email", value)) { _Email = value; OnPropertyChanged("Email"); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": return _Id;
|
||||
case "DepartmentName": return _DepartmentName;
|
||||
case "PId": return _PId;
|
||||
case "Level": return _Level;
|
||||
case "Location": return _Location;
|
||||
case "DepartmentDescription": return _DepartmentDescription;
|
||||
case "Pic": return _Pic;
|
||||
case "Rank": return _Rank;
|
||||
case "IsNotAllowDel": return _IsNotAllowDel;
|
||||
case "Powers": return _Powers;
|
||||
case "IsDel": return _IsDel;
|
||||
case "Tel": return _Tel;
|
||||
case "Fax": return _Fax;
|
||||
case "Email": return _Email;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "Id": _Id = value.ToInt(); break;
|
||||
case "DepartmentName": _DepartmentName = Convert.ToString(value); break;
|
||||
case "PId": _PId = value.ToInt(); break;
|
||||
case "Level": _Level = value.ToInt(); break;
|
||||
case "Location": _Location = Convert.ToString(value); break;
|
||||
case "DepartmentDescription": _DepartmentDescription = Convert.ToString(value); break;
|
||||
case "Pic": _Pic = Convert.ToString(value); break;
|
||||
case "Rank": _Rank = value.ToInt(); break;
|
||||
case "IsNotAllowDel": _IsNotAllowDel = value.ToInt(); break;
|
||||
case "Powers": _Powers = Convert.ToString(value); break;
|
||||
case "IsDel": _IsDel = value.ToInt(); break;
|
||||
case "Tel": _Tel = Convert.ToString(value); break;
|
||||
case "Fax": _Fax = Convert.ToString(value); break;
|
||||
case "Email": _Email = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 字段名
|
||||
/// <summary>取得部门字段信息的快捷方式</summary>
|
||||
public partial class _
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public static readonly Field Id = FindByName("Id");
|
||||
|
||||
/// <summary>部门名称</summary>
|
||||
public static readonly Field DepartmentName = FindByName("DepartmentName");
|
||||
|
||||
/// <summary>上级部门ID</summary>
|
||||
public static readonly Field PId = FindByName("PId");
|
||||
|
||||
/// <summary>级别</summary>
|
||||
public static readonly Field Level = FindByName("Level");
|
||||
|
||||
/// <summary>路径</summary>
|
||||
public static readonly Field Location = FindByName("Location");
|
||||
|
||||
/// <summary>部门说明</summary>
|
||||
public static readonly Field DepartmentDescription = FindByName("DepartmentDescription");
|
||||
|
||||
/// <summary>部门图片</summary>
|
||||
public static readonly Field Pic = FindByName("Pic");
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName("Rank");
|
||||
|
||||
/// <summary>是否不允许删除</summary>
|
||||
public static readonly Field IsNotAllowDel = FindByName("IsNotAllowDel");
|
||||
|
||||
/// <summary>部门权限</summary>
|
||||
public static readonly Field Powers = FindByName("Powers");
|
||||
|
||||
/// <summary>是否删除</summary>
|
||||
public static readonly Field IsDel = FindByName("IsDel");
|
||||
|
||||
/// <summary>联系电话</summary>
|
||||
public static readonly Field Tel = FindByName("Tel");
|
||||
|
||||
/// <summary>传真</summary>
|
||||
public static readonly Field Fax = FindByName("Fax");
|
||||
|
||||
/// <summary>邮件</summary>
|
||||
public static readonly Field Email = FindByName("Email");
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得部门字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>部门名称</summary>
|
||||
public const String DepartmentName = "DepartmentName";
|
||||
|
||||
/// <summary>上级部门ID</summary>
|
||||
public const String PId = "PId";
|
||||
|
||||
/// <summary>级别</summary>
|
||||
public const String Level = "Level";
|
||||
|
||||
/// <summary>路径</summary>
|
||||
public const String Location = "Location";
|
||||
|
||||
/// <summary>部门说明</summary>
|
||||
public const String DepartmentDescription = "DepartmentDescription";
|
||||
|
||||
/// <summary>部门图片</summary>
|
||||
public const String Pic = "Pic";
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public const String Rank = "Rank";
|
||||
|
||||
/// <summary>是否不允许删除</summary>
|
||||
public const String IsNotAllowDel = "IsNotAllowDel";
|
||||
|
||||
/// <summary>部门权限</summary>
|
||||
public const String Powers = "Powers";
|
||||
|
||||
/// <summary>是否删除</summary>
|
||||
public const String IsDel = "IsDel";
|
||||
|
||||
/// <summary>联系电话</summary>
|
||||
public const String Tel = "Tel";
|
||||
|
||||
/// <summary>传真</summary>
|
||||
public const String Fax = "Fax";
|
||||
|
||||
/// <summary>邮件</summary>
|
||||
public const String Email = "Email";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>部门接口</summary>
|
||||
public partial interface IDepartment
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>部门名称</summary>
|
||||
String DepartmentName { get; set; }
|
||||
|
||||
/// <summary>上级部门ID</summary>
|
||||
Int32 PId { get; set; }
|
||||
|
||||
/// <summary>级别</summary>
|
||||
Int32 Level { get; set; }
|
||||
|
||||
/// <summary>路径</summary>
|
||||
String Location { get; set; }
|
||||
|
||||
/// <summary>部门说明</summary>
|
||||
String DepartmentDescription { get; set; }
|
||||
|
||||
/// <summary>部门图片</summary>
|
||||
String Pic { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>是否不允许删除</summary>
|
||||
Int32 IsNotAllowDel { get; set; }
|
||||
|
||||
/// <summary>部门权限</summary>
|
||||
String Powers { get; set; }
|
||||
|
||||
/// <summary>是否删除</summary>
|
||||
Int32 IsDel { get; set; }
|
||||
|
||||
/// <summary>联系电话</summary>
|
||||
String Tel { get; set; }
|
||||
|
||||
/// <summary>传真</summary>
|
||||
String Fax { get; set; }
|
||||
|
||||
/// <summary>邮件</summary>
|
||||
String Email { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -183,9 +183,49 @@ namespace COMCMS.Core
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
/// <summary>
|
||||
/// 通过FileName查找
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
/// <param name="kid"></param>
|
||||
/// <returns></returns>
|
||||
public static Product FindByFileName(string filename, int kid = 0)
|
||||
{
|
||||
var where = _.FileName == filename;
|
||||
if (kid > 0) where &= _.KId == kid;
|
||||
return Find(where);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>
|
||||
/// 获取前几条数据
|
||||
/// </summary>
|
||||
/// <param name="kid">栏目id</param>
|
||||
/// <param name="records">条数</param>
|
||||
/// <returns></returns>
|
||||
public static IList<Product> FindTopList(int kid, int records, bool isShowSub = false)
|
||||
{
|
||||
if (!isShowSub)
|
||||
return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records);
|
||||
else
|
||||
{
|
||||
Expression ex = _.IsHide == 0;
|
||||
List<int> kids = new List<int>();
|
||||
kids.Add(kid);
|
||||
IList<Category> subkinds = Category.FindByParentID(kid);
|
||||
if (subkinds != null && subkinds.Count > 0)
|
||||
{
|
||||
foreach (var item in subkinds)
|
||||
{
|
||||
kids.Add(item.Id);
|
||||
}
|
||||
}
|
||||
ex &= _.KId.In(kids);
|
||||
|
||||
return FindAll(ex, _.Id.Desc(), null, 0, records);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+281
-261
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
@@ -20,520 +21,528 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get => _Id; set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private Int32 _KId;
|
||||
/// <summary>栏目ID</summary>
|
||||
[DisplayName("栏目ID")]
|
||||
[Description("栏目ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("KId", "栏目ID", "int")]
|
||||
public Int32 KId { get { return _KId; } set { if (OnPropertyChanging(__.KId, value)) { _KId = value; OnPropertyChanged(__.KId); } } }
|
||||
[BindColumn("KId", "栏目ID", "")]
|
||||
public Int32 KId { get => _KId; set { if (OnPropertyChanging(__.KId, value)) { _KId = value; OnPropertyChanged(__.KId); } } }
|
||||
|
||||
private Int32 _BId;
|
||||
/// <summary>品牌ID</summary>
|
||||
[DisplayName("品牌ID")]
|
||||
[Description("品牌ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("BId", "品牌ID", "int")]
|
||||
public Int32 BId { get { return _BId; } set { if (OnPropertyChanging(__.BId, value)) { _BId = value; OnPropertyChanged(__.BId); } } }
|
||||
[BindColumn("BId", "品牌ID", "")]
|
||||
public Int32 BId { get => _BId; set { if (OnPropertyChanging(__.BId, value)) { _BId = value; OnPropertyChanged(__.BId); } } }
|
||||
|
||||
private Int32 _ShopId;
|
||||
/// <summary>店铺ID</summary>
|
||||
[DisplayName("店铺ID")]
|
||||
[Description("店铺ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ShopId", "店铺ID", "int")]
|
||||
public Int32 ShopId { get { return _ShopId; } set { if (OnPropertyChanging(__.ShopId, value)) { _ShopId = value; OnPropertyChanged(__.ShopId); } } }
|
||||
[BindColumn("ShopId", "店铺ID", "")]
|
||||
public Int32 ShopId { get => _ShopId; set { if (OnPropertyChanging(__.ShopId, value)) { _ShopId = value; OnPropertyChanged(__.ShopId); } } }
|
||||
|
||||
private Int32 _CId;
|
||||
/// <summary>颜色ID</summary>
|
||||
[DisplayName("颜色ID")]
|
||||
[Description("颜色ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CId", "颜色ID", "int")]
|
||||
public Int32 CId { get { return _CId; } set { if (OnPropertyChanging(__.CId, value)) { _CId = value; OnPropertyChanged(__.CId); } } }
|
||||
[BindColumn("CId", "颜色ID", "")]
|
||||
public Int32 CId { get => _CId; set { if (OnPropertyChanging(__.CId, value)) { _CId = value; OnPropertyChanged(__.CId); } } }
|
||||
|
||||
private Int32 _SupportId;
|
||||
/// <summary>供货商ID</summary>
|
||||
[DisplayName("供货商ID")]
|
||||
[Description("供货商ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("SupportId", "供货商ID", "int")]
|
||||
public Int32 SupportId { get { return _SupportId; } set { if (OnPropertyChanging(__.SupportId, value)) { _SupportId = value; OnPropertyChanged(__.SupportId); } } }
|
||||
[BindColumn("SupportId", "供货商ID", "")]
|
||||
public Int32 SupportId { get => _SupportId; set { if (OnPropertyChanging(__.SupportId, value)) { _SupportId = value; OnPropertyChanged(__.SupportId); } } }
|
||||
|
||||
private String _Title;
|
||||
/// <summary>标题</summary>
|
||||
[DisplayName("标题")]
|
||||
[Description("标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Title", "标题", "nvarchar(250)", Master = true)]
|
||||
public String Title { get { return _Title; } set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
[BindColumn("Title", "标题", "", Master = true)]
|
||||
public String Title { get => _Title; set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private String _ItemNO;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ItemNO", "编号", "nvarchar(50)")]
|
||||
public String ItemNO { get { return _ItemNO; } set { if (OnPropertyChanging(__.ItemNO, value)) { _ItemNO = value; OnPropertyChanged(__.ItemNO); } } }
|
||||
[BindColumn("ItemNO", "编号", "")]
|
||||
public String ItemNO { get => _ItemNO; set { if (OnPropertyChanging(__.ItemNO, value)) { _ItemNO = value; OnPropertyChanged(__.ItemNO); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
/// <summary>副标题</summary>
|
||||
[DisplayName("副标题")]
|
||||
[Description("副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "副标题", "nvarchar(250)")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
[BindColumn("SubTitle", "副标题", "")]
|
||||
public String SubTitle { get => _SubTitle; set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
|
||||
private String _Unit;
|
||||
/// <summary>商品单位</summary>
|
||||
[DisplayName("商品单位")]
|
||||
[Description("商品单位")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Unit", "商品单位", "nvarchar(250)")]
|
||||
public String Unit { get { return _Unit; } set { if (OnPropertyChanging(__.Unit, value)) { _Unit = value; OnPropertyChanged(__.Unit); } } }
|
||||
[BindColumn("Unit", "商品单位", "")]
|
||||
public String Unit { get => _Unit; set { if (OnPropertyChanging(__.Unit, value)) { _Unit = value; OnPropertyChanged(__.Unit); } } }
|
||||
|
||||
private String _Spec;
|
||||
/// <summary>商品规格尺寸</summary>
|
||||
[DisplayName("商品规格尺寸")]
|
||||
[Description("商品规格尺寸")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Spec", "商品规格尺寸", "nvarchar(250)")]
|
||||
public String Spec { get { return _Spec; } set { if (OnPropertyChanging(__.Spec, value)) { _Spec = value; OnPropertyChanged(__.Spec); } } }
|
||||
[BindColumn("Spec", "商品规格尺寸", "")]
|
||||
public String Spec { get => _Spec; set { if (OnPropertyChanging(__.Spec, value)) { _Spec = value; OnPropertyChanged(__.Spec); } } }
|
||||
|
||||
private String _Color;
|
||||
/// <summary>颜色</summary>
|
||||
[DisplayName("颜色")]
|
||||
[Description("颜色")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Color", "颜色", "nvarchar(250)")]
|
||||
public String Color { get { return _Color; } set { if (OnPropertyChanging(__.Color, value)) { _Color = value; OnPropertyChanged(__.Color); } } }
|
||||
[BindColumn("Color", "颜色", "")]
|
||||
public String Color { get => _Color; set { if (OnPropertyChanging(__.Color, value)) { _Color = value; OnPropertyChanged(__.Color); } } }
|
||||
|
||||
private String _Weight;
|
||||
/// <summary>重量</summary>
|
||||
[DisplayName("重量")]
|
||||
[Description("重量")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Weight", "重量", "nvarchar(50)")]
|
||||
public String Weight { get { return _Weight; } set { if (OnPropertyChanging(__.Weight, value)) { _Weight = value; OnPropertyChanged(__.Weight); } } }
|
||||
[BindColumn("Weight", "重量", "")]
|
||||
public String Weight { get => _Weight; set { if (OnPropertyChanging(__.Weight, value)) { _Weight = value; OnPropertyChanged(__.Weight); } } }
|
||||
|
||||
private Decimal _Price;
|
||||
/// <summary>价格</summary>
|
||||
[DisplayName("价格")]
|
||||
[Description("价格")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Price", "价格", "money")]
|
||||
public Decimal Price { get { return _Price; } set { if (OnPropertyChanging(__.Price, value)) { _Price = value; OnPropertyChanged(__.Price); } } }
|
||||
[BindColumn("Price", "价格", "")]
|
||||
public Decimal Price { get => _Price; set { if (OnPropertyChanging(__.Price, value)) { _Price = value; OnPropertyChanged(__.Price); } } }
|
||||
|
||||
private Decimal _MarketPrice;
|
||||
/// <summary>市场价格</summary>
|
||||
[DisplayName("市场价格")]
|
||||
[Description("市场价格")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("MarketPrice", "市场价格", "money")]
|
||||
public Decimal MarketPrice { get { return _MarketPrice; } set { if (OnPropertyChanging(__.MarketPrice, value)) { _MarketPrice = value; OnPropertyChanged(__.MarketPrice); } } }
|
||||
[BindColumn("MarketPrice", "市场价格", "")]
|
||||
public Decimal MarketPrice { get => _MarketPrice; set { if (OnPropertyChanging(__.MarketPrice, value)) { _MarketPrice = value; OnPropertyChanged(__.MarketPrice); } } }
|
||||
|
||||
private Decimal _SpecialPrice;
|
||||
/// <summary>特价,如有特价,以特价为准</summary>
|
||||
[DisplayName("特价")]
|
||||
[Description("特价,如有特价,以特价为准")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("SpecialPrice", "特价,如有特价,以特价为准", "money")]
|
||||
public Decimal SpecialPrice { get { return _SpecialPrice; } set { if (OnPropertyChanging(__.SpecialPrice, value)) { _SpecialPrice = value; OnPropertyChanged(__.SpecialPrice); } } }
|
||||
[BindColumn("SpecialPrice", "特价,如有特价,以特价为准", "")]
|
||||
public Decimal SpecialPrice { get => _SpecialPrice; set { if (OnPropertyChanging(__.SpecialPrice, value)) { _SpecialPrice = value; OnPropertyChanged(__.SpecialPrice); } } }
|
||||
|
||||
private Decimal _Fare;
|
||||
/// <summary>运费</summary>
|
||||
[DisplayName("运费")]
|
||||
[Description("运费")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Fare", "运费", "money")]
|
||||
public Decimal Fare { get { return _Fare; } set { if (OnPropertyChanging(__.Fare, value)) { _Fare = value; OnPropertyChanged(__.Fare); } } }
|
||||
[BindColumn("Fare", "运费", "")]
|
||||
public Decimal Fare { get => _Fare; set { if (OnPropertyChanging(__.Fare, value)) { _Fare = value; OnPropertyChanged(__.Fare); } } }
|
||||
|
||||
private Decimal _Discount;
|
||||
/// <summary>折扣</summary>
|
||||
[DisplayName("折扣")]
|
||||
[Description("折扣")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Discount", "折扣", "money")]
|
||||
public Decimal Discount { get { return _Discount; } set { if (OnPropertyChanging(__.Discount, value)) { _Discount = value; OnPropertyChanged(__.Discount); } } }
|
||||
[BindColumn("Discount", "折扣", "")]
|
||||
public Decimal Discount { get => _Discount; set { if (OnPropertyChanging(__.Discount, value)) { _Discount = value; OnPropertyChanged(__.Discount); } } }
|
||||
|
||||
private String _Material;
|
||||
/// <summary>材料</summary>
|
||||
[DisplayName("材料")]
|
||||
[Description("材料")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Material", "材料", "nvarchar(250)")]
|
||||
public String Material { get { return _Material; } set { if (OnPropertyChanging(__.Material, value)) { _Material = value; OnPropertyChanged(__.Material); } } }
|
||||
[BindColumn("Material", "材料", "")]
|
||||
public String Material { get => _Material; set { if (OnPropertyChanging(__.Material, value)) { _Material = value; OnPropertyChanged(__.Material); } } }
|
||||
|
||||
private String _Front;
|
||||
/// <summary>封面</summary>
|
||||
[DisplayName("封面")]
|
||||
[Description("封面")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Front", "封面", "nvarchar(250)")]
|
||||
public String Front { get { return _Front; } set { if (OnPropertyChanging(__.Front, value)) { _Front = value; OnPropertyChanged(__.Front); } } }
|
||||
[BindColumn("Front", "封面", "")]
|
||||
public String Front { get => _Front; set { if (OnPropertyChanging(__.Front, value)) { _Front = value; OnPropertyChanged(__.Front); } } }
|
||||
|
||||
private Int32 _Credits;
|
||||
/// <summary>积分</summary>
|
||||
[DisplayName("积分")]
|
||||
[Description("积分")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Credits", "积分", "int")]
|
||||
public Int32 Credits { get { return _Credits; } set { if (OnPropertyChanging(__.Credits, value)) { _Credits = value; OnPropertyChanged(__.Credits); } } }
|
||||
[BindColumn("Credits", "积分", "")]
|
||||
public Int32 Credits { get => _Credits; set { if (OnPropertyChanging(__.Credits, value)) { _Credits = value; OnPropertyChanged(__.Credits); } } }
|
||||
|
||||
private Int32 _Stock;
|
||||
/// <summary>库存</summary>
|
||||
[DisplayName("库存")]
|
||||
[Description("库存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Stock", "库存", "int")]
|
||||
public Int32 Stock { get { return _Stock; } set { if (OnPropertyChanging(__.Stock, value)) { _Stock = value; OnPropertyChanged(__.Stock); } } }
|
||||
[BindColumn("Stock", "库存", "")]
|
||||
public Int32 Stock { get => _Stock; set { if (OnPropertyChanging(__.Stock, value)) { _Stock = value; OnPropertyChanged(__.Stock); } } }
|
||||
|
||||
private Int32 _WarnStock;
|
||||
/// <summary>警告库存</summary>
|
||||
[DisplayName("警告库存")]
|
||||
[Description("警告库存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("WarnStock", "警告库存", "int")]
|
||||
public Int32 WarnStock { get { return _WarnStock; } set { if (OnPropertyChanging(__.WarnStock, value)) { _WarnStock = value; OnPropertyChanged(__.WarnStock); } } }
|
||||
[BindColumn("WarnStock", "警告库存", "")]
|
||||
public Int32 WarnStock { get => _WarnStock; set { if (OnPropertyChanging(__.WarnStock, value)) { _WarnStock = value; OnPropertyChanged(__.WarnStock); } } }
|
||||
|
||||
private Int32 _IsSubProduct;
|
||||
/// <summary>是否为子商品</summary>
|
||||
[DisplayName("是否为子商品")]
|
||||
[Description("是否为子商品")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsSubProduct", "是否为子商品", "int")]
|
||||
public Int32 IsSubProduct { get { return _IsSubProduct; } set { if (OnPropertyChanging(__.IsSubProduct, value)) { _IsSubProduct = value; OnPropertyChanged(__.IsSubProduct); } } }
|
||||
[BindColumn("IsSubProduct", "是否为子商品", "")]
|
||||
public Int32 IsSubProduct { get => _IsSubProduct; set { if (OnPropertyChanging(__.IsSubProduct, value)) { _IsSubProduct = value; OnPropertyChanged(__.IsSubProduct); } } }
|
||||
|
||||
private Int32 _PPId;
|
||||
/// <summary>父商品ID。如果为子商品,则需要填写父商品ID。实现多颜色功能</summary>
|
||||
[DisplayName("父商品ID")]
|
||||
[Description("父商品ID。如果为子商品,则需要填写父商品ID。实现多颜色功能")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PPId", "父商品ID。如果为子商品,则需要填写父商品ID。实现多颜色功能", "int")]
|
||||
public Int32 PPId { get { return _PPId; } set { if (OnPropertyChanging(__.PPId, value)) { _PPId = value; OnPropertyChanged(__.PPId); } } }
|
||||
[BindColumn("PPId", "父商品ID。如果为子商品,则需要填写父商品ID。实现多颜色功能", "")]
|
||||
public Int32 PPId { get => _PPId; set { if (OnPropertyChanging(__.PPId, value)) { _PPId = value; OnPropertyChanged(__.PPId); } } }
|
||||
|
||||
private String _Content;
|
||||
/// <summary>内容</summary>
|
||||
[DisplayName("内容")]
|
||||
[Description("内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Content", "内容", "ntext")]
|
||||
public String Content { get { return _Content; } set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } } }
|
||||
[BindColumn("Content", "内容", "")]
|
||||
public String Content { get => _Content; set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } } }
|
||||
|
||||
private String _Parameters;
|
||||
/// <summary>商品参数</summary>
|
||||
[DisplayName("商品参数")]
|
||||
[Description("商品参数")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Parameters", "商品参数", "ntext")]
|
||||
public String Parameters { get { return _Parameters; } set { if (OnPropertyChanging(__.Parameters, value)) { _Parameters = value; OnPropertyChanged(__.Parameters); } } }
|
||||
[BindColumn("Parameters", "商品参数", "")]
|
||||
public String Parameters { get => _Parameters; set { if (OnPropertyChanging(__.Parameters, value)) { _Parameters = value; OnPropertyChanged(__.Parameters); } } }
|
||||
|
||||
private String _Keyword;
|
||||
/// <summary>描述</summary>
|
||||
[DisplayName("描述")]
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "nvarchar(250)")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get => _Keyword; set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
|
||||
private String _Description;
|
||||
/// <summary>介绍</summary>
|
||||
[DisplayName("介绍")]
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "nvarchar(250)")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get => _Description; set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
/// <summary>跳转链接</summary>
|
||||
[DisplayName("跳转链接")]
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "nvarchar(250)")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get => _LinkURL; set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
/// <summary>类别名称颜色</summary>
|
||||
[DisplayName("类别名称颜色")]
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "nvarchar(50)")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get => _TitleColor; set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
/// <summary>模板</summary>
|
||||
[DisplayName("模板")]
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "nvarchar(250)")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get => _TemplateFile; set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
|
||||
private Int32 _IsRecommend;
|
||||
/// <summary>是否推荐</summary>
|
||||
[DisplayName("是否推荐")]
|
||||
[Description("是否推荐")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsRecommend", "是否推荐", "int")]
|
||||
public Int32 IsRecommend { get { return _IsRecommend; } set { if (OnPropertyChanging(__.IsRecommend, value)) { _IsRecommend = value; OnPropertyChanged(__.IsRecommend); } } }
|
||||
[BindColumn("IsRecommend", "是否推荐", "")]
|
||||
public Int32 IsRecommend { get => _IsRecommend; set { if (OnPropertyChanging(__.IsRecommend, value)) { _IsRecommend = value; OnPropertyChanged(__.IsRecommend); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
/// <summary>是否隐藏</summary>
|
||||
[DisplayName("是否隐藏")]
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "int")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get => _IsHide; set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
/// <summary>是否锁定,不允许删除</summary>
|
||||
[DisplayName("是否锁定")]
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "int")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get => _IsLock; set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
/// <summary>是否删除,已经删除到回收站</summary>
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "int")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get => _IsDel; set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
|
||||
private Int32 _IsTop;
|
||||
/// <summary>是否置顶</summary>
|
||||
[DisplayName("是否置顶")]
|
||||
[Description("是否置顶")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsTop", "是否置顶", "int")]
|
||||
public Int32 IsTop { get { return _IsTop; } set { if (OnPropertyChanging(__.IsTop, value)) { _IsTop = value; OnPropertyChanged(__.IsTop); } } }
|
||||
[BindColumn("IsTop", "是否置顶", "")]
|
||||
public Int32 IsTop { get => _IsTop; set { if (OnPropertyChanging(__.IsTop, value)) { _IsTop = value; OnPropertyChanged(__.IsTop); } } }
|
||||
|
||||
private Int32 _IsBest;
|
||||
/// <summary>是否精华</summary>
|
||||
[DisplayName("是否精华")]
|
||||
[Description("是否精华")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsBest", "是否精华", "int")]
|
||||
public Int32 IsBest { get { return _IsBest; } set { if (OnPropertyChanging(__.IsBest, value)) { _IsBest = value; OnPropertyChanged(__.IsBest); } } }
|
||||
[BindColumn("IsBest", "是否精华", "")]
|
||||
public Int32 IsBest { get => _IsBest; set { if (OnPropertyChanging(__.IsBest, value)) { _IsBest = value; OnPropertyChanged(__.IsBest); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
/// <summary>是否允许评论</summary>
|
||||
[DisplayName("是否允许评论")]
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "int")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get => _IsComment; set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
/// <summary>是否会员栏目</summary>
|
||||
[DisplayName("是否会员栏目")]
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "int")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get => _IsMember; set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
|
||||
private Int32 _IsNew;
|
||||
/// <summary>是否新品</summary>
|
||||
[DisplayName("是否新品")]
|
||||
[Description("是否新品")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsNew", "是否新品", "int")]
|
||||
public Int32 IsNew { get { return _IsNew; } set { if (OnPropertyChanging(__.IsNew, value)) { _IsNew = value; OnPropertyChanged(__.IsNew); } } }
|
||||
[BindColumn("IsNew", "是否新品", "")]
|
||||
public Int32 IsNew { get => _IsNew; set { if (OnPropertyChanging(__.IsNew, value)) { _IsNew = value; OnPropertyChanged(__.IsNew); } } }
|
||||
|
||||
private Int32 _IsSpecial;
|
||||
/// <summary>是否特价</summary>
|
||||
[DisplayName("是否特价")]
|
||||
[Description("是否特价")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsSpecial", "是否特价", "int")]
|
||||
public Int32 IsSpecial { get { return _IsSpecial; } set { if (OnPropertyChanging(__.IsSpecial, value)) { _IsSpecial = value; OnPropertyChanged(__.IsSpecial); } } }
|
||||
[BindColumn("IsSpecial", "是否特价", "")]
|
||||
public Int32 IsSpecial { get => _IsSpecial; set { if (OnPropertyChanging(__.IsSpecial, value)) { _IsSpecial = value; OnPropertyChanged(__.IsSpecial); } } }
|
||||
|
||||
private Int32 _IsPromote;
|
||||
/// <summary>是否促销</summary>
|
||||
[DisplayName("是否促销")]
|
||||
[Description("是否促销")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsPromote", "是否促销", "int")]
|
||||
public Int32 IsPromote { get { return _IsPromote; } set { if (OnPropertyChanging(__.IsPromote, value)) { _IsPromote = value; OnPropertyChanged(__.IsPromote); } } }
|
||||
[BindColumn("IsPromote", "是否促销", "")]
|
||||
public Int32 IsPromote { get => _IsPromote; set { if (OnPropertyChanging(__.IsPromote, value)) { _IsPromote = value; OnPropertyChanged(__.IsPromote); } } }
|
||||
|
||||
private Int32 _IsHotSales;
|
||||
/// <summary>是否热销</summary>
|
||||
[DisplayName("是否热销")]
|
||||
[Description("是否热销")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHotSales", "是否热销", "int")]
|
||||
public Int32 IsHotSales { get { return _IsHotSales; } set { if (OnPropertyChanging(__.IsHotSales, value)) { _IsHotSales = value; OnPropertyChanged(__.IsHotSales); } } }
|
||||
[BindColumn("IsHotSales", "是否热销", "")]
|
||||
public Int32 IsHotSales { get => _IsHotSales; set { if (OnPropertyChanging(__.IsHotSales, value)) { _IsHotSales = value; OnPropertyChanged(__.IsHotSales); } } }
|
||||
|
||||
private Int32 _IsBreakup;
|
||||
/// <summary>是否缺货</summary>
|
||||
[DisplayName("是否缺货")]
|
||||
[Description("是否缺货")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsBreakup", "是否缺货", "int")]
|
||||
public Int32 IsBreakup { get { return _IsBreakup; } set { if (OnPropertyChanging(__.IsBreakup, value)) { _IsBreakup = value; OnPropertyChanged(__.IsBreakup); } } }
|
||||
[BindColumn("IsBreakup", "是否缺货", "")]
|
||||
public Int32 IsBreakup { get => _IsBreakup; set { if (OnPropertyChanging(__.IsBreakup, value)) { _IsBreakup = value; OnPropertyChanged(__.IsBreakup); } } }
|
||||
|
||||
private Int32 _IsShelves;
|
||||
/// <summary>是否下架</summary>
|
||||
[DisplayName("是否下架")]
|
||||
[Description("是否下架")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsShelves", "是否下架", "int")]
|
||||
public Int32 IsShelves { get { return _IsShelves; } set { if (OnPropertyChanging(__.IsShelves, value)) { _IsShelves = value; OnPropertyChanged(__.IsShelves); } } }
|
||||
[BindColumn("IsShelves", "是否下架", "")]
|
||||
public Int32 IsShelves { get => _IsShelves; set { if (OnPropertyChanging(__.IsShelves, value)) { _IsShelves = value; OnPropertyChanged(__.IsShelves); } } }
|
||||
|
||||
private Int32 _IsVerify;
|
||||
/// <summary>是否审核,1为已经审核前台显示</summary>
|
||||
[DisplayName("是否审核")]
|
||||
[Description("是否审核,1为已经审核前台显示")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsVerify", "是否审核,1为已经审核前台显示", "int")]
|
||||
public Int32 IsVerify { get { return _IsVerify; } set { if (OnPropertyChanging(__.IsVerify, value)) { _IsVerify = value; OnPropertyChanged(__.IsVerify); } } }
|
||||
[BindColumn("IsVerify", "是否审核,1为已经审核前台显示", "")]
|
||||
public Int32 IsVerify { get => _IsVerify; set { if (OnPropertyChanging(__.IsVerify, value)) { _IsVerify = value; OnPropertyChanged(__.IsVerify); } } }
|
||||
|
||||
private Int32 _Hits;
|
||||
/// <summary>点击数量</summary>
|
||||
[DisplayName("点击数量")]
|
||||
[Description("点击数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Hits", "点击数量", "int")]
|
||||
public Int32 Hits { get { return _Hits; } set { if (OnPropertyChanging(__.Hits, value)) { _Hits = value; OnPropertyChanged(__.Hits); } } }
|
||||
[BindColumn("Hits", "点击数量", "")]
|
||||
public Int32 Hits { get => _Hits; set { if (OnPropertyChanging(__.Hits, value)) { _Hits = value; OnPropertyChanged(__.Hits); } } }
|
||||
|
||||
private Int32 _IsGift;
|
||||
/// <summary>是否为礼品商品</summary>
|
||||
[DisplayName("是否为礼品商品")]
|
||||
[Description("是否为礼品商品")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsGift", "是否为礼品商品", "int")]
|
||||
public Int32 IsGift { get { return _IsGift; } set { if (OnPropertyChanging(__.IsGift, value)) { _IsGift = value; OnPropertyChanged(__.IsGift); } } }
|
||||
[BindColumn("IsGift", "是否为礼品商品", "")]
|
||||
public Int32 IsGift { get => _IsGift; set { if (OnPropertyChanging(__.IsGift, value)) { _IsGift = value; OnPropertyChanged(__.IsGift); } } }
|
||||
|
||||
private Int32 _IsPart;
|
||||
/// <summary>是否为配件</summary>
|
||||
[DisplayName("是否为配件")]
|
||||
[Description("是否为配件")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsPart", "是否为配件", "int")]
|
||||
public Int32 IsPart { get { return _IsPart; } set { if (OnPropertyChanging(__.IsPart, value)) { _IsPart = value; OnPropertyChanged(__.IsPart); } } }
|
||||
[BindColumn("IsPart", "是否为配件", "")]
|
||||
public Int32 IsPart { get => _IsPart; set { if (OnPropertyChanging(__.IsPart, value)) { _IsPart = value; OnPropertyChanged(__.IsPart); } } }
|
||||
|
||||
private Int32 _Sequence;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Sequence", "排序", "int")]
|
||||
public Int32 Sequence { get { return _Sequence; } set { if (OnPropertyChanging(__.Sequence, value)) { _Sequence = value; OnPropertyChanged(__.Sequence); } } }
|
||||
[BindColumn("Sequence", "排序", "")]
|
||||
public Int32 Sequence { get => _Sequence; set { if (OnPropertyChanging(__.Sequence, value)) { _Sequence = value; OnPropertyChanged(__.Sequence); } } }
|
||||
|
||||
private Int32 _CommentCount;
|
||||
/// <summary>评论数量</summary>
|
||||
[DisplayName("评论数量")]
|
||||
[Description("评论数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CommentCount", "评论数量", "int")]
|
||||
public Int32 CommentCount { get { return _CommentCount; } set { if (OnPropertyChanging(__.CommentCount, value)) { _CommentCount = value; OnPropertyChanged(__.CommentCount); } } }
|
||||
[BindColumn("CommentCount", "评论数量", "")]
|
||||
public Int32 CommentCount { get => _CommentCount; set { if (OnPropertyChanging(__.CommentCount, value)) { _CommentCount = value; OnPropertyChanged(__.CommentCount); } } }
|
||||
|
||||
private String _Icon;
|
||||
/// <summary>图标</summary>
|
||||
[DisplayName("图标")]
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "nvarchar(100)")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get => _Icon; set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
|
||||
private String _ClassName;
|
||||
/// <summary>样式名称</summary>
|
||||
[DisplayName("样式名称")]
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "nvarchar(50)")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get => _ClassName; set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
/// <summary>banner图片</summary>
|
||||
[DisplayName("banner图片")]
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "nvarchar(250)")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get => _BannerImg; set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
|
||||
private String _Pic;
|
||||
/// <summary>图片</summary>
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "nvarchar(250)")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get => _Pic; set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
/// <summary>广告ID</summary>
|
||||
[DisplayName("广告ID")]
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "int")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get => _AdsId; set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
|
||||
private String _Tags;
|
||||
/// <summary>TAG</summary>
|
||||
[DisplayName("TAG")]
|
||||
[Description("TAG")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Tags", "TAG", "nvarchar(250)")]
|
||||
public String Tags { get { return _Tags; } set { if (OnPropertyChanging(__.Tags, value)) { _Tags = value; OnPropertyChanged(__.Tags); } } }
|
||||
[BindColumn("Tags", "TAG", "")]
|
||||
public String Tags { get => _Tags; set { if (OnPropertyChanging(__.Tags, value)) { _Tags = value; OnPropertyChanged(__.Tags); } } }
|
||||
|
||||
private String _ItemImg;
|
||||
/// <summary>更多图片</summary>
|
||||
[DisplayName("更多图片")]
|
||||
[Description("更多图片")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("ItemImg", "更多图片", "ntext")]
|
||||
public String ItemImg { get { return _ItemImg; } set { if (OnPropertyChanging(__.ItemImg, value)) { _ItemImg = value; OnPropertyChanged(__.ItemImg); } } }
|
||||
[BindColumn("ItemImg", "更多图片", "")]
|
||||
public String ItemImg { get => _ItemImg; set { if (OnPropertyChanging(__.ItemImg, value)) { _ItemImg = value; OnPropertyChanged(__.ItemImg); } } }
|
||||
|
||||
private String _Service;
|
||||
/// <summary>售后服务</summary>
|
||||
[DisplayName("售后服务")]
|
||||
[Description("售后服务")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Service", "售后服务", "ntext")]
|
||||
public String Service { get { return _Service; } set { if (OnPropertyChanging(__.Service, value)) { _Service = value; OnPropertyChanged(__.Service); } } }
|
||||
[BindColumn("Service", "售后服务", "")]
|
||||
public String Service { get => _Service; set { if (OnPropertyChanging(__.Service, value)) { _Service = value; OnPropertyChanged(__.Service); } } }
|
||||
|
||||
private Int32 _AuthorId;
|
||||
/// <summary>添加管理员ID</summary>
|
||||
[DisplayName("添加管理员ID")]
|
||||
[Description("添加管理员ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AuthorId", "添加管理员ID", "int")]
|
||||
public Int32 AuthorId { get { return _AuthorId; } set { if (OnPropertyChanging(__.AuthorId, value)) { _AuthorId = value; OnPropertyChanged(__.AuthorId); } } }
|
||||
[BindColumn("AuthorId", "添加管理员ID", "")]
|
||||
public Int32 AuthorId { get => _AuthorId; set { if (OnPropertyChanging(__.AuthorId, value)) { _AuthorId = value; OnPropertyChanged(__.AuthorId); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "datetime")]
|
||||
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get => _AddTime; set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>时间</summary>
|
||||
[DisplayName("时间")]
|
||||
[Description("时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "时间", "datetime")]
|
||||
public DateTime UpdateTime { get { return _UpdateTime; } set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
[BindColumn("UpdateTime", "时间", "")]
|
||||
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
|
||||
private String _Location;
|
||||
/// <summary>路径</summary>
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "nvarchar(100)")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get => _Location; set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
|
||||
private String _FilePath;
|
||||
/// <summary>存放目录</summary>
|
||||
[DisplayName("存放目录")]
|
||||
[Description("存放目录")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("FilePath", "存放目录", "nvarchar(100)")]
|
||||
public String FilePath { get { return _FilePath; } set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
[BindColumn("FilePath", "存放目录", "")]
|
||||
public String FilePath { get => _FilePath; set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
|
||||
private String _FileName;
|
||||
/// <summary>文件名称</summary>
|
||||
[DisplayName("文件名称")]
|
||||
[Description("文件名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("FileName", "文件名称", "")]
|
||||
public String FileName { get => _FileName; set { if (OnPropertyChanging(__.FileName, value)) { _FileName = value; OnPropertyChanged(__.FileName); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -546,71 +555,72 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.KId : return _KId;
|
||||
case __.BId : return _BId;
|
||||
case __.ShopId : return _ShopId;
|
||||
case __.CId : return _CId;
|
||||
case __.SupportId : return _SupportId;
|
||||
case __.Title : return _Title;
|
||||
case __.ItemNO : return _ItemNO;
|
||||
case __.SubTitle : return _SubTitle;
|
||||
case __.Unit : return _Unit;
|
||||
case __.Spec : return _Spec;
|
||||
case __.Color : return _Color;
|
||||
case __.Weight : return _Weight;
|
||||
case __.Price : return _Price;
|
||||
case __.MarketPrice : return _MarketPrice;
|
||||
case __.SpecialPrice : return _SpecialPrice;
|
||||
case __.Fare : return _Fare;
|
||||
case __.Discount : return _Discount;
|
||||
case __.Material : return _Material;
|
||||
case __.Front : return _Front;
|
||||
case __.Credits : return _Credits;
|
||||
case __.Stock : return _Stock;
|
||||
case __.WarnStock : return _WarnStock;
|
||||
case __.IsSubProduct : return _IsSubProduct;
|
||||
case __.PPId : return _PPId;
|
||||
case __.Content : return _Content;
|
||||
case __.Parameters : return _Parameters;
|
||||
case __.Keyword : return _Keyword;
|
||||
case __.Description : return _Description;
|
||||
case __.LinkURL : return _LinkURL;
|
||||
case __.TitleColor : return _TitleColor;
|
||||
case __.TemplateFile : return _TemplateFile;
|
||||
case __.IsRecommend : return _IsRecommend;
|
||||
case __.IsHide : return _IsHide;
|
||||
case __.IsLock : return _IsLock;
|
||||
case __.IsDel : return _IsDel;
|
||||
case __.IsTop : return _IsTop;
|
||||
case __.IsBest : return _IsBest;
|
||||
case __.IsComment : return _IsComment;
|
||||
case __.IsMember : return _IsMember;
|
||||
case __.IsNew : return _IsNew;
|
||||
case __.IsSpecial : return _IsSpecial;
|
||||
case __.IsPromote : return _IsPromote;
|
||||
case __.IsHotSales : return _IsHotSales;
|
||||
case __.IsBreakup : return _IsBreakup;
|
||||
case __.IsShelves : return _IsShelves;
|
||||
case __.IsVerify : return _IsVerify;
|
||||
case __.Hits : return _Hits;
|
||||
case __.IsGift : return _IsGift;
|
||||
case __.IsPart : return _IsPart;
|
||||
case __.Sequence : return _Sequence;
|
||||
case __.CommentCount : return _CommentCount;
|
||||
case __.Icon : return _Icon;
|
||||
case __.ClassName : return _ClassName;
|
||||
case __.BannerImg : return _BannerImg;
|
||||
case __.Pic : return _Pic;
|
||||
case __.AdsId : return _AdsId;
|
||||
case __.Tags : return _Tags;
|
||||
case __.ItemImg : return _ItemImg;
|
||||
case __.Service : return _Service;
|
||||
case __.AuthorId : return _AuthorId;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.UpdateTime : return _UpdateTime;
|
||||
case __.Location : return _Location;
|
||||
case __.FilePath : return _FilePath;
|
||||
case __.Id: return _Id;
|
||||
case __.KId: return _KId;
|
||||
case __.BId: return _BId;
|
||||
case __.ShopId: return _ShopId;
|
||||
case __.CId: return _CId;
|
||||
case __.SupportId: return _SupportId;
|
||||
case __.Title: return _Title;
|
||||
case __.ItemNO: return _ItemNO;
|
||||
case __.SubTitle: return _SubTitle;
|
||||
case __.Unit: return _Unit;
|
||||
case __.Spec: return _Spec;
|
||||
case __.Color: return _Color;
|
||||
case __.Weight: return _Weight;
|
||||
case __.Price: return _Price;
|
||||
case __.MarketPrice: return _MarketPrice;
|
||||
case __.SpecialPrice: return _SpecialPrice;
|
||||
case __.Fare: return _Fare;
|
||||
case __.Discount: return _Discount;
|
||||
case __.Material: return _Material;
|
||||
case __.Front: return _Front;
|
||||
case __.Credits: return _Credits;
|
||||
case __.Stock: return _Stock;
|
||||
case __.WarnStock: return _WarnStock;
|
||||
case __.IsSubProduct: return _IsSubProduct;
|
||||
case __.PPId: return _PPId;
|
||||
case __.Content: return _Content;
|
||||
case __.Parameters: return _Parameters;
|
||||
case __.Keyword: return _Keyword;
|
||||
case __.Description: return _Description;
|
||||
case __.LinkURL: return _LinkURL;
|
||||
case __.TitleColor: return _TitleColor;
|
||||
case __.TemplateFile: return _TemplateFile;
|
||||
case __.IsRecommend: return _IsRecommend;
|
||||
case __.IsHide: return _IsHide;
|
||||
case __.IsLock: return _IsLock;
|
||||
case __.IsDel: return _IsDel;
|
||||
case __.IsTop: return _IsTop;
|
||||
case __.IsBest: return _IsBest;
|
||||
case __.IsComment: return _IsComment;
|
||||
case __.IsMember: return _IsMember;
|
||||
case __.IsNew: return _IsNew;
|
||||
case __.IsSpecial: return _IsSpecial;
|
||||
case __.IsPromote: return _IsPromote;
|
||||
case __.IsHotSales: return _IsHotSales;
|
||||
case __.IsBreakup: return _IsBreakup;
|
||||
case __.IsShelves: return _IsShelves;
|
||||
case __.IsVerify: return _IsVerify;
|
||||
case __.Hits: return _Hits;
|
||||
case __.IsGift: return _IsGift;
|
||||
case __.IsPart: return _IsPart;
|
||||
case __.Sequence: return _Sequence;
|
||||
case __.CommentCount: return _CommentCount;
|
||||
case __.Icon: return _Icon;
|
||||
case __.ClassName: return _ClassName;
|
||||
case __.BannerImg: return _BannerImg;
|
||||
case __.Pic: return _Pic;
|
||||
case __.AdsId: return _AdsId;
|
||||
case __.Tags: return _Tags;
|
||||
case __.ItemImg: return _ItemImg;
|
||||
case __.Service: return _Service;
|
||||
case __.AuthorId: return _AuthorId;
|
||||
case __.AddTime: return _AddTime;
|
||||
case __.UpdateTime: return _UpdateTime;
|
||||
case __.Location: return _Location;
|
||||
case __.FilePath: return _FilePath;
|
||||
case __.FileName: return _FileName;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -618,71 +628,72 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.KId : _KId = Convert.ToInt32(value); break;
|
||||
case __.BId : _BId = Convert.ToInt32(value); break;
|
||||
case __.ShopId : _ShopId = Convert.ToInt32(value); break;
|
||||
case __.CId : _CId = Convert.ToInt32(value); break;
|
||||
case __.SupportId : _SupportId = Convert.ToInt32(value); break;
|
||||
case __.Title : _Title = Convert.ToString(value); break;
|
||||
case __.ItemNO : _ItemNO = Convert.ToString(value); break;
|
||||
case __.SubTitle : _SubTitle = Convert.ToString(value); break;
|
||||
case __.Unit : _Unit = Convert.ToString(value); break;
|
||||
case __.Spec : _Spec = Convert.ToString(value); break;
|
||||
case __.Color : _Color = Convert.ToString(value); break;
|
||||
case __.Weight : _Weight = Convert.ToString(value); break;
|
||||
case __.Price : _Price = Convert.ToDecimal(value); break;
|
||||
case __.MarketPrice : _MarketPrice = Convert.ToDecimal(value); break;
|
||||
case __.SpecialPrice : _SpecialPrice = Convert.ToDecimal(value); break;
|
||||
case __.Fare : _Fare = Convert.ToDecimal(value); break;
|
||||
case __.Discount : _Discount = Convert.ToDecimal(value); break;
|
||||
case __.Material : _Material = Convert.ToString(value); break;
|
||||
case __.Front : _Front = Convert.ToString(value); break;
|
||||
case __.Credits : _Credits = Convert.ToInt32(value); break;
|
||||
case __.Stock : _Stock = Convert.ToInt32(value); break;
|
||||
case __.WarnStock : _WarnStock = Convert.ToInt32(value); break;
|
||||
case __.IsSubProduct : _IsSubProduct = Convert.ToInt32(value); break;
|
||||
case __.PPId : _PPId = Convert.ToInt32(value); break;
|
||||
case __.Content : _Content = Convert.ToString(value); break;
|
||||
case __.Parameters : _Parameters = Convert.ToString(value); break;
|
||||
case __.Keyword : _Keyword = Convert.ToString(value); break;
|
||||
case __.Description : _Description = Convert.ToString(value); break;
|
||||
case __.LinkURL : _LinkURL = Convert.ToString(value); break;
|
||||
case __.TitleColor : _TitleColor = Convert.ToString(value); break;
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.IsRecommend : _IsRecommend = Convert.ToInt32(value); break;
|
||||
case __.IsHide : _IsHide = Convert.ToInt32(value); break;
|
||||
case __.IsLock : _IsLock = Convert.ToInt32(value); break;
|
||||
case __.IsDel : _IsDel = Convert.ToInt32(value); break;
|
||||
case __.IsTop : _IsTop = Convert.ToInt32(value); break;
|
||||
case __.IsBest : _IsBest = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsMember : _IsMember = Convert.ToInt32(value); break;
|
||||
case __.IsNew : _IsNew = Convert.ToInt32(value); break;
|
||||
case __.IsSpecial : _IsSpecial = Convert.ToInt32(value); break;
|
||||
case __.IsPromote : _IsPromote = Convert.ToInt32(value); break;
|
||||
case __.IsHotSales : _IsHotSales = Convert.ToInt32(value); break;
|
||||
case __.IsBreakup : _IsBreakup = Convert.ToInt32(value); break;
|
||||
case __.IsShelves : _IsShelves = Convert.ToInt32(value); break;
|
||||
case __.IsVerify : _IsVerify = Convert.ToInt32(value); break;
|
||||
case __.Hits : _Hits = Convert.ToInt32(value); break;
|
||||
case __.IsGift : _IsGift = Convert.ToInt32(value); break;
|
||||
case __.IsPart : _IsPart = Convert.ToInt32(value); break;
|
||||
case __.Sequence : _Sequence = Convert.ToInt32(value); break;
|
||||
case __.CommentCount : _CommentCount = Convert.ToInt32(value); break;
|
||||
case __.Icon : _Icon = Convert.ToString(value); break;
|
||||
case __.ClassName : _ClassName = Convert.ToString(value); break;
|
||||
case __.BannerImg : _BannerImg = Convert.ToString(value); break;
|
||||
case __.Pic : _Pic = Convert.ToString(value); break;
|
||||
case __.AdsId : _AdsId = Convert.ToInt32(value); break;
|
||||
case __.Tags : _Tags = Convert.ToString(value); break;
|
||||
case __.ItemImg : _ItemImg = Convert.ToString(value); break;
|
||||
case __.Service : _Service = Convert.ToString(value); break;
|
||||
case __.AuthorId : _AuthorId = Convert.ToInt32(value); break;
|
||||
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
|
||||
case __.UpdateTime : _UpdateTime = Convert.ToDateTime(value); break;
|
||||
case __.Location : _Location = Convert.ToString(value); break;
|
||||
case __.FilePath : _FilePath = Convert.ToString(value); break;
|
||||
case __.Id: _Id = value.ToInt(); break;
|
||||
case __.KId: _KId = value.ToInt(); break;
|
||||
case __.BId: _BId = value.ToInt(); break;
|
||||
case __.ShopId: _ShopId = value.ToInt(); break;
|
||||
case __.CId: _CId = value.ToInt(); break;
|
||||
case __.SupportId: _SupportId = value.ToInt(); break;
|
||||
case __.Title: _Title = Convert.ToString(value); break;
|
||||
case __.ItemNO: _ItemNO = Convert.ToString(value); break;
|
||||
case __.SubTitle: _SubTitle = Convert.ToString(value); break;
|
||||
case __.Unit: _Unit = Convert.ToString(value); break;
|
||||
case __.Spec: _Spec = Convert.ToString(value); break;
|
||||
case __.Color: _Color = Convert.ToString(value); break;
|
||||
case __.Weight: _Weight = Convert.ToString(value); break;
|
||||
case __.Price: _Price = Convert.ToDecimal(value); break;
|
||||
case __.MarketPrice: _MarketPrice = Convert.ToDecimal(value); break;
|
||||
case __.SpecialPrice: _SpecialPrice = Convert.ToDecimal(value); break;
|
||||
case __.Fare: _Fare = Convert.ToDecimal(value); break;
|
||||
case __.Discount: _Discount = Convert.ToDecimal(value); break;
|
||||
case __.Material: _Material = Convert.ToString(value); break;
|
||||
case __.Front: _Front = Convert.ToString(value); break;
|
||||
case __.Credits: _Credits = value.ToInt(); break;
|
||||
case __.Stock: _Stock = value.ToInt(); break;
|
||||
case __.WarnStock: _WarnStock = value.ToInt(); break;
|
||||
case __.IsSubProduct: _IsSubProduct = value.ToInt(); break;
|
||||
case __.PPId: _PPId = value.ToInt(); break;
|
||||
case __.Content: _Content = Convert.ToString(value); break;
|
||||
case __.Parameters: _Parameters = Convert.ToString(value); break;
|
||||
case __.Keyword: _Keyword = Convert.ToString(value); break;
|
||||
case __.Description: _Description = Convert.ToString(value); break;
|
||||
case __.LinkURL: _LinkURL = Convert.ToString(value); break;
|
||||
case __.TitleColor: _TitleColor = Convert.ToString(value); break;
|
||||
case __.TemplateFile: _TemplateFile = Convert.ToString(value); break;
|
||||
case __.IsRecommend: _IsRecommend = value.ToInt(); break;
|
||||
case __.IsHide: _IsHide = value.ToInt(); break;
|
||||
case __.IsLock: _IsLock = value.ToInt(); break;
|
||||
case __.IsDel: _IsDel = value.ToInt(); break;
|
||||
case __.IsTop: _IsTop = value.ToInt(); break;
|
||||
case __.IsBest: _IsBest = value.ToInt(); break;
|
||||
case __.IsComment: _IsComment = value.ToInt(); break;
|
||||
case __.IsMember: _IsMember = value.ToInt(); break;
|
||||
case __.IsNew: _IsNew = value.ToInt(); break;
|
||||
case __.IsSpecial: _IsSpecial = value.ToInt(); break;
|
||||
case __.IsPromote: _IsPromote = value.ToInt(); break;
|
||||
case __.IsHotSales: _IsHotSales = value.ToInt(); break;
|
||||
case __.IsBreakup: _IsBreakup = value.ToInt(); break;
|
||||
case __.IsShelves: _IsShelves = value.ToInt(); break;
|
||||
case __.IsVerify: _IsVerify = value.ToInt(); break;
|
||||
case __.Hits: _Hits = value.ToInt(); break;
|
||||
case __.IsGift: _IsGift = value.ToInt(); break;
|
||||
case __.IsPart: _IsPart = value.ToInt(); break;
|
||||
case __.Sequence: _Sequence = value.ToInt(); break;
|
||||
case __.CommentCount: _CommentCount = value.ToInt(); break;
|
||||
case __.Icon: _Icon = Convert.ToString(value); break;
|
||||
case __.ClassName: _ClassName = Convert.ToString(value); break;
|
||||
case __.BannerImg: _BannerImg = Convert.ToString(value); break;
|
||||
case __.Pic: _Pic = Convert.ToString(value); break;
|
||||
case __.AdsId: _AdsId = value.ToInt(); break;
|
||||
case __.Tags: _Tags = Convert.ToString(value); break;
|
||||
case __.ItemImg: _ItemImg = Convert.ToString(value); break;
|
||||
case __.Service: _Service = Convert.ToString(value); break;
|
||||
case __.AuthorId: _AuthorId = value.ToInt(); break;
|
||||
case __.AddTime: _AddTime = value.ToDateTime(); break;
|
||||
case __.UpdateTime: _UpdateTime = value.ToDateTime(); break;
|
||||
case __.Location: _Location = Convert.ToString(value); break;
|
||||
case __.FilePath: _FilePath = Convert.ToString(value); break;
|
||||
case __.FileName: _FileName = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -888,7 +899,10 @@ namespace COMCMS.Core
|
||||
/// <summary>存放目录</summary>
|
||||
public static readonly Field FilePath = FindByName(__.FilePath);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
/// <summary>文件名称</summary>
|
||||
public static readonly Field FileName = FindByName(__.FileName);
|
||||
|
||||
static Field FindByName(String name) => Meta.Table.FindByName(name);
|
||||
}
|
||||
|
||||
/// <summary>取得商品字段名称的快捷方式</summary>
|
||||
@@ -1088,6 +1102,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>存放目录</summary>
|
||||
public const String FilePath = "FilePath";
|
||||
|
||||
/// <summary>文件名称</summary>
|
||||
public const String FileName = "FileName";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1290,6 +1307,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>存放目录</summary>
|
||||
String FilePath { get; set; }
|
||||
|
||||
/// <summary>文件名称</summary>
|
||||
String FileName { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>快餐</summary>
|
||||
public partial class Food : Entity<Food>
|
||||
{
|
||||
#region 对象操作
|
||||
static Food()
|
||||
{
|
||||
// 累加字段
|
||||
//Meta.Factory.AdditionalFields.Add(__.Logins);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 货币保留6位小数
|
||||
Price = Math.Round(Price, 6);
|
||||
MarketPrice = Math.Round(MarketPrice, 6);
|
||||
SpecialPrice = Math.Round(SpecialPrice, 6);
|
||||
Fare = Math.Round(Fare, 6);
|
||||
Discount = Math.Round(Discount, 6);
|
||||
//if (!Dirtys[nameof(UpdateTime)]) nameof(UpdateTime) = DateTime.Now;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化Food[快餐]数据……");
|
||||
|
||||
// var entity = new Food();
|
||||
// entity.Id = 0;
|
||||
// entity.KId = 0;
|
||||
// entity.BId = 0;
|
||||
// entity.ShopId = 0;
|
||||
// entity.CId = 0;
|
||||
// entity.SupportId = 0;
|
||||
// entity.Title = "abc";
|
||||
// entity.ItemNO = "abc";
|
||||
// entity.SubTitle = "abc";
|
||||
// entity.Unit = "abc";
|
||||
// entity.Spec = "abc";
|
||||
// entity.Color = "abc";
|
||||
// entity.Weight = "abc";
|
||||
// entity.Price = 0.0;
|
||||
// entity.MarketPrice = 0.0;
|
||||
// entity.SpecialPrice = 0.0;
|
||||
// entity.Fare = 0.0;
|
||||
// entity.Discount = 0.0;
|
||||
// entity.Material = "abc";
|
||||
// entity.Front = "abc";
|
||||
// entity.Credits = 0;
|
||||
// entity.Stock = 0;
|
||||
// entity.WarnStock = 0;
|
||||
// entity.IsSubProduct = 0;
|
||||
// entity.PPId = 0;
|
||||
// entity.Content = "abc";
|
||||
// entity.Parameters = "abc";
|
||||
// entity.Keyword = "abc";
|
||||
// entity.Description = "abc";
|
||||
// entity.LinkURL = "abc";
|
||||
// entity.TitleColor = "abc";
|
||||
// entity.TemplateFile = "abc";
|
||||
// entity.IsRecommend = 0;
|
||||
// entity.IsHide = 0;
|
||||
// entity.IsLock = 0;
|
||||
// entity.IsDel = 0;
|
||||
// entity.IsTop = 0;
|
||||
// entity.IsBest = 0;
|
||||
// entity.IsComment = 0;
|
||||
// entity.IsMember = 0;
|
||||
// entity.IsNew = 0;
|
||||
// entity.IsSpecial = 0;
|
||||
// entity.IsPromote = 0;
|
||||
// entity.IsHotSales = 0;
|
||||
// entity.IsBreakup = 0;
|
||||
// entity.IsShelves = 0;
|
||||
// entity.IsVerify = 0;
|
||||
// entity.Hits = 0;
|
||||
// entity.IsGift = 0;
|
||||
// entity.IsPart = 0;
|
||||
// entity.Sequence = 0;
|
||||
// entity.CommentCount = 0;
|
||||
// entity.Icon = "abc";
|
||||
// entity.ClassName = "abc";
|
||||
// entity.BannerImg = "abc";
|
||||
// entity.Pic = "abc";
|
||||
// entity.AdsId = 0;
|
||||
// entity.Tags = "abc";
|
||||
// entity.ItemImg = "abc";
|
||||
// entity.Service = "abc";
|
||||
// entity.AuthorId = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Location = "abc";
|
||||
// entity.FilePath = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化Food[快餐]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Food FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache[id];
|
||||
|
||||
return Find(_.Id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using NewLife;
|
||||
using NewLife.Data;
|
||||
using NewLife.Log;
|
||||
using NewLife.Model;
|
||||
using NewLife.Reflection;
|
||||
using NewLife.Threading;
|
||||
using NewLife.Web;
|
||||
using XCode;
|
||||
using XCode.Cache;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>酒店房间</summary>
|
||||
public partial class HotelRoom : Entity<HotelRoom>
|
||||
{
|
||||
#region 对象操作
|
||||
static HotelRoom()
|
||||
{
|
||||
// 累加字段
|
||||
//Meta.Factory.AdditionalFields.Add(__.Logins);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
// 货币保留6位小数
|
||||
Price = Math.Round(Price, 6);
|
||||
MarketPrice = Math.Round(MarketPrice, 6);
|
||||
SpecialPrice = Math.Round(SpecialPrice, 6);
|
||||
Fare = Math.Round(Fare, 6);
|
||||
Discount = Math.Round(Discount, 6);
|
||||
//if (!Dirtys[nameof(UpdateTime)]) nameof(UpdateTime) = DateTime.Now;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化HotelRoom[酒店房间]数据……");
|
||||
|
||||
// var entity = new HotelRoom();
|
||||
// entity.Id = 0;
|
||||
// entity.KId = 0;
|
||||
// entity.BId = 0;
|
||||
// entity.ShopId = 0;
|
||||
// entity.CId = 0;
|
||||
// entity.SupportId = 0;
|
||||
// entity.Title = "abc";
|
||||
// entity.ItemNO = "abc";
|
||||
// entity.SubTitle = "abc";
|
||||
// entity.Unit = "abc";
|
||||
// entity.Spec = "abc";
|
||||
// entity.Color = "abc";
|
||||
// entity.Weight = "abc";
|
||||
// entity.Price = 0.0;
|
||||
// entity.MarketPrice = 0.0;
|
||||
// entity.SpecialPrice = 0.0;
|
||||
// entity.Fare = 0.0;
|
||||
// entity.Discount = 0.0;
|
||||
// entity.Material = "abc";
|
||||
// entity.Front = "abc";
|
||||
// entity.Credits = 0;
|
||||
// entity.Stock = 0;
|
||||
// entity.WarnStock = 0;
|
||||
// entity.IsSubProduct = 0;
|
||||
// entity.PPId = 0;
|
||||
// entity.Content = "abc";
|
||||
// entity.Parameters = "abc";
|
||||
// entity.Keyword = "abc";
|
||||
// entity.Description = "abc";
|
||||
// entity.LinkURL = "abc";
|
||||
// entity.TitleColor = "abc";
|
||||
// entity.TemplateFile = "abc";
|
||||
// entity.IsRecommend = 0;
|
||||
// entity.IsHide = 0;
|
||||
// entity.IsLock = 0;
|
||||
// entity.IsDel = 0;
|
||||
// entity.IsTop = 0;
|
||||
// entity.IsBest = 0;
|
||||
// entity.IsComment = 0;
|
||||
// entity.IsMember = 0;
|
||||
// entity.IsNew = 0;
|
||||
// entity.IsSpecial = 0;
|
||||
// entity.IsPromote = 0;
|
||||
// entity.IsHotSales = 0;
|
||||
// entity.IsBreakup = 0;
|
||||
// entity.IsShelves = 0;
|
||||
// entity.IsVerify = 0;
|
||||
// entity.Hits = 0;
|
||||
// entity.IsGift = 0;
|
||||
// entity.IsPart = 0;
|
||||
// entity.Sequence = 0;
|
||||
// entity.CommentCount = 0;
|
||||
// entity.Icon = "abc";
|
||||
// entity.ClassName = "abc";
|
||||
// entity.BannerImg = "abc";
|
||||
// entity.Pic = "abc";
|
||||
// entity.AdsId = 0;
|
||||
// entity.Tags = "abc";
|
||||
// entity.ItemImg = "abc";
|
||||
// entity.Service = "abc";
|
||||
// entity.AuthorId = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Location = "abc";
|
||||
// entity.FilePath = "abc";
|
||||
// entity.PriceList = "abc";
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化HotelRoom[酒店房间]数据!");
|
||||
//}
|
||||
|
||||
///// <summary>已重载。基类先调用Valid(true)验证数据,然后在事务保护内调用OnInsert</summary>
|
||||
///// <returns></returns>
|
||||
//public override Int32 Insert()
|
||||
//{
|
||||
// return base.Insert();
|
||||
//}
|
||||
|
||||
///// <summary>已重载。在事务保护范围内处理业务,位于Valid之后</summary>
|
||||
///// <returns></returns>
|
||||
//protected override Int32 OnDelete()
|
||||
//{
|
||||
// return base.OnDelete();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 扩展属性
|
||||
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static HotelRoom FindById(Int32 id)
|
||||
{
|
||||
if (id <= 0) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.Id == id);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache[id];
|
||||
|
||||
return Find(_.Id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,4 +38,29 @@ namespace COMCMS.Core.Models
|
||||
public int qty { get; set; } = 1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统文件目录信息列表
|
||||
/// <summary>
|
||||
/// 系统文件目录信息
|
||||
/// </summary>
|
||||
public class DirInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 目录名称
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// 目录
|
||||
/// </summary>
|
||||
public string path { get; set; }
|
||||
/// <summary>
|
||||
/// 目录详情
|
||||
/// </summary>
|
||||
public string fullPath { get; set; }
|
||||
/// <summary>
|
||||
/// 子目录
|
||||
/// </summary>
|
||||
public List<DirInfo> subList { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace COMCMS.Core
|
||||
/// 返回URL
|
||||
/// </summary>
|
||||
public string ReturnUrl { get; set; }
|
||||
/// <summary>
|
||||
/// 其他详情
|
||||
/// </summary>
|
||||
public object Detail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取JSON字符串
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
using NewLife;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
|
||||
@@ -35,19 +35,23 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
public IActionResult AddArticleCategory()
|
||||
{
|
||||
//获取上级栏目
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.ListTree = list;
|
||||
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
|
||||
List<string> listTpls = new List<string>();
|
||||
var asms = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var asmItem in asms)
|
||||
{
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
string fullName = asmItem.GetName().ToString();
|
||||
if (fullName.IndexOf("COMCMS.Web") > -1)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Article_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Article_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
ViewBag.ListTpl = listTpls;
|
||||
@@ -65,33 +69,82 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "文章栏目标题不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.FilePath))
|
||||
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
{
|
||||
tip.Message = "文章栏目路径不能为空!";
|
||||
return Json(tip);
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (!AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
|
||||
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
}
|
||||
//判断过滤IP地址
|
||||
if (!string.IsNullOrEmpty(model.AllowIp))
|
||||
{
|
||||
string[] strRows = model.AllowIp.Split(new string[] { "\n" }, StringSplitOptions.None);
|
||||
if (strRows != null && strRows.Length > 0)
|
||||
{
|
||||
foreach (var row in strRows)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(row))
|
||||
{
|
||||
if (row.IndexOf("-") > -1)
|
||||
{
|
||||
string[] arrIps = row.Split(new string[] { "-" }, StringSplitOptions.None);
|
||||
if (arrIps != null && arrIps.Length > 0)
|
||||
{
|
||||
if (arrIps.Length != 2)
|
||||
{
|
||||
tip.Message = "每一行只能有一个“-”,如果需要限制多个ip段,请换行再输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
//判断ip是否符合规则
|
||||
foreach (var ip in arrIps)
|
||||
{
|
||||
if (!Utils.IsIP(ip))
|
||||
{
|
||||
tip.Message = "您输入的IP地址有误:" + ip;
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
long ip1 = Utils.GetLongIP(arrIps[0]);
|
||||
long ip2 = Utils.GetLongIP(arrIps[1]);
|
||||
if (ip1 > ip2)
|
||||
{
|
||||
tip.Message = "您输入的IP地址段有误,请按小到大输入";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utils.IsIP(row))
|
||||
{
|
||||
tip.Message = "您输入的IP地址有误:" + row;
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.Insert();
|
||||
Core.Admin.WriteLogActions("添加文章栏目(id:" + model.Id + ");");
|
||||
@@ -112,7 +165,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
//获取上级栏目
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.ListTree = list;
|
||||
|
||||
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
|
||||
@@ -120,12 +173,16 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
var asms = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var asmItem in asms)
|
||||
{
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
string fullName = asmItem.GetName().ToString();
|
||||
if (fullName.IndexOf("COMCMS.Web") > -1)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Article_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Article")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Article_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
ViewBag.ListTpl = listTpls;
|
||||
@@ -155,27 +212,29 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.FilePath))
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
{
|
||||
tip.Message = "文章栏目路径不能为空!";
|
||||
return Json(tip);
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0))
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
@@ -192,7 +251,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.Location = ArticleCategory.GetNewLocation(model.PId);
|
||||
entity.Level = ArticleCategory.GetNewLevel(model.PId);
|
||||
//修改文章的location
|
||||
IList<Article> alist = Article.FindAll(Article._.KId == model.Id, null, null, 0, 0);
|
||||
IList<Article> alist = Article.FindAll(Article._.KId == model.Id, Article._.Id.Desc(), null, 0, 0);
|
||||
if (alist != null && alist.Count > 0)
|
||||
{
|
||||
foreach (var a in alist)
|
||||
@@ -228,19 +287,74 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.Pic = model.Pic;
|
||||
entity.FilePath = model.FilePath;
|
||||
|
||||
//判断过滤IP地址
|
||||
if (!string.IsNullOrEmpty(model.AllowIp))
|
||||
{
|
||||
string[] strRows = model.AllowIp.Split(new string[] { "\n" }, StringSplitOptions.None);
|
||||
if (strRows != null && strRows.Length > 0)
|
||||
{
|
||||
foreach (var row in strRows)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(row))
|
||||
{
|
||||
if (row.IndexOf("-") > -1)
|
||||
{
|
||||
string[] arrIps = row.Split(new string[] { "-" }, StringSplitOptions.None);
|
||||
if (arrIps != null && arrIps.Length > 0)
|
||||
{
|
||||
if (arrIps.Length != 2)
|
||||
{
|
||||
tip.Message = "每一行只能有一个“-”,如果需要限制多个ip段,请换行再输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
//判断ip是否符合规则
|
||||
foreach (var ip in arrIps)
|
||||
{
|
||||
if (!Utils.IsIP(ip))
|
||||
{
|
||||
tip.Message = "您输入的IP地址有误1:" + ip;
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
long ip1 = Utils.GetLongIP(arrIps[0]);
|
||||
long ip2 = Utils.GetLongIP(arrIps[1]);
|
||||
if (ip1 > ip2)
|
||||
{
|
||||
tip.Message = "您输入的IP地址段有误,请按小到大输入";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utils.IsIP(row))
|
||||
{
|
||||
tip.Message = "您输入的IP地址有误2:" + row;
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entity.AllowIp = model.AllowIp;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.AllowIp = "";
|
||||
}
|
||||
|
||||
entity.Save();
|
||||
//修改所有文章的路径
|
||||
if (idNeedUpdateAllArticleFilePath)
|
||||
{
|
||||
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, null, null, 0, 0);
|
||||
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, Article._.Id.Desc(), null, 0, 0);
|
||||
if(listArticles !=null && listArticles.Count > 0)
|
||||
{
|
||||
foreach (var item in listArticles)
|
||||
{
|
||||
item.FilePath = entity.FilePath;
|
||||
}
|
||||
listArticles.BatchUpdate();
|
||||
listArticles.Update();
|
||||
}
|
||||
}
|
||||
Core.Admin.WriteLogActions("修改文章栏目(id:" + entity.Id + ");");
|
||||
@@ -281,6 +395,26 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改文章栏目排序
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "articlecategory", "JSON")]
|
||||
public IActionResult DoEditCategoryRank(int id, int rank)
|
||||
{
|
||||
ArticleCategory entity = ArticleCategory.Find(ArticleCategory._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.Rank = rank;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions($"修改文章栏目排序(id:{id},排序:{rank});");
|
||||
tip.Message = "修改排序成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 文章
|
||||
/// <summary>
|
||||
/// 文章栏目管理
|
||||
@@ -291,7 +425,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
public IActionResult ArticleList()
|
||||
{
|
||||
//获取上级栏目
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.ListKinds = list;
|
||||
Core.Admin.WriteLogActions("查看文章列表;");
|
||||
return View();
|
||||
@@ -305,7 +439,23 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
numPerPage = limit;
|
||||
currentPage = page;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
Expression ex = Article._.Id > 0;
|
||||
Expression ex = new Expression(); ;
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory)?"[]": my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
ex &= Article._.KId.In(aclist);
|
||||
}
|
||||
|
||||
//仅显示有权限内容
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1)
|
||||
ex &= Article._.AuthorId == my.Id;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
{
|
||||
@@ -354,7 +504,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[MyAuthorize("add", "article")]
|
||||
public IActionResult AddArticle()
|
||||
{
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.ListKinds = list;
|
||||
string lastkid = SessionHelper.GetSession("com_add_article_kid").ToString();
|
||||
ViewBag.lastkid = lastkid;
|
||||
@@ -387,6 +537,28 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "文章图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.FileName) && !Utils.ChekHTMLFileNameIsOK(model.FileName))
|
||||
{
|
||||
tip.Message = "静态化文件名错误,请填写正确的,或者留空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//处理文章更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -407,12 +579,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
model.Content = content;
|
||||
}
|
||||
model.ItemImg = morIMG;
|
||||
model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.AuthorId = my.Id;
|
||||
model.Insert();
|
||||
ArticleCategory.UpdateDetailCount(model.KId);
|
||||
SessionHelper.WriteSession("com_add_article_kid", model.KId);
|
||||
//添加TAG
|
||||
//Tag.InsertTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Tags.InsertTags(model.Tags, Utils.CMSType.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("添加文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加文章成功";
|
||||
@@ -425,7 +597,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[MyAuthorize("edit", "article")]
|
||||
public IActionResult EditArticle(int id)
|
||||
{
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.ListKinds = list;
|
||||
|
||||
Article entity = Article.Find(Article._.Id == id);
|
||||
@@ -470,6 +642,35 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "文章图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
//处理
|
||||
if (!string.IsNullOrEmpty(model.FileName) && !Utils.ChekHTMLFileNameIsOK(model.FileName))
|
||||
{
|
||||
tip.Message = "静态化文件名错误,请填写正确的,或者留空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if(my.Roles.OnlyEditMyselfArticle ==1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法编辑非自己添加的文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
//处理文章更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -537,10 +738,11 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.Title = model.Title;
|
||||
entity.TitleColor = model.TitleColor;
|
||||
entity.UpdateTime = DateTime.Now;
|
||||
entity.FileName = model.FileName;
|
||||
|
||||
//model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
entity.Update();
|
||||
//Tag.ModifyTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Tags.ModifyTags(model.Tags, Utils.CMSType.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("编辑文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑文章详情成功";
|
||||
@@ -551,7 +753,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//删除文章
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "article", "JSON")]
|
||||
public JsonResult DelArtice(int id)
|
||||
public JsonResult DelArticle(int id)
|
||||
{
|
||||
Article entity = Article.Find(Article._.Id == id);
|
||||
if (entity == null)
|
||||
@@ -559,9 +761,32 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "系统找不到本文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法删除非自己添加的文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
int kid = entity.Id;
|
||||
//删除TAG
|
||||
//Tag.DeleteTag(RTType.RatuoModule.Article, entity.Id);
|
||||
Tags.DeleteTag(entity.Tags, Utils.CMSType.Article, entity.Id);
|
||||
Core.Admin.WriteLogActions("删除文章(id:" + entity.Id + ");");
|
||||
entity.Delete();
|
||||
ArticleCategory.UpdateDetailCount(kid);
|
||||
@@ -571,6 +796,26 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改文章排序
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "article", "JSON")]
|
||||
public IActionResult DoEditArticleSequence(int id, int rank)
|
||||
{
|
||||
Article entity = Article.Find(Article._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.Sequence = rank;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions($"修改文章排序(id:{id},排序:{rank});");
|
||||
tip.Message = "修改排序成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 迁移文章
|
||||
[HttpGet]
|
||||
[MyAuthorize("batch", "article")]
|
||||
@@ -696,5 +941,51 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 批量删除文章
|
||||
[HttpPost]
|
||||
[MyAuthorize("batch", "article", "JSON")]
|
||||
public IActionResult DoBatchDelArticle(string ids)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ids))
|
||||
{
|
||||
tip.Message = "请最少选择一篇文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
List<int> listIds = new List<int>();
|
||||
try
|
||||
{
|
||||
listIds = JsonConvert.DeserializeObject<List<int>>(ids);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tip.Message = "转换出错:" + ex.Message;
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (listIds == null || listIds.Count < 1)
|
||||
{
|
||||
tip.Message = "请至少选择一篇文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
IList<Article> list = Article.FindAll(Article._.Id.In(listIds), null, null, 0, 0);
|
||||
if (list == null || list.Count < 1)
|
||||
{
|
||||
tip.Message = "请至少选择一篇文章!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.IsHide = 0;
|
||||
}
|
||||
list.Delete();
|
||||
Admin.WriteLogActions($"批量删除文章:{ids};");
|
||||
tip.Message = "批量删除文章成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using COMCMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using COMCMS.Core.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.IO;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
public class AttachController : AdminBaseController
|
||||
{
|
||||
private readonly SystemSetting _attachsetting;
|
||||
private IWebHostEnvironment _env;
|
||||
private AttachConfigEntity attach;
|
||||
public AttachController(IWebHostEnvironment env, IOptions<SystemSetting> attachsetting)
|
||||
{
|
||||
attach = Config.GetSystemConfig().AttachConfigEntity;
|
||||
_env = env;
|
||||
_attachsetting = attachsetting.Value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 附件管理
|
||||
[HttpGet]
|
||||
[MyAuthorize("viewlist", "attach")]
|
||||
public IActionResult AttachList()
|
||||
{
|
||||
List<DirInfo> all = getAllAttach("");
|
||||
string allJson = JsonConvert.SerializeObject(all);
|
||||
//string basePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";//基础目录
|
||||
ViewBag.folderJson = allJson;
|
||||
//string[] arrDirs = Directory.GetDirectories(basePath);
|
||||
return View();
|
||||
//return Content(JsonConvert.SerializeObject(allJson));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取附件所有目录
|
||||
[HttpPost]
|
||||
[MyAuthorize("viewlist", "attach","JSON")]
|
||||
public IActionResult GetDirList(string subdir)
|
||||
{
|
||||
//string attachPath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";
|
||||
|
||||
|
||||
|
||||
//Directory.GetDirectories()
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取附件目录和所有子目录树
|
||||
/// <summary>
|
||||
/// 所有所有附件目录树
|
||||
/// </summary>
|
||||
/// <param name="subdir">子目录,需要完整,如:images/2020</param>
|
||||
/// <returns></returns>
|
||||
public List<DirInfo> getAllAttach(string subdir)
|
||||
{
|
||||
List<DirInfo> list = new List<DirInfo>();
|
||||
string basePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";//基础目录
|
||||
if (!string.IsNullOrEmpty(subdir))
|
||||
{
|
||||
basePath += subdir.Replace("/", Path.DirectorySeparatorChar.ToString());
|
||||
}
|
||||
|
||||
string[] arrDirs = Directory.GetDirectories(basePath);
|
||||
|
||||
if (arrDirs !=null && arrDirs.Length > 0)
|
||||
{
|
||||
foreach (var item in arrDirs)
|
||||
{
|
||||
string nextSubDir = subdir + "/" + item.Substring(item.LastIndexOf(Path.DirectorySeparatorChar)+1);
|
||||
var tpmList = getAllAttach(nextSubDir);
|
||||
list.Add(new DirInfo()
|
||||
{
|
||||
name = item.Substring(item.LastIndexOf(Path.DirectorySeparatorChar)+1),
|
||||
path = nextSubDir,
|
||||
//fullPath = item,
|
||||
subList = tpmList
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
public class DataDictionaryController : AdminBaseController
|
||||
{
|
||||
#region 数据字典首页
|
||||
[HttpGet]
|
||||
[MyAuthorize("viewlist", "datadictionary")]
|
||||
public IActionResult Index()
|
||||
{
|
||||
Admin.WriteLogActions($"查看数据字典页面;");
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 异步获取数据字典列表,带分页
|
||||
[MyAuthorize("viewlist", "datadictionary", "JSON")]
|
||||
public IActionResult GetDataDictionaryList(string keyword, int page = 1, int limit = 20)
|
||||
{
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
|
||||
numPerPage = limit;
|
||||
currentPage = page;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
Expression ex = new Expression();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
{
|
||||
if (Utils.IsInt(keyword))
|
||||
{
|
||||
ex &= (DataDictionary._.Id == int.Parse(keyword) | DataDictionary._.Key.Contains(keyword));
|
||||
}
|
||||
else
|
||||
{
|
||||
ex &= DataDictionary._.Key.Contains(keyword);
|
||||
}
|
||||
}
|
||||
IList<DataDictionary> list = DataDictionary.FindAll(ex, DataDictionary._.Rank.Asc().And(DataDictionary._.Id.Desc()), null, startRowIndex, numPerPage);
|
||||
long totalCount = DataDictionary.FindCount(ex, DataDictionary._.Rank.Asc().And(DataDictionary._.Id.Desc()), null, startRowIndex, numPerPage);
|
||||
//return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
return Json(new { total = totalCount, rows = list });
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取数据字典
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "datadictionary", "JSON")]
|
||||
public IActionResult GetDataDictionary(int id)
|
||||
{
|
||||
var entity = DataDictionary.Find(DataDictionary._.Id == id);
|
||||
if(entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
var detail = new
|
||||
{
|
||||
id = entity.Id,
|
||||
rank = entity.Rank,
|
||||
description = entity.Description,
|
||||
key = entity.Key
|
||||
};
|
||||
tip.Detail = detail;
|
||||
tip.Message = "获取成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
Admin.WriteLogActions($"查看数据字典({entity.Id});");
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存(添加或者修改)数据字典
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "datadictionary", "JSON")]
|
||||
public IActionResult DoSaveDataDictionary(DataDictionary model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Key))
|
||||
{
|
||||
tip.Message = "请输入字典Key";
|
||||
return Json(tip);
|
||||
}
|
||||
if(model.Id==0 && DataDictionary.FindCount(DataDictionary._.Key== model.Key, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "此字典Key已经存在,请填写其他的!";
|
||||
return Json(tip);
|
||||
}
|
||||
if(model.Id> 0 && DataDictionary.FindCount(DataDictionary._.Key == model.Key & DataDictionary._.Id !=model.Id, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "此字典Key已经存在,请填写其他的!";
|
||||
return Json(tip);
|
||||
}
|
||||
DataDictionary entity = null;
|
||||
string tipMessage = "";
|
||||
if (model.Id > 0)
|
||||
{
|
||||
entity = DataDictionary.Find(DataDictionary._.Id == model.Id);
|
||||
if(entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
tipMessage = "修改";
|
||||
}
|
||||
else
|
||||
{
|
||||
entity = new DataDictionary();
|
||||
entity.AddTime = DateTime.Now;
|
||||
tipMessage = "添加";
|
||||
}
|
||||
entity.Key = model.Key;
|
||||
entity.Description = model.Description;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Save();
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = $"{tipMessage}数据字典成功!";
|
||||
Admin.WriteLogActions($"{tipMessage}数据字典成功({entity.Id});");
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据字典
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "datadictionary", "JSON")]
|
||||
public IActionResult DelDataDictionary(int id)
|
||||
{
|
||||
var entity = DataDictionary.Find(DataDictionary._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
//获取数据字典详情
|
||||
IList<DataDictionaryDetail> list = DataDictionaryDetail.FindAll(DataDictionaryDetail._.DataDictionaryId == entity.Id, null, null, 0, 0);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
list.Delete();
|
||||
}
|
||||
Admin.WriteLogActions($"删除数据字典({entity.Id});");
|
||||
entity.Delete();
|
||||
|
||||
|
||||
tip.Message = "删除数据字典成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取字典值列表
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "datadictionary", "JSON")]
|
||||
public IActionResult GetDataDictionaryDetail(int id)
|
||||
{
|
||||
var entity = DataDictionary.Find(DataDictionary._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
//获取数据字典详情
|
||||
IList<DataDictionaryDetail> list = DataDictionaryDetail.FindAll(DataDictionaryDetail._.DataDictionaryId == entity.Id, DataDictionaryDetail._.Rank.Asc().And(DataDictionaryDetail._.Id.Desc()), null, 0, 0);
|
||||
|
||||
List<object> detail = new List<object>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
detail.Add(new
|
||||
{
|
||||
dataDictionaryId = item.DataDictionaryId,
|
||||
id = item.Id,
|
||||
val = item.Val,
|
||||
title = item.Title,
|
||||
description = item.Description,
|
||||
rank = item.Rank,
|
||||
isDefault = item.IsDefault,
|
||||
addTime = item.AddTime.ToString("yyyy-MM-dd HH:mm")
|
||||
});
|
||||
}
|
||||
tip.Detail = detail;
|
||||
tip.Message = "获取成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
Admin.WriteLogActions($"查看数据字典值列表({entity.Id});");
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存字典值详情
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "datadictionary", "JSON")]
|
||||
public IActionResult DoSaveDataDictionaryDetail(DataDictionaryDetail model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Val))
|
||||
{
|
||||
tip.Message = "请输入字典值";
|
||||
return Json(tip);
|
||||
}
|
||||
if(model.DataDictionaryId == 0)
|
||||
{
|
||||
tip.Message = "请先选择一个字典进行查看后再编辑或者添加!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.Id == 0 && DataDictionaryDetail.FindCount(DataDictionaryDetail._.Val == model.Val & DataDictionaryDetail._.DataDictionaryId == model.DataDictionaryId, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "此字典值已经存在,请填写其他的!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.Id > 0 && DataDictionaryDetail.FindCount(DataDictionaryDetail._.Val == model.Val & DataDictionaryDetail._.DataDictionaryId == model.DataDictionaryId & DataDictionaryDetail._.Id != model.Id, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "此字典值已经存在,请填写其他的!";
|
||||
return Json(tip);
|
||||
}
|
||||
DataDictionaryDetail entity = null;
|
||||
string tipMessage = "";
|
||||
if (model.Id > 0)
|
||||
{
|
||||
entity = DataDictionaryDetail.Find(DataDictionaryDetail._.Id == model.Id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
tipMessage = "修改";
|
||||
}
|
||||
else
|
||||
{
|
||||
entity = new DataDictionaryDetail();
|
||||
entity.AddTime = DateTime.Now;
|
||||
entity.DataDictionaryId = model.DataDictionaryId;
|
||||
tipMessage = "添加";
|
||||
}
|
||||
entity.Val = model.Val;
|
||||
entity.Description = model.Description;
|
||||
entity.Title = model.Title;
|
||||
entity.IsDefault = model.IsDefault;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Save();
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = $"{tipMessage}数据字典成功!";
|
||||
Admin.WriteLogActions($"{tipMessage}数据字典成功({entity.Id});");
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据字典
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "datadictionary", "JSON")]
|
||||
public IActionResult DelDataDictionaryDetail(int id)
|
||||
{
|
||||
var entity = DataDictionaryDetail.Find(DataDictionaryDetail._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin.WriteLogActions($"删除数据字典详情({entity.Id});");
|
||||
entity.Delete();
|
||||
|
||||
tip.Message = "删除数据字典值详情成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
public class DepartmentController : AdminBaseController
|
||||
{
|
||||
#region 部门管理
|
||||
/// <summary>
|
||||
/// 部门列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MyAuthorize("viewlist", "department")]
|
||||
public IActionResult DepartmentList()
|
||||
{
|
||||
IList<Department> list = Department.GetListTree(0, -1, false, true);
|
||||
Core.Admin.WriteLogActions("查看部门列表页面;");
|
||||
return View(list);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#region 添加部门
|
||||
[MyAuthorize("add", "department")]
|
||||
public IActionResult AddDepartment()
|
||||
{
|
||||
//获取上级栏目
|
||||
IList<Department> list = Department.GetListTree(0, 0, true, false);
|
||||
ViewBag.ListTree = list;
|
||||
Department entity = new Department();
|
||||
Core.Admin.WriteLogActions("查看添加部门页面;");
|
||||
return View(entity);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "department", "JSON")]
|
||||
public IActionResult AddDepartment(Department model)
|
||||
{
|
||||
//获取上级栏目
|
||||
if (string.IsNullOrWhiteSpace(model.DepartmentName))
|
||||
{
|
||||
tip.Message = "部门名称不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.Insert();
|
||||
Core.Admin.WriteLogActions("添加部门(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加部门成功";
|
||||
tip.ReturnUrl = "close";
|
||||
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑部门
|
||||
//编辑部门
|
||||
[HttpGet]
|
||||
[MyAuthorize("edit", "department")]
|
||||
public IActionResult EditDepartment(int id)
|
||||
{
|
||||
Department entity = Department.Find(Department._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
//获取上级栏目
|
||||
IList<Department> list = Department.GetListTree(0, 0, true, false);
|
||||
ViewBag.ListTree = list;
|
||||
Core.Admin.WriteLogActions("查看/编辑部门(id:" + id + ")页面;");
|
||||
return View(entity);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "department", "JSON")]
|
||||
public IActionResult EditDepartment(Department model)
|
||||
{
|
||||
if (model.Id <= 0)
|
||||
{
|
||||
tip.Message = "错误参数传递!";
|
||||
Json(tip);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(model.DepartmentName))
|
||||
{
|
||||
tip.Message = "部门名称不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
Department entity = Department.Find(Department._.Id == model.Id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
Json(tip);
|
||||
}
|
||||
//赋值
|
||||
|
||||
entity.DepartmentName = model.DepartmentName;
|
||||
entity.Pic = model.Pic;
|
||||
entity.DepartmentDescription = model.DepartmentDescription;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Pic = model.Pic;
|
||||
entity.Tel = model.Tel;
|
||||
entity.Fax = model.Fax;
|
||||
entity.Email = model.Email;
|
||||
entity.IsNotAllowDel = Request.Form["IsNotAllowDel"] == "1" ? 1 : 0;
|
||||
//如果修改了路径
|
||||
if (entity.PId != model.PId)
|
||||
{
|
||||
entity.PId = model.PId;
|
||||
entity.Location = Department.GetNewLocation(model.PId);
|
||||
}
|
||||
entity.Save();
|
||||
|
||||
Core.Admin.WriteLogActions("修改部门(id:" + entity.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "修改部门成功";
|
||||
tip.ReturnUrl = "close";
|
||||
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
//删除栏目
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "department", "JSON")]
|
||||
public JsonResult DelDepartment(int id)
|
||||
{
|
||||
Department entity = Department.Find(Department._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本部门!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (Department.FindCount(Department._.PId == entity.Id, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "部门目有下级部门,不允许删除!";
|
||||
return Json(tip);
|
||||
}
|
||||
//删除文章
|
||||
|
||||
Core.Admin.WriteLogActions("删除部门(id:" + entity.Id + ");");
|
||||
entity.IsDel =1;
|
||||
entity.Update();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "删除部门成功";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ using XCode;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using System.Diagnostics;
|
||||
using NewLife.Log;
|
||||
using NewLife;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -20,6 +24,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
public IndexController(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
MachineInfo.RegisterAsync();
|
||||
}
|
||||
#region 后台首页
|
||||
[AllowAnonymous]
|
||||
@@ -51,7 +56,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
#region 后台主界面
|
||||
public IActionResult Main()
|
||||
{
|
||||
string remoteip = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
string remoteip = Utils.GetIP();
|
||||
string host = Request.HttpContext.Request.Host.Host;
|
||||
string port = Request.HttpContext.Connection.RemotePort.ToString();
|
||||
|
||||
@@ -61,6 +66,9 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
ViewBag.contentPath = _env.ContentRootPath;
|
||||
ViewBag.rootPath = _env.WebRootPath;
|
||||
|
||||
Admin admin = Admin.GetMyInfo();
|
||||
ViewBag.admin = admin;
|
||||
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
@@ -73,5 +81,79 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 释放进程内存
|
||||
[HttpPost]
|
||||
public IActionResult DoMemoryFree()
|
||||
{
|
||||
Admin my = Admin.GetMyInfo();
|
||||
if (my.Roles.IsSuperAdmin == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
GC.Collect();
|
||||
|
||||
// 释放当前进程所占用的内存
|
||||
var p = Process.GetCurrentProcess();
|
||||
SetProcessWorkingSetSize(p.Handle, -1, -1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XTrace.WriteException(ex);
|
||||
tip.Message = "释放内存执行失败!" + ex.Message;
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
tip.Message = "释放内存成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
tip.Message = "您没有权限执行本操作";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern Boolean SetProcessWorkingSetSize(IntPtr proc, Int32 min, Int32 max);
|
||||
#endregion
|
||||
|
||||
#region 获取CPU内存等参数
|
||||
[HttpPost]
|
||||
[AutoValidateAntiforgeryToken]
|
||||
public IActionResult GetMachineInfo()
|
||||
{
|
||||
Admin my = Admin.GetMyInfo();
|
||||
if (my.Roles.IsSuperAdmin == 0)
|
||||
{
|
||||
tip.Message = "您没有权限执行本操作!";
|
||||
return Json(tip);
|
||||
}
|
||||
var mi = MachineInfo.Current ?? new MachineInfo();
|
||||
var process = Process.GetCurrentProcess();
|
||||
|
||||
double CpuRate = Math.Round(mi.CpuRate, 2);
|
||||
string AvailableMemory = (mi.AvailableMemory / 1024 / 1024).ToString("n0") + "M";
|
||||
decimal memoryUsage = Math.Round((decimal)mi.AvailableMemory / (decimal)mi.Memory * 100M, 2);
|
||||
string WorkingSet64 = (process.WorkingSet64 / 1024 / 1024).ToString("n0") + "M";
|
||||
string PrivateMemorySize64 = (process.PrivateMemorySize64 / 1024 / 1024).ToString("n0") + "M";
|
||||
string GCMemory = (GC.GetTotalMemory(false) / 1024 / 1024).ToString("n0") + "M";
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Detail = new
|
||||
{
|
||||
cpuRate = CpuRate,
|
||||
availableMemory = AvailableMemory,
|
||||
memoryUsage = memoryUsage,
|
||||
workingSet64 = WorkingSet64,
|
||||
privateMemorySize64 = PrivateMemorySize64,
|
||||
gCMemory = GCMemory
|
||||
};
|
||||
|
||||
tip.Message = "获取成功";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
return Redirect("/AdminCP");
|
||||
}
|
||||
|
||||
bool hasData = AdminMenu.FindCount(null, null, null, 0, 0) > 0;
|
||||
if (!hasData)
|
||||
{
|
||||
return Redirect("/Home/Install");
|
||||
}
|
||||
|
||||
string key = Utils.GetRandomChar(12);
|
||||
SessionHelper.WriteSession("des_key", key);
|
||||
ViewBag.key = key;
|
||||
@@ -43,6 +50,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
string strUserName = Request.Form["username"];
|
||||
string strPassWord = Request.Form["password"];
|
||||
string code = Request.Form["code"];
|
||||
|
||||
if (strUserName.Length % 8 != 0)
|
||||
{
|
||||
@@ -62,6 +70,21 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Other = "reload";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (Utils.GetSetting("SystemSetting:AdminLoginWithCode") == "1")
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
tip.Message = "请输入验证码!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (!VerifyCodeHelper.GetSingleObj().VerifyCodeIsOK(code))
|
||||
{
|
||||
tip.Message = "验证码错误!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
//解密
|
||||
string username = "";
|
||||
string password = "";
|
||||
|
||||
@@ -14,6 +14,8 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Models;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -23,6 +25,16 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[DisplayName("管理员")]
|
||||
public class MemberController : AdminBaseController
|
||||
{
|
||||
private readonly SystemSetting _systemSetting;
|
||||
private IWebHostEnvironment _env;
|
||||
private AttachConfigEntity attach;
|
||||
public MemberController(IWebHostEnvironment env, IOptions<SystemSetting> systemSetting)
|
||||
{
|
||||
attach = Config.GetSystemConfig().AttachConfigEntity;
|
||||
_env = env;
|
||||
_systemSetting = systemSetting.Value;
|
||||
}
|
||||
|
||||
#region 修改密码
|
||||
//修改个人信息
|
||||
[MyAuthorize("view", "editme")]
|
||||
@@ -30,6 +42,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
Core.Admin my = Core.Admin.GetMyInfo();
|
||||
Core.Admin.WriteLogActions("查看/编辑我的信息;");
|
||||
ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
|
||||
return View(my);
|
||||
}
|
||||
[HttpPost]
|
||||
@@ -88,6 +101,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "新密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (_systemSetting.PasswordStrength > 0)
|
||||
{
|
||||
if (!Utils.CheckPasswordStrength(newPwd, _systemSetting.PasswordStrength))
|
||||
{
|
||||
tip.Message = $"您的密码强度不符合要求:{Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength)}!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "您输入的两次密码不一样!";
|
||||
@@ -131,7 +153,14 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> list = AdminMenu.GetListTree(0, -1, false, false);
|
||||
ViewBag.MenuList = list;
|
||||
Core.Admin.WriteLogActions("查看添加管理页面;");
|
||||
//获取所有文章 商品栏目
|
||||
IList<ArticleCategory> aclist = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.aclist = aclist;
|
||||
|
||||
IList<Category> pclist = Category.GetListTree(0, -1, true, true);
|
||||
ViewBag.pclist = pclist;
|
||||
|
||||
Core.Admin.WriteLogActions("查看添加管理组页面;");
|
||||
return View();
|
||||
}
|
||||
//执行添加管理组
|
||||
@@ -143,6 +172,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
string RoleDescription = fc["RoleDescription"];
|
||||
string IsSuperAdmin = fc["IsSuperAdmin"];
|
||||
string NotAllowDel = fc["NotAllowDel"];
|
||||
string OnlyEditMyselfArticle = fc["OnlyEditMyselfArticle"];
|
||||
string OnlyEditMyselfProduct = fc["OnlyEditMyselfProduct"];
|
||||
|
||||
if (string.IsNullOrEmpty(OnlyEditMyselfArticle) || !Utils.IsInt(OnlyEditMyselfProduct)) OnlyEditMyselfProduct = "0";
|
||||
if (string.IsNullOrEmpty(OnlyEditMyselfProduct) || !Utils.IsInt(OnlyEditMyselfProduct)) OnlyEditMyselfProduct = "0";
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(RoleName))
|
||||
{
|
||||
tip.Message = "管理组名称不能为空!";
|
||||
@@ -155,6 +191,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.RoleDescription = RoleDescription;
|
||||
entity.IsSuperAdmin = int.Parse(IsSuperAdmin);
|
||||
entity.NotAllowDel = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0;
|
||||
entity.OnlyEditMyselfArticle = int.Parse(OnlyEditMyselfArticle);
|
||||
entity.OnlyEditMyselfProduct = int.Parse(OnlyEditMyselfProduct);
|
||||
|
||||
//处理权限
|
||||
if (entity.IsSuperAdmin == 1)
|
||||
@@ -208,6 +246,30 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//处理文章和商品栏目权限
|
||||
string[] acpower = Request.Form["acpower"];
|
||||
string[] pcpower = Request.Form["pcpower"];
|
||||
|
||||
List<int> acids = new List<int>();
|
||||
List<int> pcids = new List<int>();
|
||||
foreach (var item in acpower)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && Utils.IsInt(item))
|
||||
{
|
||||
acids.Add(int.Parse(item));
|
||||
}
|
||||
}
|
||||
foreach (var item in pcpower)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && Utils.IsInt(item))
|
||||
{
|
||||
pcids.Add(int.Parse(item));
|
||||
}
|
||||
}
|
||||
|
||||
entity.AuthorizedArticleCagegory = JsonConvert.SerializeObject(acids);
|
||||
entity.AuthorizedCagegory = JsonConvert.SerializeObject(pcids);
|
||||
|
||||
entity.Insert();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加管理组成功";
|
||||
@@ -230,8 +292,20 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.Powers = "[]";
|
||||
if (string.IsNullOrEmpty(entity.Menus))
|
||||
entity.Menus = "[]";
|
||||
if (string.IsNullOrEmpty(entity.AuthorizedArticleCagegory))
|
||||
entity.AuthorizedArticleCagegory = "[]";
|
||||
if (string.IsNullOrEmpty(entity.AuthorizedCagegory))
|
||||
entity.AuthorizedCagegory = "[]";
|
||||
//获取所有的菜单列表
|
||||
IList<AdminMenu> list = AdminMenu.GetListTree(0, -1, false, false);
|
||||
|
||||
//获取所有文章 商品栏目
|
||||
IList<ArticleCategory> aclist = ArticleCategory.GetListTree(0, -1, true, true);
|
||||
ViewBag.aclist = aclist;
|
||||
|
||||
IList<Category> pclist = Category.GetListTree(0, -1, true, true);
|
||||
ViewBag.pclist = pclist;
|
||||
|
||||
ViewBag.MenuList = list;
|
||||
Core.Admin.WriteLogActions($"查看管理组({id})详情;");
|
||||
return View(entity);
|
||||
@@ -246,6 +320,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
string RoleDescription = fc["RoleDescription"];
|
||||
string IsSuperAdmin = fc["IsSuperAdmin"];
|
||||
string NotAllowDel = fc["NotAllowDel"];
|
||||
string OnlyEditMyselfArticle = fc["OnlyEditMyselfArticle"];
|
||||
string OnlyEditMyselfProduct = fc["OnlyEditMyselfProduct"];
|
||||
|
||||
if (string.IsNullOrEmpty(OnlyEditMyselfArticle) || !Utils.IsInt(OnlyEditMyselfProduct)) OnlyEditMyselfProduct = "0";
|
||||
if (string.IsNullOrEmpty(OnlyEditMyselfProduct) || !Utils.IsInt(OnlyEditMyselfProduct)) OnlyEditMyselfProduct = "0";
|
||||
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
tip.Message = "错误参数传递!";
|
||||
@@ -268,6 +348,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.RoleDescription = RoleDescription;
|
||||
entity.IsSuperAdmin = int.Parse(IsSuperAdmin);
|
||||
entity.NotAllowDel = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0;
|
||||
entity.OnlyEditMyselfArticle = int.Parse(OnlyEditMyselfArticle);
|
||||
entity.OnlyEditMyselfProduct = int.Parse(OnlyEditMyselfProduct);
|
||||
|
||||
//处理权限
|
||||
if (entity.IsSuperAdmin == 1)
|
||||
@@ -320,6 +402,31 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//处理文章和商品栏目权限
|
||||
string[] acpower = Request.Form["acpower"];
|
||||
string[] pcpower = Request.Form["pcpower"];
|
||||
|
||||
List<int> acids = new List<int>();
|
||||
List<int> pcids = new List<int>();
|
||||
foreach (var item in acpower)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && Utils.IsInt(item))
|
||||
{
|
||||
acids.Add(int.Parse(item));
|
||||
}
|
||||
}
|
||||
foreach (var item in pcpower)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && Utils.IsInt(item))
|
||||
{
|
||||
pcids.Add(int.Parse(item));
|
||||
}
|
||||
}
|
||||
|
||||
entity.AuthorizedArticleCagegory = JsonConvert.SerializeObject(acids);
|
||||
entity.AuthorizedCagegory = JsonConvert.SerializeObject(pcids);
|
||||
|
||||
entity.Update();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑管理组详情成功";
|
||||
@@ -395,7 +502,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
ex &= Core.Admin._.UserName.Contains(keyword);
|
||||
|
||||
IList<Core.Admin> list = Core.Admin.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<Core.Admin> list = Core.Admin.FindAll(ex, Admin._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
totalCount = Core.Admin.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
}
|
||||
@@ -406,6 +513,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//加载管理组
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.RoleList = list;
|
||||
ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
|
||||
Core.Admin.WriteLogActions("查看添加管理员页面;");
|
||||
return View();
|
||||
}
|
||||
@@ -446,11 +554,20 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (_systemSetting.PasswordStrength > 0)
|
||||
{
|
||||
if (!Utils.CheckPasswordStrength(newPwd, _systemSetting.PasswordStrength))
|
||||
{
|
||||
tip.Message = $"您的密码强度不符合要求:{Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength)}!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "两次输入密码不一致,请重新输入!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
//验证用户名
|
||||
if (Core.Admin.FindCount(Core.Admin._.UserName == userName, null, null, 0, 0) > 0)
|
||||
{
|
||||
@@ -485,6 +602,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
|
||||
Core.Admin.WriteLogActions($"查看/编辑管理员({entity.UserName});");
|
||||
return View(entity);
|
||||
}
|
||||
@@ -543,6 +661,14 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "密码不能小于5个字符!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (_systemSetting.PasswordStrength > 0)
|
||||
{
|
||||
if (!Utils.CheckPasswordStrength(newPwd, _systemSetting.PasswordStrength))
|
||||
{
|
||||
tip.Message = $"您的密码强度不符合要求:{Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength)}!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (newPwd != renewPwd)
|
||||
{
|
||||
tip.Message = "两次输入密码不一致,请重新输入!";
|
||||
@@ -822,7 +948,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
IList<Member> list = Member.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<Member> list = Member.FindAll(ex, Member._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
totalCount = Member.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
}
|
||||
@@ -833,7 +959,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
IList<MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.RoleList = list;
|
||||
ViewBag.allmember = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1, null, null, 0, 0);
|
||||
|
||||
ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
|
||||
Core.Admin.WriteLogActions($"查看添加用户页面;");
|
||||
Member model = new Member();
|
||||
return View(model);
|
||||
@@ -859,6 +985,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "密码必须不小于6个字符";
|
||||
return Json(tip);
|
||||
}
|
||||
if (_systemSetting.PasswordStrength > 0)
|
||||
{
|
||||
if (!Utils.CheckPasswordStrength(model.PassWord, _systemSetting.PasswordStrength))
|
||||
{
|
||||
tip.Message = $"您的密码强度不符合要求:{Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength)}!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
string PassWord2 = Request.Form["PassWord2"];
|
||||
if (model.PassWord != PassWord2)
|
||||
{
|
||||
@@ -929,7 +1064,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
IList<RebateChangeLog> listrechargebalancelogs = RebateChangeLog.FindAll(RebateChangeLog._.UId == entity.Id, null, null, 0, 0);
|
||||
ViewBag.listrechargebalancelogs = listrechargebalancelogs;
|
||||
|
||||
|
||||
ViewBag.passwordTip = Utils.GetPasswordStrengthTip(_systemSetting.PasswordStrength);
|
||||
|
||||
Core.Admin.WriteLogActions($"查看/编辑用户({entity.UserName});");
|
||||
return View(entity);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
ex &= (Order._.Title.Contains(keyword) | Order._.OrderNum.Contains(keyword) | Order._.RealName.Contains(keyword) | Order._.Address.Contains(keyword));
|
||||
|
||||
IList<Order> list = Order.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<Order> list = Order.FindAll(ex, Order._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
long totalCount = Order.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
//return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet);
|
||||
@@ -327,7 +327,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
ex &= OnlinePayOrder._.Title.Contains(keyword);
|
||||
|
||||
IList<OnlinePayOrder> list = OnlinePayOrder.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<OnlinePayOrder> list = OnlinePayOrder.FindAll(ex, OnlinePayOrder._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
long totalCount = OnlinePayOrder.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
//return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet);
|
||||
|
||||
@@ -115,6 +115,85 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#region 编辑事件详情
|
||||
[HttpGet]
|
||||
[MyAuthorize("add", "eventkey")]
|
||||
public IActionResult EditEventKey(int id)
|
||||
{
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
Admin.WriteLogActions("查看/编辑事件详情(id:" + entity.Id + ");");
|
||||
return View(entity);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "eventkey","JSON")]
|
||||
public IActionResult EditEventKey(TargetEvent model)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(model.EventKey))
|
||||
{
|
||||
tip.Message = "请填写事件KEY";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(model.EventName))
|
||||
{
|
||||
tip.Message = "请填写事件名称";
|
||||
return Json(tip);
|
||||
}
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == model.Id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (entity.EventKey != model.EventKey)
|
||||
{
|
||||
if (TargetEvent.FindCount(TargetEvent._.EventKey == model.EventKey, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "事件key已经存在,请重新填写一个";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
entity.EventKey = model.EventKey;
|
||||
entity.EventName = model.EventName;
|
||||
entity.Rank = model.Rank;
|
||||
if (string.IsNullOrWhiteSpace(Request.Form["IsDisable"]) || Request.Form["IsDisable"] != "1")
|
||||
entity.IsDisable = 0;
|
||||
else
|
||||
entity.IsDisable = 1;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions("编辑事件详情(id:" + entity.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑事件权限详情成功";
|
||||
tip.ReturnUrl = "close";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除事件权限
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "eventkey", "JSON")]
|
||||
public JsonResult DelEventKey(int id)
|
||||
{
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
Admin.WriteLogActions("删除事件详情(" + JsonConvert.SerializeObject(entity) + ");");
|
||||
entity.Delete();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "删除事件权限详情成功";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 后台栏目管理
|
||||
|
||||
@@ -36,6 +36,24 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//获取上级栏目
|
||||
IList<Category> list = Category.GetListTree(0, -1, true, false);
|
||||
ViewBag.ListTree = list;
|
||||
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
|
||||
List<string> listTpls = new List<string>();
|
||||
var asms = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var asmItem in asms)
|
||||
{
|
||||
string fullName = asmItem.GetName().ToString();
|
||||
if (fullName.IndexOf("COMCMS.Web") > -1)
|
||||
{
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Product")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Product_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
ViewBag.ListTpl = listTpls;
|
||||
//获取模板
|
||||
//List<string> listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article")));
|
||||
//ViewBag.ListTpl = listtpl;
|
||||
@@ -53,6 +71,33 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "商品栏目标题不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
{
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 1))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.Insert();
|
||||
Core.Admin.WriteLogActions("添加商品栏目(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
@@ -74,9 +119,25 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//获取上级栏目
|
||||
IList<Category> list = Category.GetListTree(0, -1, true, false);
|
||||
ViewBag.ListTree = list;
|
||||
//获取模板
|
||||
//List<string> listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article")));
|
||||
//ViewBag.ListTpl = listtpl;
|
||||
//获取模板 模板规则,以Index_开头的,为栏目列表,以Detial_开头的为文章详情
|
||||
List<string> listTpls = new List<string>();
|
||||
var asms = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var asmItem in asms)
|
||||
{
|
||||
string fullName = asmItem.GetName().ToString();
|
||||
if (fullName.IndexOf("COMCMS.Web") > -1)
|
||||
{
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.StartsWith("Views_Product")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
foreach (var type in types)
|
||||
{
|
||||
string viewName = type.Name.Replace("Views_Product_", "") + ".cshtml";
|
||||
listTpls.Add(viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
ViewBag.ListTpl = listTpls;
|
||||
|
||||
Core.Admin.WriteLogActions("查看/编辑商品栏目(id:" + id + ")页面;");
|
||||
return View(entity);
|
||||
}
|
||||
@@ -102,6 +163,30 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "系统找不到本记录!";
|
||||
Json(tip);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
{
|
||||
if (!model.FilePath.StartsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径请以/开头!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (model.FilePath.EndsWith("/"))
|
||||
{
|
||||
tip.Message = "栏目路径结尾不用加上/";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (model.FilePath.Count(x => x == '/') > 4)
|
||||
{
|
||||
tip.Message = "最多只能四级路径!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.FilePath) && !AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 1))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (entity.PId != model.PId)
|
||||
{
|
||||
@@ -147,6 +232,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.KindDomain = model.KindDomain;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Pic = model.Pic;
|
||||
entity.FilePath = model.FilePath;
|
||||
|
||||
|
||||
entity.Save();
|
||||
@@ -186,6 +272,27 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "删除商品栏目成功";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#region 修改商品分类排序
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "category", "JSON")]
|
||||
public IActionResult DoEditCategoryRank(int id, int rank)
|
||||
{
|
||||
Category entity = Category.Find(Category._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.Rank = rank;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions($"修改商品分类排序(id:{id},排序:{rank});");
|
||||
tip.Message = "修改商品分类排序成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 商品列表
|
||||
@@ -208,7 +315,23 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
numPerPage = limit;
|
||||
currentPage = page;
|
||||
startRowIndex = (currentPage - 1) * numPerPage;
|
||||
Expression ex = Product._.Id > 0;
|
||||
Expression ex = new Expression();
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
ex &= Product._.KId.In(aclist);
|
||||
}
|
||||
|
||||
//仅显示有权限内容
|
||||
if (my.Roles.OnlyEditMyselfProduct == 1)
|
||||
ex &= Product._.AuthorId == my.Id;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
{
|
||||
@@ -253,6 +376,26 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改商品排序
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "product", "JSON")]
|
||||
public IActionResult DoEditProductSequence(int id, int rank)
|
||||
{
|
||||
Product entity = Product.Find(Product._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录";
|
||||
return Json(tip);
|
||||
}
|
||||
entity.Sequence = rank;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions($"修改商品排序(id:{id},排序:{rank});");
|
||||
tip.Message = "修改排序成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 添加商品
|
||||
[HttpGet]
|
||||
[MyAuthorize("add", "product")]
|
||||
@@ -292,6 +435,24 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "商品图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory)?"[]": my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//处理商品更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -312,7 +473,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
model.Content = content;
|
||||
}
|
||||
model.ItemImg = morIMG;
|
||||
model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.AuthorId = my.Id;
|
||||
model.Insert();
|
||||
Category.UpdateDetailCount(model.KId);
|
||||
//添加TAG
|
||||
@@ -381,6 +542,29 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "商品图片填写的不是图片格式!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == model.KId) == -1)
|
||||
{
|
||||
tip.Message = "当前选择栏目不存在,或者您没这个栏目的权限!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
if (my.Roles.OnlyEditMyselfProduct == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法编辑非自己添加的商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
//处理商品更多图片
|
||||
string[] moreImgSrc = Request.Form["nImgUrl"];
|
||||
string morIMG = string.Empty;//更多图片的时候用到
|
||||
@@ -415,8 +599,65 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
content = ThumbnailHelper.SaveRemoteImgForContent(content);
|
||||
model.Content = content;
|
||||
}
|
||||
//model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.Save();
|
||||
entity.SupportId = model.SupportId;
|
||||
entity.BannerImg = model.BannerImg;
|
||||
entity.BId = model.BId;
|
||||
entity.Color = model.Color;
|
||||
entity.Content = model.Content;
|
||||
entity.Credits = model.Credits;
|
||||
entity.Description = model.Description;
|
||||
entity.Discount = model.Discount;
|
||||
entity.Fare = model.Fare;
|
||||
entity.FilePath = model.FilePath;
|
||||
entity.Front = model.Front;
|
||||
entity.Hits = model.Hits;
|
||||
entity.Icon = model.Icon;
|
||||
entity.IsBest = model.IsBest;
|
||||
entity.IsBreakup = model.IsBreakup;
|
||||
entity.IsComment = model.IsComment;
|
||||
entity.IsGift = model.IsGift;
|
||||
entity.IsHide = model.IsHide;
|
||||
entity.IsHotSales = model.IsHotSales;
|
||||
entity.IsLock = model.IsLock;
|
||||
entity.IsMember = model.IsMember;
|
||||
entity.IsNew = model.IsNew;
|
||||
entity.IsPart = model.IsPart;
|
||||
entity.IsPromote = model.IsPromote;
|
||||
entity.IsRecommend = model.IsRecommend;
|
||||
entity.IsShelves = model.IsShelves;
|
||||
entity.IsSpecial = model.IsSpecial;
|
||||
entity.IsSubProduct = model.IsSubProduct;
|
||||
entity.IsTop = model.IsTop;
|
||||
entity.ItemImg = model.ItemImg;
|
||||
entity.ItemNO = model.ItemNO;
|
||||
entity.Keyword = model.Keyword;
|
||||
entity.KId = model.KId;
|
||||
entity.LinkURL = model.LinkURL;
|
||||
entity.MarketPrice = model.MarketPrice;
|
||||
entity.Material = model.Material;
|
||||
entity.Parameters = model.Parameters;
|
||||
entity.Pic = model.Pic;
|
||||
entity.PPId = model.PPId;
|
||||
entity.Price = model.Price;
|
||||
entity.Sequence = model.Sequence;
|
||||
entity.Service = model.Service;
|
||||
entity.ShopId = model.ShopId;
|
||||
entity.Spec = model.Spec;
|
||||
entity.SpecialPrice = model.SpecialPrice;
|
||||
entity.Stock = model.Stock;
|
||||
entity.SubTitle = model.SubTitle;
|
||||
entity.SupportId = model.SupportId;
|
||||
entity.Tags = model.Tags;
|
||||
entity.TemplateFile = model.TemplateFile;
|
||||
entity.Title = model.Title;
|
||||
entity.TitleColor = model.TitleColor;
|
||||
entity.Unit = model.Unit;
|
||||
entity.UpdateTime = DateTime.Now;
|
||||
entity.WarnStock = model.WarnStock;
|
||||
entity.Weight = model.Weight;
|
||||
|
||||
entity.Update();
|
||||
|
||||
//添加TAG
|
||||
//Tag.InsertTags(model.Tags, RTType.RatuoModule.Product, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("编辑商品(id:" + model.Id + ");");
|
||||
@@ -439,6 +680,29 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "系统找不到本商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
aclist = JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedCagegory) ? "[]" : my.Roles.AuthorizedCagegory);
|
||||
if (aclist == null) aclist = new List<int>();
|
||||
|
||||
if (aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == entity.KId) == -1)
|
||||
{
|
||||
tip.Message = "者您没这个栏目的权限,无法删除该栏目商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
if (my.Roles.OnlyEditMyselfArticle == 1 && entity.AuthorId != my.Id)
|
||||
{
|
||||
tip.Message = "系统限制,您无法删除非自己添加的商品!";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
|
||||
int kid = entity.KId;
|
||||
//删除TAG
|
||||
//Tag.DeleteTag(RTType.RatuoModule.Article, entity.Id);
|
||||
|
||||
@@ -16,13 +16,32 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
public class ServerController : AdminBaseController
|
||||
{
|
||||
#region 中文转拼音
|
||||
public IActionResult Hanzi2Pinyin(string name)
|
||||
[HttpPost]
|
||||
public IActionResult Hanzi2Pinyin(string name,int pid=0,string t="")
|
||||
{
|
||||
string pinyin = "";
|
||||
string pinyin = "/";
|
||||
if(t == "articlecategory" && pid>0)
|
||||
{
|
||||
ArticleCategory pcategory = ArticleCategory.FindById(pid);
|
||||
if(pcategory !=null && !string.IsNullOrEmpty(pcategory.FilePath))
|
||||
{
|
||||
pinyin = pcategory.FilePath+"/";
|
||||
}
|
||||
}
|
||||
else if(t == "category" && pid > 0)
|
||||
{
|
||||
Category pcategory = Category.FindById(pid);
|
||||
if (pcategory != null && !string.IsNullOrEmpty(pcategory.FilePath))
|
||||
{
|
||||
pinyin = pcategory.FilePath + "/";
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
pinyin = PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-");
|
||||
pinyin += PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-");
|
||||
}
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = pinyin;
|
||||
return Json(tip);
|
||||
|
||||
@@ -179,8 +179,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(model.WaterMarkImg))
|
||||
{
|
||||
string imgPath = _env.WebRootPath + model.WaterMarkImg.Replace("/", "\\");
|
||||
NewLife.Log.XTrace.WriteLine(_env.WebRootPath + "|" + Path.Combine(_env.WebRootPath, model.WaterMarkImg) + "|" + imgPath);
|
||||
string imgPath = _env.WebRootPath + model.WaterMarkImg.Replace("/", Path.DirectorySeparatorChar.ToString());
|
||||
//NewLife.Log.XTrace.WriteLine(_env.WebRootPath + "|" + Path.Combine(_env.WebRootPath, model.WaterMarkImg) + "|" + imgPath);
|
||||
if (!System.IO.File.Exists(imgPath))
|
||||
{
|
||||
tip.Message = "水印图片不存在,请重新上传!";
|
||||
|
||||
@@ -12,11 +12,12 @@ using COMCMS.Web.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using COMCMS.Core.Models;
|
||||
using System.DrawingCore;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using NewLife.UserGroup.WebUploader;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -74,14 +75,18 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(errorJson);
|
||||
}
|
||||
//判断是否是图片类型
|
||||
List<string> imgtypelist = new List<string> { "image/pjpeg", "image/png", "image/x-png", "image/gif", "image/bmp", "image/jpeg" };
|
||||
List<string> imgtypelist = new List<string> { "image/jpg", "image/png", "image/x-png", "image/gif", "image/bmp", "image/jpeg" };
|
||||
if (imgtypelist.FindIndex(x => x == upload.ContentType) == -1)
|
||||
{
|
||||
errorJson.error.message = "请选择一张图片!";
|
||||
return Json(errorJson);
|
||||
//return Content(string.Format(tpl, "", callback, "请上传一张图片!"), "text/html");
|
||||
}
|
||||
|
||||
if (!Utils.IsImgFilename(upload.FileName))
|
||||
{
|
||||
errorJson.error.message = "请选择一张图片!";
|
||||
return Json(errorJson);
|
||||
}
|
||||
var data = Request.Form.Files["upload"];
|
||||
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
@@ -155,15 +160,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
|
||||
System.IO.File.Copy(fullpath, copyfullpath);
|
||||
|
||||
Image waterpic = new Bitmap(watermarkimg);
|
||||
Image srcPic = new Bitmap(copyfullpath);
|
||||
var waterpic = SKBitmap.Decode(watermarkimg);
|
||||
var srcPic = SKBitmap.Decode(copyfullpath);
|
||||
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
|
||||
{
|
||||
waterpic.Dispose();
|
||||
//srcPic.Dispose();
|
||||
try
|
||||
{
|
||||
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
srcPic.Dispose();
|
||||
System.IO.File.Delete(copyfullpath);
|
||||
}
|
||||
@@ -244,7 +249,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//判断是否是图片,如果是图片,后面需要生成缩略图并可能的话,就加上水印
|
||||
bool isImage = false;
|
||||
//判断是否是图片类型
|
||||
List<string> imgtypelist = new List<string> { "image/pjpeg", "image/png", "image/x-png", "image/gif", "image/bmp" };
|
||||
List<string> imgtypelist = new List<string> { "image/jpg", "image/png", "image/x-png", "image/gif", "image/bmp", "image/jpeg" };
|
||||
if (imgtypelist.FindIndex(x => x == upload.ContentType) >= 0)
|
||||
{
|
||||
isImage = true;
|
||||
@@ -318,15 +323,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
|
||||
System.IO.File.Copy(fullpath, copyfullpath);
|
||||
|
||||
Image waterpic = new Bitmap(watermarkimg);
|
||||
Image srcPic = new Bitmap(copyfullpath);
|
||||
var waterpic = SKBitmap.Decode(watermarkimg);
|
||||
var srcPic = SKBitmap.Decode(copyfullpath);
|
||||
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
|
||||
{
|
||||
waterpic.Dispose();
|
||||
//srcPic.Dispose();
|
||||
try
|
||||
{
|
||||
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
srcPic.Dispose();
|
||||
System.IO.File.Delete(copyfullpath);
|
||||
}
|
||||
@@ -383,161 +388,161 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
// }
|
||||
//}
|
||||
|
||||
#region 二进制上传图片
|
||||
/// <summary>
|
||||
/// 二进制上传图片(未实现)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult DoWebuploaderImageByBinary()
|
||||
{
|
||||
var fileinfo = "";
|
||||
var msg = "上传失败!";
|
||||
var status = 0;
|
||||
var name = "";
|
||||
var path = "";
|
||||
var thumb = "";
|
||||
var size = "";
|
||||
var ext = "";
|
||||
try
|
||||
{
|
||||
string upname = Request.Query["name"];
|
||||
//判断是否是允许文件扩展名
|
||||
string sAllowedExtensions = _attachsetting.ImageAllowedExtensions;
|
||||
List<string> listAllowedExtensions = new List<string>();
|
||||
string[] arrAllowedExtensions = sAllowedExtensions.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
//#region 二进制上传图片
|
||||
///// <summary>
|
||||
///// 二进制上传图片(未实现)
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public IActionResult DoWebuploaderImageByBinary()
|
||||
//{
|
||||
// var fileinfo = "";
|
||||
// var msg = "上传失败!";
|
||||
// var status = 0;
|
||||
// var name = "";
|
||||
// var path = "";
|
||||
// var thumb = "";
|
||||
// var size = "";
|
||||
// var ext = "";
|
||||
// try
|
||||
// {
|
||||
// string upname = Request.Query["name"];
|
||||
// //判断是否是允许文件扩展名
|
||||
// string sAllowedExtensions = _attachsetting.ImageAllowedExtensions;
|
||||
// List<string> listAllowedExtensions = new List<string>();
|
||||
// string[] arrAllowedExtensions = sAllowedExtensions.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
|
||||
string sFileNameNoExt = Utils.GetFileNameWithoutExtension(upname);//文件名字,不带扩展名
|
||||
string sFullExtension = Utils.GetFileExtName(upname);//扩展名
|
||||
// string sFileNameNoExt = Utils.GetFileNameWithoutExtension(upname);//文件名字,不带扩展名
|
||||
// string sFullExtension = Utils.GetFileExtName(upname);//扩展名
|
||||
|
||||
if (arrAllowedExtensions != null && arrAllowedExtensions.Length > 0)
|
||||
{
|
||||
foreach (var s in arrAllowedExtensions)
|
||||
{
|
||||
listAllowedExtensions.Add(s);
|
||||
}
|
||||
}
|
||||
if (listAllowedExtensions.Find(x => x == sFullExtension.ToLower().Replace(".", "")) == null)
|
||||
{
|
||||
return Json(new { status = status, msg = $"{sFullExtension}的文件类型,不允许上传,请上传一张图片!", name = name, path = path, thumb = thumb, size = size, ext = ext });
|
||||
}
|
||||
var req = HttpContext.Request;
|
||||
var f = Request.Form.Files[0];
|
||||
// if (arrAllowedExtensions != null && arrAllowedExtensions.Length > 0)
|
||||
// {
|
||||
// foreach (var s in arrAllowedExtensions)
|
||||
// {
|
||||
// listAllowedExtensions.Add(s);
|
||||
// }
|
||||
// }
|
||||
// if (listAllowedExtensions.Find(x => x == sFullExtension.ToLower().Replace(".", "")) == null)
|
||||
// {
|
||||
// return Json(new { status = status, msg = $"{sFullExtension}的文件类型,不允许上传,请上传一张图片!", name = name, path = path, thumb = thumb, size = size, ext = ext });
|
||||
// }
|
||||
// var req = HttpContext.Request;
|
||||
// var f = Request.Form.Files[0];
|
||||
|
||||
//Request.EnableRewind();
|
||||
Image image = null;
|
||||
using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
|
||||
{
|
||||
var bytes = ConvertToBinary(reader.BaseStream);
|
||||
image = ReturnPic(bytes);
|
||||
size = bytes.Length.ToString();
|
||||
}
|
||||
// //Request.EnableRewind();
|
||||
// Image image = null;
|
||||
// using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
|
||||
// {
|
||||
// var bytes = ConvertToBinary(reader.BaseStream);
|
||||
// image = ReturnPic(bytes);
|
||||
// size = bytes.Length.ToString();
|
||||
// }
|
||||
|
||||
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
//根据附件配置,设置上传图片目录
|
||||
string imgPath = DateTime.Now.Year.ToString();//默认按年
|
||||
switch (attach.SaveType)
|
||||
{
|
||||
case 1://按月份
|
||||
imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}";
|
||||
break;
|
||||
case 2:
|
||||
imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("dd")}";
|
||||
break;
|
||||
}
|
||||
filepath += imgPath;//存放路径
|
||||
thumbsFilePath += imgPath;//缩略图路径
|
||||
//图片名字
|
||||
string imgname = Utils.GetOrderNum() + Utils.GetFileExtName(upname);
|
||||
switch (attach.IsRandomFileName)
|
||||
{
|
||||
case 0://不随机
|
||||
imgname = upname;
|
||||
//判断是否存在
|
||||
if (System.IO.File.Exists(Path.Combine(filepath, imgname)))
|
||||
{
|
||||
imgname = sFileNameNoExt + "(1)" + sFullExtension;
|
||||
}
|
||||
break;
|
||||
case 1://随机字符串
|
||||
imgname = Utils.GetShortGUId() + sFullExtension;
|
||||
break;
|
||||
case 2://时间
|
||||
imgname = Utils.GetOrderNum() + sFullExtension;
|
||||
break;
|
||||
}
|
||||
string fullpath = Path.Combine(filepath, imgname);//图片
|
||||
string fullThumbPath = Path.Combine(thumbsFilePath, imgname);//缩略图
|
||||
// string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
// string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
// //根据附件配置,设置上传图片目录
|
||||
// string imgPath = DateTime.Now.Year.ToString();//默认按年
|
||||
// switch (attach.SaveType)
|
||||
// {
|
||||
// case 1://按月份
|
||||
// imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}";
|
||||
// break;
|
||||
// case 2:
|
||||
// imgPath = $"{DateTime.Now.Year.ToString()}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("MM")}{Path.DirectorySeparatorChar}{DateTime.Now.ToString("dd")}";
|
||||
// break;
|
||||
// }
|
||||
// filepath += imgPath;//存放路径
|
||||
// thumbsFilePath += imgPath;//缩略图路径
|
||||
// //图片名字
|
||||
// string imgname = Utils.GetOrderNum() + Utils.GetFileExtName(upname);
|
||||
// switch (attach.IsRandomFileName)
|
||||
// {
|
||||
// case 0://不随机
|
||||
// imgname = upname;
|
||||
// //判断是否存在
|
||||
// if (System.IO.File.Exists(Path.Combine(filepath, imgname)))
|
||||
// {
|
||||
// imgname = sFileNameNoExt + "(1)" + sFullExtension;
|
||||
// }
|
||||
// break;
|
||||
// case 1://随机字符串
|
||||
// imgname = Utils.GetShortGUId() + sFullExtension;
|
||||
// break;
|
||||
// case 2://时间
|
||||
// imgname = Utils.GetOrderNum() + sFullExtension;
|
||||
// break;
|
||||
// }
|
||||
// string fullpath = Path.Combine(filepath, imgname);//图片
|
||||
// string fullThumbPath = Path.Combine(thumbsFilePath, imgname);//缩略图
|
||||
|
||||
//判断路径
|
||||
if (!Directory.Exists(filepath))
|
||||
Directory.CreateDirectory(filepath);
|
||||
//缩略图路径
|
||||
if (!Directory.Exists(thumbsFilePath))
|
||||
Directory.CreateDirectory(thumbsFilePath);
|
||||
// //判断路径
|
||||
// if (!Directory.Exists(filepath))
|
||||
// Directory.CreateDirectory(filepath);
|
||||
// //缩略图路径
|
||||
// if (!Directory.Exists(thumbsFilePath))
|
||||
// Directory.CreateDirectory(thumbsFilePath);
|
||||
|
||||
//保存图片
|
||||
image.Save(filepath);
|
||||
//生成缩略图
|
||||
if (attach.IsCreateThum == 1)
|
||||
{
|
||||
ThumbnailHelper.MakeThumbnailImage(fullpath, fullThumbPath, attach.ThumMaxWidth, attach.ThumMaxHeight, ThumbnailHelper.CutMode.Cut);
|
||||
}
|
||||
//添加水印
|
||||
if (attach.IsWaterMark == 1 && !string.IsNullOrEmpty(attach.WaterMarkImg))
|
||||
{
|
||||
string watermarkimg = _env.WebRootPath + attach.WaterMarkImg.Replace("/", Path.DirectorySeparatorChar.ToString());
|
||||
if (System.IO.File.Exists(watermarkimg))
|
||||
{
|
||||
//先复制一张图片出来
|
||||
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
|
||||
System.IO.File.Copy(fullpath, copyfullpath);
|
||||
// //保存图片
|
||||
// image.Save(filepath);
|
||||
// //生成缩略图
|
||||
// if (attach.IsCreateThum == 1)
|
||||
// {
|
||||
// ThumbnailHelper.MakeThumbnailImage(fullpath, fullThumbPath, attach.ThumMaxWidth, attach.ThumMaxHeight, ThumbnailHelper.CutMode.Cut);
|
||||
// }
|
||||
// //添加水印
|
||||
// if (attach.IsWaterMark == 1 && !string.IsNullOrEmpty(attach.WaterMarkImg))
|
||||
// {
|
||||
// string watermarkimg = _env.WebRootPath + attach.WaterMarkImg.Replace("/", Path.DirectorySeparatorChar.ToString());
|
||||
// if (System.IO.File.Exists(watermarkimg))
|
||||
// {
|
||||
// //先复制一张图片出来
|
||||
// string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
|
||||
// System.IO.File.Copy(fullpath, copyfullpath);
|
||||
|
||||
Image waterpic = new Bitmap(watermarkimg);
|
||||
Image srcPic = new Bitmap(copyfullpath);
|
||||
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
|
||||
{
|
||||
waterpic.Dispose();
|
||||
//srcPic.Dispose();
|
||||
try
|
||||
{
|
||||
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
srcPic.Dispose();
|
||||
System.IO.File.Delete(copyfullpath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (System.IO.File.Exists(copyfullpath))
|
||||
{
|
||||
System.IO.File.Delete(copyfullpath);
|
||||
}
|
||||
}
|
||||
// var waterpic = SKBitmap.Decode(watermarkimg);
|
||||
// var srcPic = SKBitmap.Decode(copyfullpath);
|
||||
// if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
|
||||
// {
|
||||
// waterpic.Dispose();
|
||||
// //srcPic.Dispose();
|
||||
// try
|
||||
// {
|
||||
// WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
// srcPic.Dispose();
|
||||
// System.IO.File.Delete(copyfullpath);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// if (System.IO.File.Exists(copyfullpath))
|
||||
// {
|
||||
// System.IO.File.Delete(copyfullpath);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
waterpic.Dispose();
|
||||
srcPic.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
image.Dispose();
|
||||
status = 1;
|
||||
name = imgname;
|
||||
path = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
thumb = $"/{attach.AttachPatch}/_thumbs/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
ext = sFullExtension;
|
||||
fileinfo = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
msg = "上传成功!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
msg = ex.Message;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// waterpic.Dispose();
|
||||
// srcPic.Dispose();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// image.Dispose();
|
||||
// status = 1;
|
||||
// name = imgname;
|
||||
// path = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
// thumb = $"/{attach.AttachPatch}/_thumbs/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
// ext = sFullExtension;
|
||||
// fileinfo = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname;
|
||||
// msg = "上传成功!";
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// msg = ex.Message;
|
||||
// }
|
||||
|
||||
return Json(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext });
|
||||
}
|
||||
#endregion
|
||||
// return Json(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext });
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片
|
||||
@@ -556,12 +561,17 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
if (data != null)
|
||||
{
|
||||
//判断是否是图片类型
|
||||
List<string> imgtypelist = new List<string> { "image/pjpeg", "image/png", "image/x-png", "image/gif", "image/bmp", "image/jpeg" };
|
||||
List<string> imgtypelist = new List<string> { "image/jpg", "image/png", "image/x-png", "image/gif", "image/bmp", "image/jpeg" };
|
||||
if (imgtypelist.FindIndex(x => x == data.ContentType) == -1)
|
||||
{
|
||||
msg = "只能上传一张图片格式文件!";
|
||||
return Content(JsonConvert.SerializeObject(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext }), "text/plain");
|
||||
}
|
||||
if (!Utils.IsImgFilename(data.FileName))
|
||||
{
|
||||
msg = "只能上传一张图片格式文件!";
|
||||
return Content(JsonConvert.SerializeObject(new { status = status, msg = msg, name = name, path = path, thumb = thumb, size = size, ext = ext }), "text/plain");
|
||||
}
|
||||
string filepath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
string thumbsFilePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}_thumbs{Path.DirectorySeparatorChar}images{Path.DirectorySeparatorChar}";
|
||||
//根据附件配置,设置上传图片目录
|
||||
@@ -635,15 +645,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
string copyfullpath = fullpath.Replace(sFullExtension, "_copy" + sFullExtension);
|
||||
System.IO.File.Copy(fullpath, copyfullpath);
|
||||
|
||||
Image waterpic = new Bitmap(watermarkimg);
|
||||
Image srcPic = new Bitmap(copyfullpath);
|
||||
var waterpic = SKBitmap.Decode(watermarkimg);
|
||||
var srcPic = SKBitmap.Decode(copyfullpath);
|
||||
if (waterpic.Width < srcPic.Width && waterpic.Height < srcPic.Height)
|
||||
{
|
||||
waterpic.Dispose();
|
||||
//srcPic.Dispose();
|
||||
try
|
||||
{
|
||||
WatermarkHelper.AddImageSignPic(srcPic, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
WatermarkHelper.AddImageSignPic(copyfullpath, fullpath, watermarkimg, attach.WaterMarkPlace, attach.WaterMarkQty, attach.WaterMarkDiaphaneity);
|
||||
srcPic.Dispose();
|
||||
System.IO.File.Delete(copyfullpath);
|
||||
}
|
||||
@@ -839,7 +849,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
var tempDir = "UploadTemp";
|
||||
var targetDir = "UploadFile";
|
||||
|
||||
var (res,msg) = tempDir.Merge(targetDir, fileName, md5, chunks);
|
||||
var (res, msg) = tempDir.Merge(targetDir, fileName, md5, chunks);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
@@ -849,7 +859,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
Result = false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return Json(new
|
||||
{
|
||||
Data = new { md5 = md5, url = Path.Combine("/", targetDir, fileName) },
|
||||
@@ -886,7 +896,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
return Json(new
|
||||
{
|
||||
Data = fileName!=null && exists ? (object)new { md5 = md5, url = Path.Combine("/", targetDir, fileName) } : null,
|
||||
Data = fileName != null && exists ? (object)new { md5 = md5, url = Path.Combine("/", targetDir, fileName) } : null,
|
||||
Result = exists
|
||||
});
|
||||
}
|
||||
@@ -908,12 +918,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// </summary>
|
||||
/// <param name="streamByte"></param>
|
||||
/// <returns></returns>
|
||||
public Image ReturnPic(byte[] streamByte)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(streamByte);
|
||||
Image img = Image.FromStream(ms);
|
||||
return img;
|
||||
}
|
||||
//public Image ReturnPic(byte[] streamByte)
|
||||
//{
|
||||
// MemoryStream ms = new MemoryStream(streamByte);
|
||||
// Image img = Image.FromStream(ms);
|
||||
// return img;
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ using Senparc.Weixin.MP.Containers;
|
||||
using Senparc.Weixin.MP.Entities.Menu;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -73,7 +75,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//修改菜单
|
||||
[HttpPost]
|
||||
[MyAuthorize("edit", "wxmenu", "JSON")]
|
||||
public IActionResult DoPostMenuData(string allmenu)
|
||||
public async Task<IActionResult> DoPostMenuData(string allmenu)
|
||||
{
|
||||
|
||||
Config cfg = Config.GetSystemConfig();
|
||||
@@ -102,13 +104,18 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
//Senparc.Weixin.MP.CommonAPIs.CommonApi.CreateMenu()
|
||||
string posturl = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={accessToken}";
|
||||
|
||||
Stream retunStream = Utils.HttpPost(posturl, allmenu);
|
||||
|
||||
StreamReader reader = new StreamReader(retunStream, Encoding.UTF8);
|
||||
string value = reader.ReadToEnd();
|
||||
|
||||
reader.Close();
|
||||
|
||||
HttpContent content = new StringContent(allmenu);
|
||||
string value = string.Empty;
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
var re = await client.PostAsync(posturl, content);
|
||||
string responseString = re.Content.ReadAsStringAsync().Result;
|
||||
if (!string.IsNullOrEmpty(responseString))
|
||||
{
|
||||
value = responseString;
|
||||
}
|
||||
}
|
||||
XTrace.WriteLine("创建公众号菜单回传:" + value);
|
||||
|
||||
dynamic rejson = Newtonsoft.Json.Linq.JToken.Parse(value) as dynamic;
|
||||
@@ -319,7 +326,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, WeixinRequestRule._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
long totalCount = WeixinRequestRule.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
Admin.WriteLogActions($"查看公众号自定义回复规则({page});");
|
||||
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
@@ -663,7 +670,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
ex &= WeixinRequestRule._.Keywords.Contains(keyword);
|
||||
}
|
||||
}
|
||||
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, null, null, startRowIndex, numPerPage);
|
||||
IList<WeixinRequestRule> list = WeixinRequestRule.FindAll(ex, WeixinRequestRule._.Id.Desc(), null, startRowIndex, numPerPage);
|
||||
long totalCount = WeixinRequestRule.FindCount(ex, null, null, startRowIndex, numPerPage);
|
||||
Admin.WriteLogActions($"查看公众号点击事件自定义回复规则({page});");
|
||||
return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "添加文章";
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
|
||||
<div class="wrapper wrapper-content ">
|
||||
@@ -11,25 +17,40 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addArticleForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<form asp-action="AddArticle" asp-controller="Article" asp-area="AdminCP" method="post" class="form-horizontal m-t" id="addArticleForm">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章栏目:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="KId" id="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count>0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label text-danger">文章标题:</label>
|
||||
<label class="col-sm-3 control-label">文章标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">静态化文件名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">副标题:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -150,7 +171,7 @@
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -158,9 +179,10 @@
|
||||
</div>
|
||||
<script>
|
||||
var htmlText = '<div class="form-group" id="nImgRow{0}">';
|
||||
htmlText += '<label class="col-sm-3 control-label"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow(\'nImgRow{0}\')"> <i class="fa fa-close"></i> 删除</button></label>';
|
||||
htmlText += '<div class="col-sm-3 text-right"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow(\'nImgRow{0}\')"> <i class="fa fa-close"></i> 删除</button></div>';
|
||||
htmlText += '<div class="col-sm-8">';
|
||||
htmlText += '<div class="input-group">';
|
||||
htmlText += '<span class="input-group-btn my-preview"><button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button></span>';
|
||||
htmlText += '<input id="nImgUrlnImgRow{0}" name="nImgUrl" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个图片" value="">';
|
||||
htmlText += '<span class="input-group-addon my-upload-span upload-img" id="newimg_{0}"></span>';
|
||||
htmlText += '</div></div></div>';
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目路径:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" aria-required="true" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -47,6 +47,9 @@
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn my-preview">
|
||||
<button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button>
|
||||
</span>
|
||||
<input id="BannerImg" name="BannerImg" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个Banner图片" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
@@ -134,7 +137,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">跳转链接:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址" aria-required="true">
|
||||
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址,如果填写数字,则跳转到改id的文章详情" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -143,6 +146,12 @@
|
||||
<textarea id="KindInfo" name="KindInfo" class="form-control" placeholder="可以输入栏目的详细介绍"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">IP限制:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="AllowIp" name="AllowIp" class="form-control" placeholder="您可以输入IP限制,每一行一个IP段,请妥当设置。留空不限制" rows="4"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
@@ -163,11 +172,12 @@
|
||||
function aoutoTransform() {
|
||||
var title = $("#KindName").val();
|
||||
var filePath = $("#FilePath").val();
|
||||
var pid = $("#PId").val();
|
||||
if (!filePath) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Server/Hanzi2Pinyin",
|
||||
data: { name: title},
|
||||
url: "/AdminCP/Server/Hanzi2Pinyin",
|
||||
data: { name: title, pid: pid,t:"articlecategory" },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showDialog('addarticlekind','添加文章栏目','/AdminCP/Article/AddArticleCategory',0,0);">
|
||||
@@ -25,7 +22,7 @@
|
||||
<tr>
|
||||
<th>栏目名称</th>
|
||||
<th>ID</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-center" style="width:130px">排序</th>
|
||||
<th class="text-center">文章数量</th>
|
||||
<th class="text-center">隐藏</th>
|
||||
<th width="200">操作</th>
|
||||
@@ -37,30 +34,70 @@
|
||||
}
|
||||
@foreach (var m in Model)
|
||||
{
|
||||
<tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
|
||||
<td>@m.KindName</td>
|
||||
<td>
|
||||
@m.Id
|
||||
</td>
|
||||
<td class="text-center">@m.Rank</td>
|
||||
<td class="text-center">@m.Counts</td>
|
||||
<td class="text-center">
|
||||
@if (m.IsHide == 1)
|
||||
{
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog('eidtarticlekind', '编辑文章栏目详情', '/AdminCP/Article/EditArticleCategory/@m.Id', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Article/DelArticleCategory',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
|
||||
<td><a href="@ViewsHelper.EchoURL(m)" target="_blank" title="新窗口打开栏目">@m.KindName</a></td>
|
||||
<td>
|
||||
@m.Id
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="input-group"><input type="number" class="form-control input-sm" id="ac_rank_@(m.Id)" name="ac_rank_@(m.Id)" value="@m.Rank" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveRank(@(m.Id))"><i class="fa fa-save"></i></a></div>
|
||||
</td>
|
||||
<td class="text-center">@m.Counts</td>
|
||||
<td class="text-center">
|
||||
@if (m.IsHide == 1)
|
||||
{
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog('eidtarticlekind', '编辑文章栏目详情', '/AdminCP/Article/EditArticleCategory/@m.Id', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Article/DelArticleCategory',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.tree').treegrid();
|
||||
});
|
||||
function doSaveRank(id) {
|
||||
var rank = $("#ac_rank_" + id).val();
|
||||
if (rank == '') {
|
||||
layer.alert("请输入排序!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
//console.log(rank);
|
||||
if (!isInt(rank)) {
|
||||
layer.alert("排序只能是数字!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoEditCategoryRank",
|
||||
data: { id: id, rank: rank },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
//window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,57 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "文章列表";
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory)?"[]": my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">筛选条件</div>
|
||||
<div class="panel-body">
|
||||
<form id="formSearch" class="form-horizontal form-inline" onsubmit="return doSearch(); return false;">
|
||||
<div>
|
||||
<label class="control-label">文章栏目:</label>
|
||||
|
||||
<select class="form-control" name="kid" id="kid">
|
||||
<div class="row">
|
||||
<div class="search-collapse">
|
||||
<form id="formSearch" onsubmit="return doSearch(); return false;">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
文章栏目:<select name="kid" id="kid">
|
||||
<option value="0">所有栏目</option>
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<label class="checkbox-inline i-checks">
|
||||
</li>
|
||||
<li>
|
||||
<label class="checkbox-inline i-checks" for="isshowsub">
|
||||
<input type="checkbox" value="1" name="isshowsub" id="isshowsub" /> 显示下级栏目文章
|
||||
</label>
|
||||
<label class="control-label">关键字:</label>
|
||||
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
|
||||
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
关键字:
|
||||
<input type="text" placeholder="标题关键字" name="keyword" id="keyword">
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" id="btn_query" class="btn btn-primary btn-sm" onclick="doSearch();">查询</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<div id="toolbar" class="btn-group">
|
||||
@if (AdminUtils.CheckAdminPower("add", "article"))
|
||||
{
|
||||
@@ -41,21 +59,20 @@
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
}
|
||||
<button id="btn_edit" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addarticle','批量迁移文章','/AdminCP/Article/MoveArticle',0,0)">
|
||||
<span class="glyphicon glyphicon-move" aria-hidden="true"></span> 批量迁移
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default" onclick="doBatchHide()">
|
||||
<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span> 批量隐藏
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default" onclick="doBatchShow()">
|
||||
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> 批量显示
|
||||
</button>
|
||||
@*<button id="btn_edit" type="button" class="btn btn-outline btn-default">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
|
||||
</button>*@
|
||||
@if (AdminUtils.CheckAdminPower("batch", "article"))
|
||||
{
|
||||
<button id="btn_edit" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addarticle','批量迁移文章','/AdminCP/Article/MoveArticle',0,0)">
|
||||
<span class="glyphicon glyphicon-move" aria-hidden="true"></span> 文章迁移
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
批量处理 <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-left">
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchHideArticle','隐藏')"><i class="fa fa-eye-slash"></i> 批量隐藏</a></li>
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchShowArticle','显示')"><i class="fa fa-eye"></i> 批量显示</a></li>
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchDelArticle','删除')"><i class="fa fa-close"></i> 批量删除</a></li>
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
|
||||
@@ -106,7 +123,7 @@
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
@@ -127,33 +144,45 @@
|
||||
title: '所属栏目'
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '文章标题'
|
||||
title: '文章标题',
|
||||
formatter: function (value, row, index) {
|
||||
return '<a href="/Article/Detail/' + row["id"] + '" target="_blank" title="新窗口打开预览文章">' + value + '</a>'
|
||||
}
|
||||
}, {
|
||||
field: 'sequence',
|
||||
title: '排序'
|
||||
title: '排序',
|
||||
width: 130,
|
||||
formatter: function (value, row, index) {
|
||||
return '<div class="input-group"><input type="number" class="form-control input-sm" id="ac_rank_' + row["id"] + '" name="ac_rank_' + row["id"] + '" value="' + value + '" placeholder="请输入一个数字,越小排越前"><a class="input-group-addon btn btn-primary" title="修改保存" href="javascript:;" onclick="doSaveSequence(' + row["id"] + ')"><i class="fa fa-save"></i></a></div>'
|
||||
}
|
||||
}, {
|
||||
field: 'addTime',
|
||||
title: '添加时间'
|
||||
title: '添加时间',
|
||||
width:150
|
||||
}, {
|
||||
field: 'isNew',
|
||||
title: '最新',
|
||||
align: 'center',
|
||||
formatter: 'newFormatter'
|
||||
formatter: 'newFormatter',
|
||||
width: 65
|
||||
}, {
|
||||
field: 'isRecommend',
|
||||
title: '推荐',
|
||||
align: 'center',
|
||||
formatter: 'recommendFormatter'
|
||||
formatter: 'recommendFormatter',
|
||||
width: 65
|
||||
}, {
|
||||
field: 'isHide',
|
||||
title: '隐藏',
|
||||
align: 'center',
|
||||
formatter: 'hideFormatter'
|
||||
formatter: 'hideFormatter',
|
||||
width: 65
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
formatter: 'actionFormatter',
|
||||
width:140
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -164,8 +193,9 @@
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit)+1, //页码
|
||||
kid:$("#kid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
kid: $("#kid").val(),
|
||||
keyword: $("#keyword").val(),
|
||||
isshowsub: $("#isshowsub").prop("checked") ? 1 : 0
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
@@ -175,7 +205,7 @@
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtarticle\', \'编辑文章详情\', \'/AdminCP/Article/EditArticle/' + value + '\', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Article/DelArtice\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Article/DelArticle\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
@@ -212,28 +242,25 @@
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
function doBatchHide() {
|
||||
var list = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||
var ids = [];
|
||||
if (!list || list.length <1) {
|
||||
layer.alert("请至少选择一篇文章!", { icon: 2 });
|
||||
};
|
||||
function doSaveSequence(id) {
|
||||
var rank = $("#ac_rank_" + id).val();
|
||||
if (rank == '') {
|
||||
layer.alert("请输入排序!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
//console.log(rank);
|
||||
if (!isInt(rank)) {
|
||||
layer.alert("排序只能是数字!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
//alert(JSON.stringify(ids));
|
||||
//执行操作
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoBatchHideArticle",
|
||||
data: { ids: JSON.stringify(ids)},
|
||||
url: "/AdminCP/Article/DoEditArticleSequence",
|
||||
data: { id: id, rank: rank },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
@@ -241,7 +268,7 @@
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
doSearch();
|
||||
//window.location.href = window.location.href;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
@@ -253,51 +280,6 @@
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function doBatchShow() {
|
||||
var list = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||
var ids = [];
|
||||
if (!list || list.length <1) {
|
||||
//alert('请至少选择一行!');
|
||||
layer.alert("请至少选择一篇文章!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
//alert(JSON.stringify(ids));
|
||||
//执行操作
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoBatchShowArticle",
|
||||
data: { ids: JSON.stringify(ids)},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
doSearch();
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
@model COMCMS.Core.Article
|
||||
@{
|
||||
ViewBag.title = "查看/编辑文章详情";
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory) ? "[]" : my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
@@ -18,7 +24,17 @@
|
||||
<select class="form-control m-b" asp-for="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
if (my.Roles.IsSuperAdmin != 1 && aclist.Count > 0)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@@ -29,6 +45,12 @@
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题" value="@Model.Title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">静态化文件名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FileName" name="FileName" maxlength="200" type="text" class="form-control" aria-required="true" placeholder="填写静态化文件名,大小写字母、数字和-,如:about.html,不能是index.html" value="@Model.FileName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">副标题:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -110,7 +132,14 @@
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn my-preview">
|
||||
<button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button>
|
||||
@if (!string.IsNullOrEmpty(Model.Pic))
|
||||
{
|
||||
<img src="@Model.Pic" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button>
|
||||
}
|
||||
</span>
|
||||
<input id="Pic" name="Pic" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个图片" value="@Model.Pic">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
@@ -145,9 +174,19 @@
|
||||
|
||||
|
||||
<div class="form-group" id="ImgRow@(i)">
|
||||
<label class="col-sm-3 control-label"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow('ImgRow@(i)')"> <i class="fa fa-close"></i> 删除</button></label>
|
||||
<div class="col-sm-3 text-right"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow('ImgRow@(i)')"> <i class="fa fa-close"></i> 删除</button></div>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn my-preview">
|
||||
@if (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
<img src="@s" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button>
|
||||
}
|
||||
</span>
|
||||
<input id="ImgUrlnImgRow@(i)" name="nImgUrl" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个图片" value="@s">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
@@ -190,9 +229,10 @@
|
||||
|
||||
})
|
||||
var htmlText = '<div class="form-group" id="nImgRow{0}">';
|
||||
htmlText += '<label class="col-sm-3 control-label"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow(\'nImgRow{0}\')"> <i class="fa fa-close"></i> 删除</button></label>';
|
||||
htmlText += '<div class="col-sm-3 text-right"><button type="button" class="btn btn-danger btn-sm" onclick="delmyImgRow(\'nImgRow{0}\')"> <i class="fa fa-close"></i> 删除</button></div>';
|
||||
htmlText += '<div class="col-sm-8">';
|
||||
htmlText += '<div class="input-group">';
|
||||
htmlText += '<span class="input-group-btn my-preview"><button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button></span>';
|
||||
htmlText += '<input id="nImgUrlnImgRow{0}" name="nImgUrl" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个图片" value="">';
|
||||
htmlText += '<span class="input-group-addon my-upload-span upload-img" id="newimg_{0}"></span>';
|
||||
htmlText += '</div></div></div>';
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目路径:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" required aria-required="true" value="@Model.FilePath" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
<input id="FilePath" name="FilePath" maxlength="100" type="text" class="form-control" aria-required="true" value="@Model.FilePath" placeholder="填写栏目路径,SEO优化使用,最多支持4级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -48,6 +48,16 @@
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn my-preview">
|
||||
@if (!string.IsNullOrEmpty(Model.BannerImg))
|
||||
{
|
||||
<img src="@Model.BannerImg" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-primary"><i class="fa fa-search-plus"></i></button>
|
||||
}
|
||||
</span>
|
||||
<input id="BannerImg" name="BannerImg" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个Banner图片" value="@Model.BannerImg">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
@@ -135,7 +145,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">跳转链接:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="@Model.LinkURL" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址" aria-required="true">
|
||||
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="@Model.LinkURL" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址,如果填写数字,则跳转到改id的文章详情" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -144,6 +154,12 @@
|
||||
<textarea id="KindInfo" name="KindInfo" class="form-control" placeholder="可以输入栏目的详细介绍">@Model.KindInfo</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">IP限制:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="AllowIp" name="AllowIp" class="form-control" placeholder="您可以输入IP限制,每一行一个IP段,请妥当设置。留空不限制" rows="4">@Model.AllowIp</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
@@ -168,25 +184,26 @@
|
||||
function aoutoTransform() {
|
||||
var title = $("#KindName").val();
|
||||
var filePath = $("#FilePath").val();
|
||||
var pid = $("#PId").val();
|
||||
if (!filePath) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Server/Hanzi2Pinyin",
|
||||
data: { name: title},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
if (data.message) {
|
||||
$("#FilePath").val(data.message);
|
||||
type: "POST",
|
||||
url: "/AdminCP/Server/Hanzi2Pinyin",
|
||||
data: { name: title, pid: pid, t: "articlecategory" },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
if (data.message) {
|
||||
$("#FilePath").val(data.message);
|
||||
}
|
||||
} else {
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
} else {
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,11 @@
|
||||
@{
|
||||
ViewBag.title = "批量迁移文章";
|
||||
Admin my = Admin.GetMyInfo();
|
||||
List<int> aclist = new List<int>();
|
||||
if (my.Roles.IsSuperAdmin != 1 && !string.IsNullOrEmpty(my.Roles.AuthorizedArticleCagegory))
|
||||
{
|
||||
aclist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(my.Roles.AuthorizedArticleCagegory);
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
@@ -20,7 +26,17 @@
|
||||
<select class="form-control m-b" name="from" id="from">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
if (my.Roles.IsSuperAdmin != 1)
|
||||
{
|
||||
if (aclist.FindIndex(x => x == m.Id) > -1)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
@{
|
||||
ViewBag.title = "附件管理";
|
||||
}
|
||||
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<div class="file-manager">
|
||||
<h5>显示:</h5>
|
||||
<a href="file_manager.html#" class="file-control active">所有</a>
|
||||
<a href="file_manager.html#" class="file-control">文档</a>
|
||||
<a href="file_manager.html#" class="file-control">视频</a>
|
||||
<a href="file_manager.html#" class="file-control">图片</a>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<button class="btn btn-primary btn-block">上传文件</button>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<h5>文件夹</h5>
|
||||
<ul class="folder-list" style="padding: 0">
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> 文件</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> 图片</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> Web页面</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> 插图</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> 电影</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html"><i class="fa fa-folder"></i> 书籍</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h5 class="tag-title">标签</h5>
|
||||
<ul class="tag-list" style="padding: 0">
|
||||
<li>
|
||||
<a href="file_manager.html">爱人</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">工作</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">家庭</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">孩子</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">假期</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">音乐</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">照片</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="file_manager.html">电影</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,490 @@
|
||||
@{
|
||||
ViewBag.title = "数据字典管理";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content " id="app">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">筛选条件</div>
|
||||
<div class="panel-body">
|
||||
<form id="formSearch" class="form-horizontal form-inline" onsubmit="return doSearch(); return false;">
|
||||
<div>
|
||||
<label class="control-label">关键字:</label>
|
||||
<input type="text" placeholder="Key关键字" name="keyword" id="keyword" class="form-control">
|
||||
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="app.getDataDictionary(0)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
//1.初始化Table
|
||||
var oTable = new TableInit();
|
||||
oTable.Init();
|
||||
|
||||
//2.初始化Button的点击事件
|
||||
var oButtonInit = new ButtonInit();
|
||||
oButtonInit.Init();
|
||||
|
||||
});
|
||||
function doSearch() {
|
||||
var params = $('#tb_departments').bootstrapTable('getOptions');
|
||||
//console.log(params);
|
||||
params.queryParams = function (params) {
|
||||
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
keyword: $("#keyword").val(),
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
$('#tb_departments').bootstrapTable('refresh', params);
|
||||
}
|
||||
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/DataDictionary/GetDataDictionaryList', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: false, //是否启用排序
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: oTableInit.queryParams,//传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: true, //是否启用点击选中行
|
||||
height: 0, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
uniqueId: "id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
field: 'id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'key',
|
||||
title: '字典Key'
|
||||
}, {
|
||||
field: 'description',
|
||||
title: '说明'
|
||||
}, {
|
||||
field: 'rank',
|
||||
title: '排序'
|
||||
}, {
|
||||
field: 'addTime',
|
||||
title: '添加时间'
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter',
|
||||
width:215
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
kid: $("#kid").val(),
|
||||
keyword: $("#keyword").val(),
|
||||
isshowsub: $("#isshowsub").prop("checked") ? 1 : 0
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="app.getDataDictionary(' + value + ')"><i class="fa fa-edit"></i> 编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-success m-l-xs" title="编辑" onclick="app.getDataDictionaryDetail(' + value + ')"><i class="fa fa-edit"></i> 管理字典值</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/DataDictionary/DelDataDictionary\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
var ButtonInit = function () {
|
||||
var oInit = new Object();
|
||||
var postdata = {};
|
||||
|
||||
oInit.Init = function () {
|
||||
//初始化页面上面的按钮事件
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="myModal" class="modal fade" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="row form-horizontal">
|
||||
<div class="col-sm-12">
|
||||
<h3 class="m-t-none m-b">{{model.id==0?'添加新数据字典':'编辑数据字典'}}</h3>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典Key:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="model.key" type="text" class="form-control" maxlength="250" placeholder="字典Key,请填写英文" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典说明:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="model.description" type="text" class="form-control" maxlength="250" placeholder="字典说明" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="model.rank" type="number" class="form-control" maxlength="250" placeholder="字典排序,越小越前,仅后台" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-5 col-sm-offset-3">
|
||||
<input type="hidden" v-model="model.id" />
|
||||
<button class="btn btn-primary" type="button" v-on:click="doSaveDataDictionary"><i class="fa fa-save"></i> 确定 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>字典值详情</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div v-show="showDetail">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" v-on:click="addDetail">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>值</th>
|
||||
<th>标签</th>
|
||||
<th>排序</th>
|
||||
<th>是否默认</th>
|
||||
<th>说明</th>
|
||||
<th>添加时间</th>
|
||||
<th style="width:125px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in detailList">
|
||||
<td>{{item.id}}</td>
|
||||
<td>{{item.val}}</td>
|
||||
<td>{{item.title}}</td>
|
||||
<td>{{item.rank}}</td>
|
||||
<td>{{item.isDefault==1?'是':'否'}}</td>
|
||||
<td>{{item.description}}</td>
|
||||
<td>{{item.addTime}}</td>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-xs" v-on:click="doEditDetail(item)"><i class="fa fa-edit"></i> 编辑</button>
|
||||
<button class="btn btn-danger btn-xs" v-on:click="doDelDetail(item.id)"><i class="fa fa-close"></i> 删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="detailList.length<=0">
|
||||
<td colspan="8">暂无记录</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="detailModal" class="modal fade" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="row form-horizontal">
|
||||
<div class="col-sm-12">
|
||||
<h3 class="m-t-none m-b">{{detailModel.id==0?'添加新数据字典值':'编辑数据字典值'}}</h3>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典值(存放数据库):</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="detailModel.val" type="text" class="form-control" maxlength="250" placeholder="字典值(存放数据库)" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典值标签名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="detailModel.title" type="text" class="form-control" maxlength="250" placeholder="字典值标签名称(显示)" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否默认值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="radio" id="y" value="1" v-model="detailModel.isDefault">
|
||||
<label for="y">是(将默认选中)</label>
|
||||
|
||||
<input type="radio" id="n" value="0" v-model="detailModel.isDefault">
|
||||
<label for="n">否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典值排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="detailModel.rank" type="number" class="form-control" maxlength="250" placeholder="字典排序,越小越前" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">字典值备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<input v-model="detailModel.description" type="text" class="form-control" maxlength="250" placeholder="字典说明" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-5 col-sm-offset-3">
|
||||
<input type="hidden" v-model="detailModel.id" />
|
||||
<button class="btn btn-primary" type="button" v-on:click="doSaveDataDictionaryDetail"><i class="fa fa-save"></i> 确定 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
model: { key: '', id: 0, rank: 0, description:''},
|
||||
optTitle: '添加字典',
|
||||
showDetail: false,
|
||||
detailList: [],
|
||||
detailModel: { dataDictionaryId: 0, id: 0, val: '', title: '', description: '', rank: 0, isDefault:0},
|
||||
dataDictId:0
|
||||
},
|
||||
methods: {
|
||||
getDataDictionary: function (id) {
|
||||
//console.log('获取详情:', id);
|
||||
let that = this;
|
||||
if (id == 0) {
|
||||
this.model = { key: '', id: 0, rank: 0, description: '' };
|
||||
$("#myModal").modal('show');
|
||||
return;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/DataDictionary/GetDataDictionary",
|
||||
data: {id:id},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
that.model = data.detail;
|
||||
$("#myModal").modal('show');
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
},
|
||||
doSaveDataDictionary: function () {
|
||||
var that = this;
|
||||
if (!that.model.key) {
|
||||
alert('请输入字典Key!');
|
||||
return;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/DataDictionary/DoSaveDataDictionary",
|
||||
data: that.model,
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
$('#myModal').modal('hide')
|
||||
$("#tb_departments").bootstrapTable('refresh');
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
},
|
||||
getDataDictionaryDetail: function (id) {
|
||||
var that = this;
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/DataDictionary/GetDataDictionaryDetail",
|
||||
data: { id: id },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
that.showDetail = true;
|
||||
that.detailList = data.detail;
|
||||
that.dataDictId = id;
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
},
|
||||
doEditDetail: function (item) {
|
||||
this.detailModel = item;
|
||||
$("#detailModal").modal('show');
|
||||
},
|
||||
doDelDetail: function (id) {
|
||||
var that = this;
|
||||
top.layer.confirm('确认要删除当前记录?此操作不可恢复!', {
|
||||
icon: 3,
|
||||
title: '系统提示',
|
||||
btn: ['确定', '取消 '] //按钮
|
||||
}, function () {
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/DataDictionary/DelDataDictionaryDetail",
|
||||
data: { id: id },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
that.getDataDictionaryDetail(that.dataDictId);
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
});
|
||||
|
||||
},
|
||||
addDetail:function() {
|
||||
this.detailModel = { dataDictionaryId: this.dataDictId, id: 0, val: '', title: '', description: '', rank: 0, isDefault: 0 };
|
||||
$("#detailModal").modal('show');
|
||||
return;
|
||||
},
|
||||
doSaveDataDictionaryDetail: function () {
|
||||
var that = this;
|
||||
if (!that.detailModel.val) {
|
||||
alert('请输入字典值!');
|
||||
return;
|
||||
}
|
||||
if (!that.detailModel.title) {
|
||||
alert('请输入字典值标签名称!');
|
||||
return;
|
||||
}
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/DataDictionary/DoSaveDataDictionaryDetail",
|
||||
data: that.detailModel,
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
$('#detailModal').modal('hide');
|
||||
that.getDataDictionaryDetail(that.dataDictId);
|
||||
//$("#tb_departments").bootstrapTable('refresh');
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user