Merge branch 'master' of https://github.com/hogenwang/comcms_core
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Weixin\" />
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COMCMS.Common\COMCMS.Common.csproj" />
|
||||
<ProjectReference Include="..\COMCMS.Core\COMCMS.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,961 @@
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using Senparc.CO2NET.Utilities;
|
||||
using Senparc.NeuChar.Entities;
|
||||
using Senparc.Weixin.MP;
|
||||
using Senparc.Weixin.MP.Containers;
|
||||
using Senparc.Weixin.MP.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.API.Weixin.Common
|
||||
{
|
||||
public class MessageFunction
|
||||
{
|
||||
Config siteConfig = Config.GetSystemConfig();
|
||||
|
||||
#region 处理关注/取消/默认回复方法===========================
|
||||
/// <summary>
|
||||
/// 定阅事件的统一处理
|
||||
/// </summary>
|
||||
public IResponseMessageBase EventSubscribe(int type, RequestMessageEventBase requestMessage)
|
||||
{
|
||||
int accountId = GetAccountId(); //取得公众账户ID
|
||||
string EventName = "";
|
||||
|
||||
if (requestMessage.Event.ToString().Trim() != "")
|
||||
{
|
||||
EventName = requestMessage.Event.ToString();
|
||||
}
|
||||
//else if (requestMessage.EventKey != null)
|
||||
//{
|
||||
// EventName += requestMessage.EventKey.ToString();
|
||||
//}
|
||||
|
||||
|
||||
if (!ExistsOriginalId(accountId, requestMessage.ToUserName))
|
||||
{
|
||||
//验证接收方是否为我们系统配置的帐号,即验证微帐号与微信原始帐号id是否一致,如果不一致,说明【1】配置错误,【2】数据来源有问题
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "none", "未取到关键词对应的数据", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "none",
|
||||
ReponseContent = "未取到关键词对应的数据",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
|
||||
|
||||
return GetResponseMessageTxtByContent(requestMessage, "验证微帐号与微信原始帐号id不一致,可能原因【1】系统配置错误,【2】非法的数据来源", accountId);
|
||||
}
|
||||
|
||||
|
||||
int responseType = 0, ruleId = 0;
|
||||
//int ruleId = new BLL.weixin_request_rule().GetRuleIdAndResponseType(accountId, "request_type=" + type, out responseType);
|
||||
WeixinRequestRule rule = WeixinRequestRule.Find(WeixinRequestRule._.RequestType == type);
|
||||
|
||||
if (rule != null)
|
||||
{
|
||||
responseType = rule.ResponseType;
|
||||
ruleId = rule.Id;
|
||||
}
|
||||
|
||||
if (ruleId <= 0)
|
||||
{
|
||||
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "none", "未取到关键词对应的数据", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "none",
|
||||
ReponseContent = "未取到关键词对应的数据",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
return null;
|
||||
}
|
||||
|
||||
IResponseMessageBase reponseMessage = null;
|
||||
switch (responseType)
|
||||
{
|
||||
case (int)WeixinRequestRule.XResponseType.Text:
|
||||
//发送纯文字
|
||||
reponseMessage = GetResponseMessageTxt(requestMessage, rule.Id, accountId);
|
||||
break;
|
||||
case (int)WeixinRequestRule.XResponseType.Image:
|
||||
//发送多图文
|
||||
reponseMessage = GetResponseMessageNews(requestMessage, rule.Id, accountId);
|
||||
break;
|
||||
case (int)WeixinRequestRule.XResponseType.Voice:
|
||||
//发送语音
|
||||
reponseMessage = GetResponseMessageeMusic(requestMessage, rule.Id, accountId);
|
||||
break;
|
||||
case (int)WeixinRequestRule.XResponseType.SingleImage:
|
||||
reponseMessage = GetResponseMessageSingleImage(requestMessage, rule.Id, accountId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return reponseMessage;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 请求为文本的处理=====================================
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxt(RequestMessageText requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
//responseMessage.Content = new BLL.weixin_request_content().GetContent(ruleId);
|
||||
WeixinRequestContent ctx = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (ctx != null)
|
||||
{
|
||||
responseMessage.Content = ctx.Content;
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "text",
|
||||
ReponseContent = responseMessage.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "text", responseMessage.Content, requestMessage.ToUserName);
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxtByContent(RequestMessageText requestMessage, string content, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
responseMessage.Content = content;
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "text",
|
||||
ReponseContent = "文字请求,推送纯粹文字,内容为:" + content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "text", "文字请求,推送纯粹文字,内容为:" + content, requestMessage.ToUserName);
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理语音请求
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageeMusic(RequestMessageText requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
//string EventName = "";
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageMusic>(requestMessage);
|
||||
//Model.weixin_request_content model = new BLL.weixin_request_content().GetModel(ruleId);
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.MediaURL.Contains("http://"))
|
||||
{
|
||||
responseMessage.Music.MusicUrl = model.MediaURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
responseMessage.Music.MusicUrl = Utils.GetServerUrl() + model.MediaURL;
|
||||
}
|
||||
responseMessage.Music.Title = model.Title;
|
||||
responseMessage.Music.Description = model.Content;
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "音乐链接:" + model.media_url + "|标题:" + model.title + "|描述:" + model.content, requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "音乐链接:" + model.MediaURL + "|标题:" + model.Title + "|描述:" + model.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送多图文
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageNews(RequestMessageText requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageNews>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
|
||||
Senparc.NeuChar.Entities.Article article;
|
||||
List<Senparc.NeuChar.Entities.Article> artList = new List<Senparc.NeuChar.Entities.Article>();
|
||||
IList<WeixinRequestContent> twList = WeixinRequestContent.FindAll(WeixinRequestContent._.RuleId == ruleId, null, null, 0, 10);
|
||||
foreach (WeixinRequestContent modelt in twList)
|
||||
{
|
||||
article = new Senparc.NeuChar.Entities.Article();
|
||||
article.Title = modelt.Title;
|
||||
article.Description = modelt.Content;
|
||||
article.Url = GetWXApiUrl(modelt.LinkUrl, token, openid);
|
||||
if (string.IsNullOrEmpty(modelt.ImgURL))
|
||||
article.PicUrl = string.Empty;
|
||||
else
|
||||
{
|
||||
if (modelt.ImgURL.Contains("http://"))
|
||||
{
|
||||
article.PicUrl = modelt.ImgURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
article.PicUrl = Utils.GetServerUrl() + "/" + modelt.ImgURL;
|
||||
}
|
||||
}
|
||||
artList.Add(article);
|
||||
}
|
||||
if (artList.Count == 0)
|
||||
{
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "-1", requestMessage.ToUserName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "这次发了" + artList.Count + "条图文",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "这次发了" + artList.Count + "条图文", requestMessage.ToUserName);
|
||||
}
|
||||
responseMessage.Articles.AddRange(artList);
|
||||
|
||||
//Article article;
|
||||
//List<Article> artList = new List<Article>();
|
||||
//IList<Model.weixin_request_content> twList = new BLL.weixin_request_content().GetModelList(10, ruleId, string.Empty);
|
||||
//foreach (Model.weixin_request_content modelt in twList)
|
||||
//{
|
||||
// article = new Article();
|
||||
// article.Title = modelt.title;
|
||||
// article.Description = modelt.content;
|
||||
// article.Url = GetWXApiUrl(modelt.link_url, token, openid);
|
||||
// if (string.IsNullOrEmpty(modelt.img_url))
|
||||
// {
|
||||
// article.PicUrl = string.Empty;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (modelt.img_url.Contains("http://"))
|
||||
// {
|
||||
// article.PicUrl = modelt.img_url;
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
// article.PicUrl = siteConfig.weburl + "/" + siteConfig.webpath.Replace("/", "") + modelt.img_url;
|
||||
// }
|
||||
// }
|
||||
// artList.Add(article);
|
||||
//}
|
||||
|
||||
//if (artList.Count == 0)
|
||||
//{
|
||||
// new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "-1", requestMessage.ToUserName);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "这次发了" + artList.Count + "条图文", requestMessage.ToUserName);
|
||||
//}
|
||||
//responseMessage.Articles.AddRange(artList);
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 请求为图片的处理=====================================
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxt(RequestMessageImage requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
//responseMessage.Content = new BLL.weixin_request_content().GetContent(ruleId);
|
||||
WeixinRequestContent ctx = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (ctx != null)
|
||||
{
|
||||
responseMessage.Content = ctx.Content;
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "text",
|
||||
ReponseContent = responseMessage.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
return responseMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxtByContent(RequestMessageImage requestMessage, string content, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
responseMessage.Content = content;
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "text",
|
||||
ReponseContent = "文字请求,推送纯粹文字,内容为:" + content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "text", "文字请求,推送纯粹文字,内容为:" + content, requestMessage.ToUserName);
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理语音请求
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageeMusic(RequestMessageImage requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
//string EventName = "";
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageMusic>(requestMessage);
|
||||
//Model.weixin_request_content model = new BLL.weixin_request_content().GetModel(ruleId);
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.MediaURL.Contains("http://"))
|
||||
{
|
||||
responseMessage.Music.MusicUrl = model.MediaURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
responseMessage.Music.MusicUrl = Utils.GetServerUrl() + model.MediaURL;
|
||||
}
|
||||
responseMessage.Music.Title = model.Title;
|
||||
responseMessage.Music.Description = model.Content;
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "音乐链接:" + model.media_url + "|标题:" + model.title + "|描述:" + model.content, requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "音乐链接:" + model.MediaURL + "|标题:" + model.Title + "|描述:" + model.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送多图文
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageNews(RequestMessageImage requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageNews>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
|
||||
Senparc.NeuChar.Entities.Article article;
|
||||
List<Senparc.NeuChar.Entities.Article> artList = new List<Senparc.NeuChar.Entities.Article>();
|
||||
IList<WeixinRequestContent> twList = WeixinRequestContent.FindAll(WeixinRequestContent._.RuleId == ruleId, null, null, 0, 10);
|
||||
foreach (WeixinRequestContent modelt in twList)
|
||||
{
|
||||
article = new Senparc.NeuChar.Entities.Article();
|
||||
article.Title = modelt.Title;
|
||||
article.Description = modelt.Content;
|
||||
article.Url = GetWXApiUrl(modelt.LinkUrl, token, openid);
|
||||
if (string.IsNullOrEmpty(modelt.ImgURL))
|
||||
article.PicUrl = string.Empty;
|
||||
else
|
||||
{
|
||||
if (modelt.ImgURL.Contains("http://"))
|
||||
{
|
||||
article.PicUrl = modelt.ImgURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
article.PicUrl = Utils.GetServerUrl() + "/" + modelt.ImgURL;
|
||||
}
|
||||
}
|
||||
artList.Add(article);
|
||||
}
|
||||
if (artList.Count == 0)
|
||||
{
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "-1", requestMessage.ToUserName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.PicUrl,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "这次发了" + artList.Count + "条图文",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), requestMessage.Content, "txtpic", "这次发了" + artList.Count + "条图文", requestMessage.ToUserName);
|
||||
}
|
||||
responseMessage.Articles.AddRange(artList);
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送单张图片
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageSingleImagesContent(RequestMessageText requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageImage>(requestMessage);
|
||||
string EventName = "";
|
||||
var locationService = new LocationService();
|
||||
NewLife.Log.XTrace.WriteLine("相应单图片回复");
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteLine("没找到单图片回复规则");
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "image",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MediaURL))
|
||||
{
|
||||
//如果没有mediaid 则先上传
|
||||
string imgUrl = "~/wwwroot" + model.ImgURL;
|
||||
var uploadResult = Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadTemporaryMedia(siteConfig.AppId, UploadMediaFileType.image,
|
||||
ServerUtility.ContentRootMapPath(imgUrl));
|
||||
//NewLife.Log.XTrace.WriteLine("准备上传素材,imgurl:" + imgurl);
|
||||
|
||||
//var accessToken = AccessTokenContainer.TryGetAccessToken(siteConfig.AppId, siteConfig.AppSecret);// AccessTokenContainer.TryGetAccessToken(official.AppId, official.AppSecret, false);
|
||||
//上传图片素材 imgurl 必须是本地绝对路径。。。。
|
||||
//var upresult = Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadForeverMedia(accessToken, imgurl);
|
||||
model.MediaURL = uploadResult.media_id;
|
||||
model.Update();
|
||||
NewLife.Log.XTrace.WriteLine("上传素材,返回mediaid:" + uploadResult.media_id);
|
||||
}
|
||||
Image img = new Image();
|
||||
img.MediaId = model.MediaURL;
|
||||
responseMessage.CreateTime = DateTime.Now;
|
||||
responseMessage.Image = img;
|
||||
|
||||
NewLife.Log.XTrace.WriteLine("回复单图片,mediaid" + img.MediaId + ";回复用户openid:" + responseMessage.FromUserName);
|
||||
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "image",
|
||||
ReponseContent = "图片:" + model.MediaURL + "|标题:" + model.Title,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 请求为事件的处理=====================================
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxt(RequestMessageEventBase requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
WeixinRequestContent rct = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
responseMessage.Content = rct != null ? rct.Content : "";// new BLL.weixin_request_content().GetContent(ruleId);
|
||||
|
||||
NewLife.Log.XTrace.WriteLine("文本自动关注回复:" + ruleId + "||" + responseMessage.Content);
|
||||
|
||||
string EventName = "";
|
||||
if (requestMessage.Event.ToString().Trim() != "")
|
||||
{
|
||||
EventName = requestMessage.Event.ToString();
|
||||
}
|
||||
//else if (requestMessage.EventKey != null)
|
||||
//{
|
||||
// EventName += requestMessage.EventKey.ToString();
|
||||
//}
|
||||
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "text", responseMessage.Content, requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "text",
|
||||
ReponseContent = responseMessage.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageTxtByContent(RequestMessageEventBase requestMessage, string content, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
var locationService = new LocationService();
|
||||
responseMessage.Content = content;
|
||||
string EventName = "";
|
||||
if (requestMessage.Event.ToString().Trim() != "")
|
||||
{
|
||||
EventName = requestMessage.Event.ToString();
|
||||
}
|
||||
//else if (requestMessage.EventKey != null)
|
||||
//{
|
||||
// EventName += requestMessage.EventKey.ToString();
|
||||
//}
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "text", "事件:推送纯粹的文字,内容为:" + content, requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "text",
|
||||
ReponseContent = "事件:推送纯粹的文字,内容为:" + content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 推送纯文字
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageSingleImage(RequestMessageEventBase requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageImage>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
|
||||
NewLife.Log.XTrace.WriteLine("相应单图片回复");
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteLine("没找到单图片回复规则");
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = "关注自动回复",
|
||||
ResponseType = "image",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MediaURL))
|
||||
{
|
||||
string imgUrl = "~/wwwroot" + model.ImgURL;
|
||||
var uploadResult = Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadTemporaryMedia(siteConfig.AppId, UploadMediaFileType.image,
|
||||
ServerUtility.ContentRootMapPath(imgUrl));
|
||||
|
||||
model.MediaURL = uploadResult.media_id;
|
||||
model.Update();
|
||||
NewLife.Log.XTrace.WriteLine("上传素材,返回mediaid:" + uploadResult.media_id);
|
||||
}
|
||||
Image img = new Image();
|
||||
img.MediaId = model.MediaURL;
|
||||
responseMessage.CreateTime = DateTime.Now;
|
||||
responseMessage.Image = img;
|
||||
|
||||
NewLife.Log.XTrace.WriteLine("回复单图片,mediaid" + img.MediaId + ";回复用户openid:" + responseMessage.FromUserName);
|
||||
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = "关注自动回复",
|
||||
ResponseType = "image",
|
||||
ReponseContent = "图片:" + model.MediaURL + "|标题:" + model.Title,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送单张图片
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageSingleImagesContent(RequestMessageEventBase requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageImage>(requestMessage);
|
||||
string EventName = "";
|
||||
var locationService = new LocationService();
|
||||
NewLife.Log.XTrace.WriteLine("相应单图片回复");
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteLine("没找到单图片回复规则");
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "image",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MediaURL))
|
||||
{
|
||||
//如果没有mediaid 则先上传
|
||||
string imgUrl = "~/wwwroot" + model.ImgURL;
|
||||
var uploadResult = Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadTemporaryMedia(siteConfig.AppId, UploadMediaFileType.image,
|
||||
ServerUtility.ContentRootMapPath(imgUrl));
|
||||
model.MediaURL = uploadResult.media_id;
|
||||
model.Update();
|
||||
NewLife.Log.XTrace.WriteLine("上传素材,返回mediaid:" + uploadResult.media_id);
|
||||
}
|
||||
Image img = new Image();
|
||||
img.MediaId = model.MediaURL;
|
||||
responseMessage.CreateTime = DateTime.Now;
|
||||
responseMessage.Image = img;
|
||||
|
||||
NewLife.Log.XTrace.WriteLine("回复单图片,mediaid" + img.MediaId + ";回复用户openid:" + responseMessage.FromUserName);
|
||||
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "image",
|
||||
ReponseContent = "图片:" + model.MediaURL + "|标题:" + model.Title,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理语音请求
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageeMusic(RequestMessageEventBase requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageMusic>(requestMessage);
|
||||
string EventName = "";
|
||||
if (requestMessage.Event.ToString().Trim() != "")
|
||||
{
|
||||
EventName = requestMessage.Event.ToString();
|
||||
}
|
||||
//else if (requestMessage.EventKey != null)
|
||||
//{
|
||||
// EventName += requestMessage.EventKey.ToString();
|
||||
//}
|
||||
|
||||
//Model.weixin_request_content model = new BLL.weixin_request_content().GetModel(ruleId);
|
||||
WeixinRequestContent model = WeixinRequestContent.Find(WeixinRequestContent._.RuleId == ruleId);
|
||||
if (model == null)
|
||||
{
|
||||
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.MediaURL.Contains("http://"))
|
||||
{
|
||||
responseMessage.Music.MusicUrl = model.MediaURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
responseMessage.Music.MusicUrl = Utils.GetServerUrl() + model.MediaURL;
|
||||
}
|
||||
responseMessage.Music.Title = model.Title;
|
||||
responseMessage.Music.Description = model.Content;
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "music", "音乐链接:" + model.media_url + "|标题:" + model.title + "|描述:" + model.content, requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "music",
|
||||
ReponseContent = "音乐链接:" + model.MediaURL + "|标题:" + model.Title + "|描述:" + model.Content,
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送多图文
|
||||
/// </summary>
|
||||
public IResponseMessageBase GetResponseMessageNews(RequestMessageEventBase requestMessage, int ruleId, int accountId)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageNews>(requestMessage);
|
||||
string openid = requestMessage.FromUserName;
|
||||
string token = ConvertDateTimeInt(DateTime.Now).ToString();
|
||||
|
||||
Senparc.NeuChar.Entities.Article article;
|
||||
List<Senparc.NeuChar.Entities.Article> artList = new List<Senparc.NeuChar.Entities.Article>();
|
||||
//IList<Model.weixin_request_content> twList = new BLL.weixin_request_content().GetModelList(10, ruleId, string.Empty);
|
||||
IList<WeixinRequestContent> twList = WeixinRequestContent.FindAll(WeixinRequestContent._.RuleId == ruleId, null, null, 0, 10);
|
||||
foreach (WeixinRequestContent modelt in twList)
|
||||
{
|
||||
article = new Senparc.NeuChar.Entities.Article();
|
||||
article.Title = modelt.Title;
|
||||
article.Description = modelt.Content;
|
||||
article.Url = GetWXApiUrl(modelt.LinkUrl, token, openid);
|
||||
if (string.IsNullOrEmpty(modelt.ImgURL))
|
||||
{
|
||||
article.PicUrl = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modelt.ImgURL.Contains("http://"))
|
||||
{
|
||||
article.PicUrl = modelt.ImgURL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//因为安装目录是以/开头,所以去掉,以免出现双斜杆
|
||||
article.PicUrl = Utils.GetServerUrl() + modelt.ImgURL;
|
||||
}
|
||||
}
|
||||
artList.Add(article);
|
||||
}
|
||||
|
||||
string EventName = "";
|
||||
if (requestMessage.Event.ToString().Trim() != "")
|
||||
{
|
||||
EventName = requestMessage.Event.ToString();
|
||||
}
|
||||
//else if (requestMessage.EventKey != null)
|
||||
//{
|
||||
// EventName += requestMessage.EventKey.ToString();
|
||||
//}
|
||||
|
||||
if (artList.Count == 0)
|
||||
{
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "txtpic", "-1", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "-1",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
else
|
||||
{
|
||||
//new BLL.weixin_response_content().Add(accountId, requestMessage.FromUserName, requestMessage.MsgType.ToString(), EventName, "txtpic", "这次发了" + artList.Count + "条图文", requestMessage.ToUserName);
|
||||
WeixinResponseContent entity = new WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = EventName,
|
||||
ResponseType = "txtpic",
|
||||
ReponseContent = "这次发了" + artList.Count + "条图文",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
}
|
||||
responseMessage.Articles.AddRange(artList);
|
||||
return responseMessage;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取验证公众账户ID===================================
|
||||
/// <summary>
|
||||
/// 获取公众账户的ID
|
||||
/// </summary>
|
||||
public int GetAccountId()
|
||||
{
|
||||
if (string.IsNullOrEmpty(MyHttpContext.Current.Request.Query["uid"]))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int tmpInt = 0;
|
||||
if (!int.TryParse(MyHttpContext.Current.Request.Query["uid"].ToString(), out tmpInt))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int uid = int.Parse(MyHttpContext.Current.Request.Query["uid"].ToString());
|
||||
return uid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证公众账户原始ID是否一致
|
||||
/// </summary>
|
||||
public bool ExistsOriginalId(int accountId, string originalId)
|
||||
{
|
||||
//if(siteConfig.WexinAccount == )
|
||||
//if (WechatOfficial.FindCount(WechatOfficial._.Id == accountId & WechatOfficial._.OriginalId == originalId, null, null, 0, 0) > 0)
|
||||
//{
|
||||
// return true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
return true;
|
||||
//return new BLL.weixin_account().ExistsOriginalId(accountId, originalId);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 常用的方法封装=======================================
|
||||
/// <summary>
|
||||
/// 拼接微信URL地址参数
|
||||
/// </summary>
|
||||
public string GetWXApiUrl(string url, string token, string openid)
|
||||
{
|
||||
if (url.Contains("?"))
|
||||
{
|
||||
return url + "&token=" + token + "&openid=" + openid;
|
||||
}
|
||||
return url + "?token=" + token + "&openid=" + openid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置微信url地址的后缀
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetWxUrlSuffix()
|
||||
{
|
||||
return "wxref=mp.weixin.qq.com";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DateTime时间格式转换为Unix时间戳格式
|
||||
/// </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 long.Parse(Utils.GetTimeStamp());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Senparc.NeuChar.Context;
|
||||
using Senparc.NeuChar.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Senparc.Weixin.MP.Entities;
|
||||
using Senparc.Weixin.MP.MessageContexts;
|
||||
|
||||
namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
{
|
||||
public class CustomMessageContext : DefaultMpMessageContext
|
||||
{
|
||||
public CustomMessageContext()
|
||||
{
|
||||
base.MessageContextRemoved += CustomMessageContext_MessageContextRemoved;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当上下文过期,被移除时触发的时间
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void CustomMessageContext_MessageContextRemoved(object sender, WeixinContextRemovedEventArgs<IRequestMessageBase, IResponseMessageBase> e)
|
||||
{
|
||||
/* 注意,这个事件不是实时触发的(当然你也可以专门写一个线程监控)
|
||||
* 为了提高效率,根据WeixinContext中的算法,这里的过期消息会在过期后下一条请求执行之前被清除
|
||||
*/
|
||||
|
||||
var messageContext = e.MessageContext as CustomMessageContext;
|
||||
if (messageContext == null)
|
||||
{
|
||||
return;//如果是正常的调用,messageContext不会为null
|
||||
}
|
||||
|
||||
//TODO:这里根据需要执行消息过期时候的逻辑,下面的代码仅供参考
|
||||
|
||||
//Log.InfoFormat("{0}的消息上下文已过期",e.OpenId);
|
||||
//api.SendMessage(e.OpenId, "由于长时间未搭理客服,您的客服状态已退出!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,398 @@
|
||||
using Senparc.Weixin.MP.MessageHandlers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using COMCMS.Core;
|
||||
using System.IO;
|
||||
using Senparc.Weixin.MP.Entities.Request;
|
||||
using Senparc.Weixin.MP.Entities;
|
||||
using Senparc.NeuChar.Entities;
|
||||
using System.Threading.Tasks;
|
||||
using Senparc.NeuChar.Entities.Request;
|
||||
using System.Linq;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs;
|
||||
using Senparc.CO2NET.Utilities;
|
||||
using Senparc.Weixin.MP;
|
||||
using NewLife.Log;
|
||||
using Senparc.NeuChar.Helpers;
|
||||
|
||||
namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// 自定义MessageHandler
|
||||
/// 把MessageHandler作为基类,重写对应请求的处理方法
|
||||
/// </summary>
|
||||
public partial class CustomMessageHandler : MessageHandler<CustomMessageContext> /*如果不需要自定义,可以直接使用:
|
||||
MessageHandler<DefaultMpMessageContext> */
|
||||
{
|
||||
private Config cfg = Config.GetSystemConfig();
|
||||
/// <summary>
|
||||
/// 模板消息集合(Key:checkCode,Value:OpenId)
|
||||
/// 注意:这里只做测试,只适用于单服务器
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> TemplateMessageCollection = new Dictionary<string, string>();
|
||||
|
||||
private string appId = "";
|
||||
/// <summary>
|
||||
/// 为中间件提供生成当前类的委托
|
||||
/// </summary>
|
||||
public static Func<Stream, PostModel, int, CustomMessageHandler> GenerateMessageHandler = (stream, postModel, maxRecordCount)
|
||||
=> new CustomMessageHandler(stream, postModel, maxRecordCount, false /* 是否只允许处理加密消息,以提高安全性 */);
|
||||
public CustomMessageHandler(Stream inputStream, PostModel postModel, int maxRecordCount = 0, bool onlyAllowEcryptMessage = false)
|
||||
: base(inputStream, postModel, maxRecordCount, onlyAllowEcryptMessage)
|
||||
{
|
||||
//这里设置仅用于测试,实际开发可以在外部更全局的地方设置,
|
||||
//比如MessageHandler<MessageContext>.GlobalGlobalMessageContext.ExpireMinutes = 3。
|
||||
GlobalMessageContext.ExpireMinutes = 3;
|
||||
|
||||
OnlyAllowEcryptMessage = true;//是否只允许接收加密消息,默认为 false
|
||||
|
||||
if (!string.IsNullOrEmpty(postModel.AppId))
|
||||
{
|
||||
appId = postModel.AppId;//通过第三方开放平台发送过来的请求
|
||||
}
|
||||
else
|
||||
appId = cfg.AppId;
|
||||
|
||||
//在指定条件下,不使用消息去重
|
||||
base.OmitRepeatedMessageFunc = requestMessage =>
|
||||
{
|
||||
var textRequestMessage = requestMessage as RequestMessageText;
|
||||
if (textRequestMessage != null && textRequestMessage.Content == "容错")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public override IResponseMessageBase DefaultResponseMessage(IRequestMessageBase requestMessage)
|
||||
{
|
||||
/* 所有没有被处理的消息会默认返回这里的结果,
|
||||
* 因此,如果想把整个微信请求委托出去(例如需要使用分布式或从其他服务器获取请求),
|
||||
* 只需要在这里统一发出委托请求,如:
|
||||
* var responseMessage = MessageAgent.RequestResponseMessage(agentUrl, agentToken, RequestDocument.ToString());
|
||||
* return responseMessage;
|
||||
*/
|
||||
|
||||
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "这条消息来自DefaultResponseMessage。";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理文字请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage">请求消息</param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnTextRequestAsync(RequestMessageText requestMessage)
|
||||
{
|
||||
var defaultResponseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
IResponseMessageBase IR = null;
|
||||
Common.MessageFunction cmfun = new Common.MessageFunction();
|
||||
int ruleId = 0;
|
||||
|
||||
var requestHandler = await requestMessage.StartHandler().Default(async () =>
|
||||
{
|
||||
string keywords = requestMessage.Content;
|
||||
if (!string.IsNullOrEmpty(keywords)) keywords = keywords.Trim();
|
||||
|
||||
var currentMessageContext = await base.GetCurrentMessageContext();
|
||||
|
||||
//先精确匹配,再模糊匹配
|
||||
Core.WeixinRequestRule rule = Core.WeixinRequestRule.Find(Core.WeixinRequestRule._.Keywords == keywords & Core.WeixinRequestRule._.RequestType == (int)Core.WeixinRequestRule.XRequestType.Text);
|
||||
|
||||
if (rule == null)
|
||||
{
|
||||
//模糊匹配
|
||||
IList<Core.WeixinRequestRule> listRule = Core.WeixinRequestRule.FindAll(Core.WeixinRequestRule._.RequestType == (int)Core.WeixinRequestRule.XRequestType.Text & Core.WeixinRequestRule._.IsLikeQuery == 1, null, null, 0, 0);
|
||||
if (listRule != null && listRule.Count > 0)
|
||||
{
|
||||
int lenKeyword = keywords.Length;
|
||||
foreach (var item in listRule)
|
||||
{
|
||||
if (lenKeyword >= item.Keywords.Length && keywords.IndexOf(item.Keywords) >= 0)
|
||||
{
|
||||
rule = item;//规则
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rule == null)
|
||||
{
|
||||
Core.WeixinRequestRule notFindKeywordRule = Core.WeixinRequestRule.Find(Core.WeixinRequestRule._.RequestType == (int)Core.WeixinRequestRule.XRequestType.NotFindKeyword);
|
||||
if (notFindKeywordRule == null)
|
||||
{
|
||||
//找不到规则
|
||||
Core.WeixinResponseContent entity = new Core.WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = "none",
|
||||
ReponseContent = "未取到关键词对应的数据",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
return cmfun.GetResponseMessageTxtByContent(requestMessage, "未找到匹配的关键词", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ruleId = notFindKeywordRule.Id;
|
||||
switch (notFindKeywordRule.ResponseType)
|
||||
{
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Text:
|
||||
//发送纯文字
|
||||
IR = cmfun.GetResponseMessageTxt(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Image:
|
||||
//发送多图文
|
||||
IR = cmfun.GetResponseMessageNews(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Voice:
|
||||
//发送语音
|
||||
IR = cmfun.GetResponseMessageeMusic(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.SingleImage:
|
||||
IR = cmfun.GetResponseMessageSingleImagesContent(requestMessage, ruleId, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return IR;
|
||||
}
|
||||
}
|
||||
Core.WeixinResponseContent model = new Core.WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.Content,
|
||||
ResponseType = Core.WeixinResponseContent.GetResponseType((int)requestMessage.MsgType),
|
||||
ReponseContent = requestMessage.ToString(),
|
||||
XmlContent = string.Empty
|
||||
};
|
||||
model.Insert();
|
||||
|
||||
|
||||
return IR;
|
||||
});
|
||||
|
||||
return requestHandler.GetResponseMessage() as IResponseMessageBase;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理位置请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnLocationRequestAsync(RequestMessageLocation requestMessage)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "您刚才发送的是小视频";
|
||||
return responseMessage;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理图片请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnImageRequestAsync(RequestMessageImage requestMessage)
|
||||
{
|
||||
//一隔一返回News或Image格式
|
||||
if (base.GlobalMessageContext.GetMessageContext(requestMessage).RequestMessages.Count() % 2 == 0)
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageNews>();
|
||||
|
||||
responseMessage.Articles.Add(new Senparc.NeuChar.Entities.Article()
|
||||
{
|
||||
Title = "您刚才发送了图片信息",
|
||||
Description = "您发送的图片将会显示在边上",
|
||||
PicUrl = requestMessage.PicUrl,
|
||||
Url = "https://sdk.weixin.senparc.com"
|
||||
});
|
||||
responseMessage.Articles.Add(new Senparc.NeuChar.Entities.Article()
|
||||
{
|
||||
Title = "第二条",
|
||||
Description = "第二条带连接的内容",
|
||||
PicUrl = requestMessage.PicUrl,
|
||||
Url = "https://sdk.weixin.senparc.com"
|
||||
});
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
//return responseMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageImage>();
|
||||
responseMessage.Image.MediaId = requestMessage.MediaId;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
//return responseMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理语音请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnVoiceRequestAsync(RequestMessageVoice requestMessage)
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageMusic>();
|
||||
//上传缩略图
|
||||
//var accessToken = Containers.AccessTokenContainer.TryGetAccessToken(appId, appSecret);
|
||||
var uploadResult = Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadTemporaryMedia(appId, UploadMediaFileType.image,
|
||||
ServerUtility.ContentRootMapPath("~/Images/Logo.jpg"));
|
||||
|
||||
//设置音乐信息
|
||||
responseMessage.Music.Title = "天籁之音";
|
||||
responseMessage.Music.Description = "播放您上传的语音";
|
||||
responseMessage.Music.MusicUrl = "https://sdk.weixin.senparc.com/Media/GetVoice?mediaId=" + requestMessage.MediaId;
|
||||
responseMessage.Music.HQMusicUrl = "https://sdk.weixin.senparc.com/Media/GetVoice?mediaId=" + requestMessage.MediaId;
|
||||
responseMessage.Music.ThumbMediaId = uploadResult.media_id;
|
||||
|
||||
//推送一条客服消息
|
||||
try
|
||||
{
|
||||
CustomApi.SendText(appId, OpenId, "本次上传的音频MediaId:" + requestMessage.MediaId);
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 处理视频请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnVideoRequestAsync(RequestMessageVideo requestMessage)
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "您发送了一条视频信息,ID:" + requestMessage.MediaId;
|
||||
|
||||
#region 上传素材并推送到客户端
|
||||
|
||||
//Task.Factory.StartNew(async () =>
|
||||
//{
|
||||
// //上传素材
|
||||
// var dir = ServerUtility.ContentRootMapPath("~/App_Data/TempVideo/");
|
||||
// var file = await MediaApi.GetAsync(appId, requestMessage.MediaId, dir);
|
||||
// var uploadResult = await MediaApi.UploadTemporaryMediaAsync(appId, UploadMediaFileType.video, file, 50000);
|
||||
// await CustomApi.SendVideoAsync(appId, base.WeixinOpenId, uploadResult.media_id, "这是您刚才发送的视频", "这是一条视频消息");
|
||||
//}).ContinueWith(async task =>
|
||||
//{
|
||||
// if (task.Exception != null)
|
||||
// {
|
||||
// WeixinTrace.Log("OnVideoRequest()储存Video过程发生错误:", task.Exception.Message);
|
||||
|
||||
|
||||
// var msg = string.Format("上传素材出错:{0}\r\n{1}",
|
||||
// task.Exception.Message,
|
||||
// task.Exception.InnerException != null
|
||||
// ? task.Exception.InnerException.Message
|
||||
// : null);
|
||||
// await CustomApi.SendTextAsync(appId, base.WeixinOpenId, msg);
|
||||
// }
|
||||
//});
|
||||
|
||||
#endregion
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理链接消息请求
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnLinkRequestAsync(RequestMessageLink requestMessage)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
responseMessage.Content = string.Format(@"您发送了一条连接信息:
|
||||
Title:{0}
|
||||
Description:{1}
|
||||
Url:{2}", requestMessage.Title, requestMessage.Description, requestMessage.Url);
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
public override async Task<IResponseMessageBase> OnFileRequestAsync(RequestMessageFile requestMessage)
|
||||
{
|
||||
var responseMessage = requestMessage.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = string.Format(@"您发送了一个文件:
|
||||
文件名:{0}
|
||||
说明:{1}
|
||||
大小:{2}
|
||||
MD5:{3}", requestMessage.Title, requestMessage.Description, requestMessage.FileTotalLen, requestMessage.FileMd5);
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理事件请求(这个方法一般不用重写,这里仅作为示例出现。除非需要在判断具体Event类型以外对Event信息进行统一操作
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<IResponseMessageBase> OnEventRequestAsync(IRequestMessageEventBase requestMessage)
|
||||
{
|
||||
var eventResponseMessage = await base.OnEventRequestAsync(requestMessage);//对于Event下属分类的重写方法,见:CustomerMessageHandler_Events.cs
|
||||
//TODO: 对Event信息进行统一操作
|
||||
return eventResponseMessage;
|
||||
}
|
||||
|
||||
public override async Task<IResponseMessageBase> OnUnknownTypeRequestAsync(RequestMessageUnknownType requestMessage)
|
||||
{
|
||||
/*
|
||||
* 此方法用于应急处理SDK没有提供的消息类型,
|
||||
* 原始XML可以通过requestMessage.RequestDocument(或this.RequestDocument)获取到。
|
||||
* 如果不重写此方法,遇到未知的请求类型将会抛出异常(v14.8.3 之前的版本就是这么做的)
|
||||
*/
|
||||
var msgType = Senparc.NeuChar.Helpers.MsgTypeHelper.GetRequestMsgTypeString(requestMessage.RequestDocument);
|
||||
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "未知消息类型:" + msgType;
|
||||
XTrace.WriteLine("未知请求消息类型", requestMessage.RequestDocument.ToString());
|
||||
//WeixinTrace.SendCustomLog("未知请求消息类型", requestMessage.RequestDocument.ToString());//记录到日志中
|
||||
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return responseMessage;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
using COMCMS.API.Weixin.Download;
|
||||
using NewLife.Configuration;
|
||||
using Senparc.NeuChar.Entities;
|
||||
using Senparc.Weixin.MP.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.API.Weixin.CustomMessageHandler
|
||||
{
|
||||
public partial class CustomMessageHandler
|
||||
{
|
||||
public string GetDownloadInfo(CodeRecord codeRecord)
|
||||
{
|
||||
return string.Format(@"您已通过二维码验证,浏览器即将开始下载 Senparc.Weixin SDK 帮助文档。
|
||||
当前选择的版本:v{0}({1})
|
||||
|
||||
我们期待您的意见和建议,客服热线:400-031-8816。
|
||||
|
||||
感谢您对盛派网络的支持!
|
||||
|
||||
© {2} Senparc", codeRecord.Version, codeRecord.IsWebVersion ? "网页版" : ".chm文档版", DateTime.Now.Year);
|
||||
}
|
||||
|
||||
public override IResponseMessageBase OnTextOrEventRequest(RequestMessageText requestMessage)
|
||||
{
|
||||
// 预处理文字或事件类型请求。
|
||||
// 这个请求是一个比较特殊的请求,通常用于统一处理来自文字或菜单按钮的同一个执行逻辑,
|
||||
// 会在执行OnTextRequest或OnEventRequest之前触发,具有以下一些特征:
|
||||
// 1、如果返回null,则继续执行OnTextRequest或OnEventRequest
|
||||
// 2、如果返回不为null,则终止执行OnTextRequest或OnEventRequest,返回最终ResponseMessage
|
||||
// 3、如果是事件,则会将RequestMessageEvent自动转为RequestMessageText类型,其中RequestMessageText.Content就是RequestMessageEvent.EventKey
|
||||
|
||||
if (requestMessage.Content == "OneClick")
|
||||
{
|
||||
var strongResponseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
strongResponseMessage.Content = "您点击了底部按钮。\r\n为了测试微信软件换行bug的应对措施,这里做了一个——\r\n换行";
|
||||
return strongResponseMessage;
|
||||
}
|
||||
return null;//返回null,则继续执行OnTextRequest或OnEventRequest
|
||||
}
|
||||
|
||||
|
||||
public string GetWXApiUrl(string url, string token, string openid)
|
||||
{
|
||||
if (url.Contains("?"))
|
||||
{
|
||||
return url + "&token=" + token + "&openid=" + openid;
|
||||
}
|
||||
return url + "?token=" + token + "&openid=" + openid;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 点击事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_ClickRequest(RequestMessageEvent_Click requestMessage)
|
||||
{
|
||||
//菜单点击,需要跟创建菜单时的Key匹配
|
||||
IResponseMessageBase IR = null;
|
||||
Common.MessageFunction cmfun = new Common.MessageFunction();
|
||||
int responseType = 0, ruleId = 0;
|
||||
|
||||
string keywords = requestMessage.EventKey; //事件key
|
||||
|
||||
//先精确匹配,再模糊匹配
|
||||
Core.WeixinRequestRule rule = Core.WeixinRequestRule.Find(Core.WeixinRequestRule._.Keywords == keywords & Core.WeixinRequestRule._.RequestType == (int)Core.WeixinRequestRule.XRequestType.CustomMenu);
|
||||
|
||||
if (rule == null)
|
||||
{
|
||||
//找不到规则
|
||||
Core.WeixinResponseContent entity = new Core.WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.EventKey,
|
||||
ResponseType = "none",
|
||||
ReponseContent = "未取到相应的事件规则",
|
||||
XmlContent = requestMessage.ToUserName
|
||||
};
|
||||
entity.Insert();
|
||||
return cmfun.GetResponseMessageTxtByContent(requestMessage, "未取到相应的事件规则", 0);
|
||||
}
|
||||
responseType = rule.ResponseType;
|
||||
ruleId = rule.Id;
|
||||
switch (responseType)
|
||||
{
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Text:
|
||||
//发送纯文字
|
||||
IR = cmfun.GetResponseMessageTxt(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Image:
|
||||
//发送多图文
|
||||
IR = cmfun.GetResponseMessageNews(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.Voice:
|
||||
//发送语音
|
||||
IR = cmfun.GetResponseMessageeMusic(requestMessage, ruleId, 0);
|
||||
break;
|
||||
case (int)Core.WeixinRequestRule.XResponseType.SingleImage:
|
||||
IR = cmfun.GetResponseMessageSingleImagesContent(requestMessage, ruleId, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Core.WeixinResponseContent model = new Core.WeixinResponseContent()
|
||||
{
|
||||
OpenId = requestMessage.FromUserName,
|
||||
RequestType = requestMessage.MsgType.ToString(),
|
||||
RequestContent = requestMessage.EventKey,
|
||||
ResponseType = Core.WeixinResponseContent.GetResponseType((int)requestMessage.MsgType),
|
||||
ReponseContent = requestMessage.ToString(),
|
||||
XmlContent = string.Empty
|
||||
};
|
||||
model.Insert();
|
||||
|
||||
return IR;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_EnterRequest(RequestMessageEvent_Enter requestMessage)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageText>(requestMessage);
|
||||
responseMessage.Content = "您刚才发送了ENTER事件请求。";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 位置事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_LocationRequest(RequestMessageEvent_Location requestMessage)
|
||||
{
|
||||
//这里是微信客户端(通过微信服务器)自动发送过来的位置信息
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "这里写什么都无所谓,比如:上帝爱你!";
|
||||
return responseMessage;//这里也可以返回null(需要注意写日志时候null的问题)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过二维码扫描关注扫描事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_ScanRequest(RequestMessageEvent_Scan requestMessage)
|
||||
{
|
||||
//通过扫描关注
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
|
||||
//下载文档
|
||||
if (!string.IsNullOrEmpty(requestMessage.EventKey))
|
||||
{
|
||||
//这里可以写扫码逻辑
|
||||
}
|
||||
|
||||
responseMessage.Content = responseMessage.Content ?? string.Format("通过扫描二维码进入,场景值:{0}", requestMessage.EventKey);
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开网页事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_ViewRequest(RequestMessageEvent_View requestMessage)
|
||||
{
|
||||
//说明:这条消息只作为接收,下面的responseMessage到达不了客户端,类似OnEvent_UnsubscribeRequest
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "您点击了view按钮,将打开网页:" + requestMessage.EventKey;
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 群发完成事件
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_MassSendJobFinishRequest(RequestMessageEvent_MassSendJobFinish requestMessage)
|
||||
{
|
||||
var responseMessage = CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "接收到了群发完成的信息。";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订阅(关注)事件
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_SubscribeRequest(RequestMessageEvent_Subscribe requestMessage)
|
||||
{
|
||||
return new Common.MessageFunction().EventSubscribe(6, requestMessage);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 退订
|
||||
/// 实际上用户无法收到非订阅账号的消息,所以这里可以随便写。
|
||||
/// unsubscribe事件的意义在于及时删除网站应用中已经记录的OpenID绑定,消除冗余数据。并且关注用户流失的情况。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_UnsubscribeRequest(RequestMessageEvent_Unsubscribe requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "有空再来";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件之扫码推事件(scancode_push)
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_ScancodePushRequest(RequestMessageEvent_Scancode_Push requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之扫码推事件";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件之扫码推事件且弹出“消息接收中”提示框(scancode_waitmsg)
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_ScancodeWaitmsgRequest(RequestMessageEvent_Scancode_Waitmsg requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之扫码推事件且弹出“消息接收中”提示框";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 事件之弹出拍照或者相册发图(pic_photo_or_album)
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_PicPhotoOrAlbumRequest(RequestMessageEvent_Pic_Photo_Or_Album requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之弹出拍照或者相册发图";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件之弹出系统拍照发图(pic_sysphoto)
|
||||
/// 实际测试时发现微信并没有推送RequestMessageEvent_Pic_Sysphoto消息,只能接收到用户在微信中发送的图片消息。
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_PicSysphotoRequest(RequestMessageEvent_Pic_Sysphoto requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之弹出系统拍照发图";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件之弹出微信相册发图器(pic_weixin)
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_PicWeixinRequest(RequestMessageEvent_Pic_Weixin requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之弹出微信相册发图器";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事件之弹出地理位置选择器(location_select)
|
||||
/// </summary>
|
||||
/// <param name="requestMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override IResponseMessageBase OnEvent_LocationSelectRequest(RequestMessageEvent_Location_Select requestMessage)
|
||||
{
|
||||
var responseMessage = base.CreateResponseMessage<ResponseMessageText>();
|
||||
responseMessage.Content = "事件之弹出地理位置选择器";
|
||||
return responseMessage;
|
||||
}
|
||||
|
||||
#region 微信认证事件推送
|
||||
|
||||
public override IResponseMessageBase OnEvent_QualificationVerifySuccessRequest(RequestMessageEvent_QualificationVerifySuccess requestMessage)
|
||||
{
|
||||
//以下方法可以强制定义返回的字符串值
|
||||
//TextResponseMessage = "your content";
|
||||
//return null;
|
||||
|
||||
return new SuccessResponseMessage();//返回"success"字符串
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.QrCode;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.API.Weixin.Download
|
||||
{
|
||||
public class CodeRecord
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public int QrCodeId { get; set; }
|
||||
public CreateQrCodeResult QrCodeTicket { get; set; }
|
||||
public string Version { get; set; }
|
||||
public bool Used { get; set; }
|
||||
public bool AllowDownload { get; set; }
|
||||
public bool IsWebVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using Senparc.CO2NET.Helpers;
|
||||
using Senparc.CO2NET.Helpers.BaiduMap;
|
||||
using Senparc.CO2NET.Helpers.GoogleMap;
|
||||
using Senparc.NeuChar.Entities;
|
||||
using Senparc.Weixin.MP.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.API.Weixin
|
||||
{
|
||||
public class LocationService
|
||||
{
|
||||
public ResponseMessageNews GetResponseMessage(RequestMessageLocation requestMessage)
|
||||
{
|
||||
var responseMessage = ResponseMessageBase.CreateFromRequestMessage<ResponseMessageNews>(requestMessage);
|
||||
|
||||
#region 百度地图
|
||||
|
||||
{
|
||||
var markersList = new List<BaiduMarkers>();
|
||||
markersList.Add(new BaiduMarkers()
|
||||
{
|
||||
Longitude = requestMessage.Location_X,
|
||||
Latitude = requestMessage.Location_Y,
|
||||
Color = "red",
|
||||
Label = "S",
|
||||
Size = BaiduMarkerSize.m
|
||||
});
|
||||
|
||||
var mapUrl = BaiduMapHelper.GetBaiduStaticMap(requestMessage.Location_X, requestMessage.Location_Y, 1, 6, markersList);
|
||||
responseMessage.Articles.Add(new Article()
|
||||
{
|
||||
Description = string.Format("【来自百度地图】您刚才发送了地理位置信息。Location_X:{0},Location_Y:{1},Scale:{2},标签:{3}",
|
||||
requestMessage.Location_X, requestMessage.Location_Y,
|
||||
requestMessage.Scale, requestMessage.Label),
|
||||
PicUrl = mapUrl,
|
||||
Title = "定位地点周边地图",
|
||||
Url = mapUrl
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GoogleMap
|
||||
|
||||
{
|
||||
var markersList = new List<GoogleMapMarkers>();
|
||||
markersList.Add(new GoogleMapMarkers()
|
||||
{
|
||||
X = requestMessage.Location_X,
|
||||
Y = requestMessage.Location_Y,
|
||||
Color = "red",
|
||||
Label = "S",
|
||||
Size = GoogleMapMarkerSize.Default,
|
||||
});
|
||||
var mapSize = "480x600";
|
||||
var mapUrl = GoogleMapHelper.GetGoogleStaticMap(19 /*requestMessage.Scale*//*微信和GoogleMap的Scale不一致,这里建议使用固定值*/,
|
||||
markersList, mapSize);
|
||||
responseMessage.Articles.Add(new Article()
|
||||
{
|
||||
Description = string.Format("【来自GoogleMap】您刚才发送了地理位置信息。Location_X:{0},Location_Y:{1},Scale:{2},标签:{3}",
|
||||
requestMessage.Location_X, requestMessage.Location_Y,
|
||||
requestMessage.Scale, requestMessage.Label),
|
||||
PicUrl = mapUrl,
|
||||
Title = "定位地点周边地图",
|
||||
Url = mapUrl
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
responseMessage.Articles.Add(new Article()
|
||||
{
|
||||
Title = "微信公众平台SDK 官网链接",
|
||||
Description = "Senparc.Weixin.MK SDK地址",
|
||||
PicUrl = "https://sdk.weixin.senparc.com/images/logo.jpg",
|
||||
Url = "https://sdk.weixin.senparc.com"
|
||||
});
|
||||
|
||||
return responseMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.6" />
|
||||
<PackageReference Include="NewLife.Core" Version="7.4.6881.41311" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="NewLife.Core" Version="8.4.2019.1212" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.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>
|
||||
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies">
|
||||
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.International.Converters.PinYinConverter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
public class PinYinHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认编码
|
||||
/// </summary>
|
||||
//private static Encoding gb2312 = Encoding.GetEncoding("GB2312");
|
||||
|
||||
#region 汉字转化为拼音
|
||||
/// <summary>
|
||||
/// 汉字转化为拼音
|
||||
/// </summary>
|
||||
/// <param name="str">汉字</param>
|
||||
/// <returns>全拼</returns>
|
||||
public static string GetPinyin(string str)
|
||||
{
|
||||
string r = string.Empty;
|
||||
foreach (char obj in str)
|
||||
{
|
||||
try
|
||||
{
|
||||
ChineseChar chineseChar = new ChineseChar(obj);
|
||||
string t = chineseChar.Pinyins[0].ToString();
|
||||
r += t.Substring(0, t.Length - 1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
r += obj.ToString();
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 汉字转化为拼音首字母
|
||||
/// <summary>
|
||||
/// 汉字转化为拼音首字母
|
||||
/// </summary>
|
||||
/// <param name="str">汉字</param>
|
||||
/// <returns>首字母</returns>
|
||||
public static string GetFirstPinyin(string str)
|
||||
{
|
||||
string r = string.Empty;
|
||||
foreach (char obj in str)
|
||||
{
|
||||
try
|
||||
{
|
||||
ChineseChar chineseChar = new ChineseChar(obj);
|
||||
string t = chineseChar.Pinyins[0].ToString();
|
||||
r += t.Substring(0, 1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
r += obj.ToString();
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,11 @@ namespace COMCMS.Common
|
||||
/// <summary>
|
||||
/// 程序绝对目录
|
||||
/// </summary>
|
||||
private static string _ContentRootPath = DI.ServiceProvider.GetService<IHostingEnvironment>().ContentRootPath;
|
||||
private static string _ContentRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().ContentRootPath;
|
||||
/// <summary>
|
||||
/// 静态文件
|
||||
/// </summary>
|
||||
private static string _WebRootPath = DI.ServiceProvider.GetService<IHostingEnvironment>().WebRootPath;
|
||||
private static string _WebRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().WebRootPath;
|
||||
|
||||
#region 方式
|
||||
public enum CutMode
|
||||
|
||||
+109
-1
@@ -9,6 +9,9 @@ using System.Net;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace COMCMS.Common
|
||||
{
|
||||
@@ -75,6 +78,32 @@ namespace COMCMS.Common
|
||||
/// 配送状态 "未配送", "配货中", "已配送", "已收到", "退货中", "已退货"
|
||||
/// </summary>
|
||||
public static string[] DeliverState = { "未配送", "配货中", "已配送", "已收到", "退货中", "已退货" };
|
||||
/// <summary>
|
||||
/// cms类型
|
||||
/// </summary>
|
||||
public enum CMSType
|
||||
{
|
||||
/// <summary>
|
||||
/// 文章分类
|
||||
/// </summary>
|
||||
ArticleCategory=0,
|
||||
/// <summary>
|
||||
/// 文章
|
||||
/// </summary>
|
||||
Article=1,
|
||||
/// <summary>
|
||||
/// 商品分类
|
||||
/// </summary>
|
||||
ProductCategory=2,
|
||||
/// <summary>
|
||||
/// 商品详情
|
||||
/// </summary>
|
||||
Product=3,
|
||||
/// <summary>
|
||||
/// 首页
|
||||
/// </summary>
|
||||
Home=99
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证部分
|
||||
@@ -99,6 +128,17 @@ namespace COMCMS.Common
|
||||
return Regex.IsMatch(str, @"^[A-Za-z0-9]+$");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为正确的
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsFilePath(string str)
|
||||
{
|
||||
//A-Z, a-z, 0-9, -, /, =
|
||||
return Regex.IsMatch(str, @"[A-Za-z0-9-\/]");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证对象是否为货币格式
|
||||
/// </summary>
|
||||
@@ -177,7 +217,7 @@ namespace COMCMS.Common
|
||||
{
|
||||
if (str.Length != 11)
|
||||
return false;
|
||||
return Regex.IsMatch(str, @"^1[3|4|5|7|8][0-9]\d{4,8}$");
|
||||
return Regex.IsMatch(str, @"^1[3|4|5|7|8|9][0-9]\d{4,8}$");
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否为ip
|
||||
@@ -308,6 +348,19 @@ namespace COMCMS.Common
|
||||
#endregion
|
||||
|
||||
#region 获取部分
|
||||
|
||||
/// <summary>
|
||||
/// 获取配置
|
||||
/// </summary>
|
||||
/// <param name="path">路径,如:SystemSetting:COMCMSPrefixKey</param>
|
||||
/// <returns></returns>
|
||||
public static string GetSetting(string path)
|
||||
{
|
||||
string value = Configuration[path];
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回字符串真实长度, 1个汉字长度为2
|
||||
/// </summary>
|
||||
@@ -674,6 +727,12 @@ namespace COMCMS.Common
|
||||
public static string GetIP()
|
||||
{
|
||||
string userHostAddress = MyHttpContext.Current.Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
//2019-05-11 增加反向代理获取真实IP
|
||||
string xForwardedForAddress = MyHttpContext.Current.Request.Headers["X-Forwarded-For"];
|
||||
if (!string.IsNullOrEmpty(userHostAddress) && !string.IsNullOrEmpty(xForwardedForAddress) && userHostAddress != xForwardedForAddress)
|
||||
{
|
||||
return xForwardedForAddress;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(userHostAddress) && Utils.IsIP(userHostAddress))
|
||||
{
|
||||
if (userHostAddress == "::1")
|
||||
@@ -994,6 +1053,37 @@ namespace COMCMS.Common
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将对象转换为Int32类型
|
||||
/// </summary>
|
||||
/// <param name="str">要转换的字符串</param>
|
||||
/// <param name="defValue">缺省值</param>
|
||||
/// <returns>转换后的int类型结果</returns>
|
||||
public static int StrToInt(string str, int defValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str) || str.Trim().Length >= 11 || !Regex.IsMatch(str.Trim(), @"^([-]|[0-9])[0-9]*(\.\w*)?$"))
|
||||
return defValue;
|
||||
|
||||
int rv;
|
||||
if (Int32.TryParse(str, out rv))
|
||||
return rv;
|
||||
|
||||
return Convert.ToInt32(StrToFloat(str, defValue));
|
||||
}
|
||||
/// <summary>
|
||||
/// string型转换为float型
|
||||
/// </summary>
|
||||
/// <param name="strValue">要转换的字符串</param>
|
||||
/// <param name="defValue">缺省值</param>
|
||||
/// <returns>转换后的int类型结果</returns>
|
||||
public static float StrToFloat(object strValue, float defValue)
|
||||
{
|
||||
if ((strValue == null))
|
||||
return defValue;
|
||||
|
||||
return StrToFloat(strValue.ToString(), defValue);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region COMCMS类型
|
||||
@@ -1011,6 +1101,24 @@ namespace COMCMS.Common
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static String[] _Excludes = new[] { "Loopback", "VMware", "VBox", "Virtual", "Teredo", "Microsoft", "VPN", "VNIC", "IEEE" };
|
||||
/// <summary>获取所有网卡MAC地址</summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<Byte[]> GetMacs()
|
||||
{
|
||||
foreach (var item in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
if (_Excludes.Any(e => item.Description.Contains(e))) continue;
|
||||
if (item.Speed < 1_000_000) continue;
|
||||
|
||||
var addrs = item.GetIPProperties().UnicastAddresses.Where(e => e.Address.AddressFamily == AddressFamily.InterNetwork).ToArray();
|
||||
if (addrs.All(e => IPAddress.IsLoopback(e.Address))) continue;
|
||||
|
||||
var mac = item.GetPhysicalAddress()?.GetAddressBytes();
|
||||
if (mac != null && mac.Length == 6) yield return mac;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region 常用扩展方法
|
||||
|
||||
@@ -153,6 +153,65 @@ namespace COMCMS.Core
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>
|
||||
/// 获取上一条记录/前一条记录
|
||||
/// </summary>
|
||||
/// <param name="id">ID</param>
|
||||
/// <returns></returns>
|
||||
public static Article GetPrev(int id)
|
||||
{
|
||||
Article entity = Article.FindById(id);
|
||||
if (entity != null)
|
||||
{
|
||||
//获取上一条记录
|
||||
IList<Article> list = Article.FindAll(_.Id > entity.Id & _.KId == entity.KId & _.Sequence <= entity.Sequence, string.Format("{0} Desc,{1} Asc", _.Sequence, _.Id), null, 0, 1);
|
||||
if (list != null && list.Count > 0)
|
||||
return list[0];
|
||||
else
|
||||
{
|
||||
list = Article.FindAll(_.Id != entity.Id & _.KId == entity.KId & _.Sequence < entity.Sequence, string.Format("{0} Desc,{1} Asc", _.Sequence, _.Id), null, 0, 1);
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
return list[0];
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下一条记录/后一条记录
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static Article GetNext(int id)
|
||||
{
|
||||
Article entity = Article.FindById(id);
|
||||
if (entity != null)
|
||||
{
|
||||
//获取上一条记录
|
||||
IList<Article> list = Article.FindAll(_.Id != entity.Id & _.KId == entity.KId & _.Sequence > entity.Sequence, string.Format("{0} Asc,{1} Desc", _.Sequence, _.Id), null, 0, 1);
|
||||
if (list != null && list.Count > 0)
|
||||
return list[0];
|
||||
else
|
||||
{
|
||||
list = Article.FindAll(_.Id < entity.Id & _.KId == entity.KId & _.Sequence >= entity.Sequence, string.Format("{0} Asc,{1} Desc", _.Sequence, _.Id), null, 0, 1);
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
return list[0];
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,23 @@ namespace COMCMS.Core
|
||||
|
||||
return Find(_.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>根据目录查找</summary>
|
||||
/// <param name="path">目录</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static ArticleCategory FindByFilePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.FilePath == path);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache[id];
|
||||
|
||||
return Find(_.FilePath == path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据父ID查询所有子项
|
||||
/// </summary>
|
||||
@@ -325,6 +342,35 @@ namespace COMCMS.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前位置
|
||||
/// </summary>
|
||||
/// <param name="kid">类别ID</param>
|
||||
/// <returns></returns>
|
||||
public static string GetNav(int kid)
|
||||
{
|
||||
string tpl = "<a href=\"{0}\" title=\"{1}\">{1}</a>";
|
||||
string re = string.Empty;
|
||||
ArticleCategory model = Find(_.Id == kid);
|
||||
if (model == null)
|
||||
{
|
||||
re = string.Format(tpl, "/", "首页") + re;//查到最后肯定是没有
|
||||
}
|
||||
else
|
||||
{
|
||||
re += " > " + string.Format(tpl, "/article/index/" + model.Id, model.KindName);
|
||||
if (model.PId != 0)
|
||||
{
|
||||
re = GetNav(model.PId) + re;
|
||||
}
|
||||
else
|
||||
{
|
||||
re = string.Format(tpl, "/", "首页") + re;//查到最后肯定是没有
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+65
-46
@@ -20,7 +20,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _KindName;
|
||||
@@ -28,7 +28,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目名称")]
|
||||
[Description("栏目名称")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindName", "栏目名称", "nvarchar(250)")]
|
||||
[BindColumn("KindName", "栏目名称", "")]
|
||||
public String KindName { get { return _KindName; } set { if (OnPropertyChanging(__.KindName, value)) { _KindName = value; OnPropertyChanged(__.KindName); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
@@ -36,7 +36,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目副标题")]
|
||||
[Description("栏目副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "栏目副标题", "nvarchar(250)")]
|
||||
[BindColumn("SubTitle", "栏目副标题", "")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
|
||||
private String _KindTitle;
|
||||
@@ -44,7 +44,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目标题")]
|
||||
[Description("栏目标题,填写则在浏览器替换此标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "nvarchar(250)")]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "")]
|
||||
public String KindTitle { get { return _KindTitle; } set { if (OnPropertyChanging(__.KindTitle, value)) { _KindTitle = value; OnPropertyChanged(__.KindTitle); } } }
|
||||
|
||||
private String _Keyword;
|
||||
@@ -52,7 +52,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("描述")]
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "nvarchar(250)")]
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
|
||||
private String _Description;
|
||||
@@ -60,7 +60,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("介绍")]
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "nvarchar(250)")]
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
@@ -68,7 +68,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("跳转链接")]
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "nvarchar(250)")]
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
@@ -76,7 +76,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别名称颜色")]
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "nvarchar(50)")]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
@@ -84,7 +84,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模板")]
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "nvarchar(250)")]
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
|
||||
private String _DetailTemplateFile;
|
||||
@@ -92,7 +92,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情模板")]
|
||||
[Description("详情模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "nvarchar(250)")]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "")]
|
||||
public String DetailTemplateFile { get { return _DetailTemplateFile; } set { if (OnPropertyChanging(__.DetailTemplateFile, value)) { _DetailTemplateFile = value; OnPropertyChanged(__.DetailTemplateFile); } } }
|
||||
|
||||
private String _KindDomain;
|
||||
@@ -100,7 +100,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别域名")]
|
||||
[Description("类别域名(保留)")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "nvarchar(250)")]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "")]
|
||||
public String KindDomain { get { return _KindDomain; } set { if (OnPropertyChanging(__.KindDomain, value)) { _KindDomain = value; OnPropertyChanged(__.KindDomain); } } }
|
||||
|
||||
private Int32 _IsList;
|
||||
@@ -108,7 +108,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否为列表页面")]
|
||||
[Description("是否为列表页面")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsList", "是否为列表页面", "int")]
|
||||
[BindColumn("IsList", "是否为列表页面", "")]
|
||||
public Int32 IsList { get { return _IsList; } set { if (OnPropertyChanging(__.IsList, value)) { _IsList = value; OnPropertyChanged(__.IsList); } } }
|
||||
|
||||
private Int32 _PageSize;
|
||||
@@ -116,7 +116,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("每页显示数量")]
|
||||
[Description("每页显示数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PageSize", "每页显示数量", "int")]
|
||||
[BindColumn("PageSize", "每页显示数量", "")]
|
||||
public Int32 PageSize { get { return _PageSize; } set { if (OnPropertyChanging(__.PageSize, value)) { _PageSize = value; OnPropertyChanged(__.PageSize); } } }
|
||||
|
||||
private Int32 _PId;
|
||||
@@ -124,7 +124,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("上级ID")]
|
||||
[Description("上级ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PId", "上级ID", "int")]
|
||||
[BindColumn("PId", "上级ID", "")]
|
||||
public Int32 PId { get { return _PId; } set { if (OnPropertyChanging(__.PId, value)) { _PId = value; OnPropertyChanged(__.PId); } } }
|
||||
|
||||
private Int32 _Level;
|
||||
@@ -132,7 +132,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("级别")]
|
||||
[Description("级别")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Level", "级别", "int")]
|
||||
[BindColumn("Level", "级别", "")]
|
||||
public Int32 Level { get { return _Level; } set { if (OnPropertyChanging(__.Level, value)) { _Level = value; OnPropertyChanged(__.Level); } } }
|
||||
|
||||
private String _Location;
|
||||
@@ -140,7 +140,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "nvarchar(100)")]
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
@@ -148,7 +148,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否隐藏")]
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "int")]
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
@@ -156,7 +156,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否锁定")]
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "int")]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
@@ -164,7 +164,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "int")]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
@@ -172,7 +172,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否允许评论")]
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "int")]
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
@@ -180,7 +180,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否会员栏目")]
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "int")]
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
|
||||
private Int32 _IsShowSubDetail;
|
||||
@@ -188,7 +188,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否显示下级栏目内容")]
|
||||
[Description("是否显示下级栏目内容")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "int")]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "")]
|
||||
public Int32 IsShowSubDetail { get { return _IsShowSubDetail; } set { if (OnPropertyChanging(__.IsShowSubDetail, value)) { _IsShowSubDetail = value; OnPropertyChanged(__.IsShowSubDetail); } } }
|
||||
|
||||
private Int32 _CatalogId;
|
||||
@@ -196,7 +196,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模型ID")]
|
||||
[Description("模型ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CatalogId", "模型ID", "int")]
|
||||
[BindColumn("CatalogId", "模型ID", "")]
|
||||
public Int32 CatalogId { get { return _CatalogId; } set { if (OnPropertyChanging(__.CatalogId, value)) { _CatalogId = value; OnPropertyChanged(__.CatalogId); } } }
|
||||
|
||||
private Int32 _Counts;
|
||||
@@ -204,7 +204,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情数量")]
|
||||
[Description("详情数量,缓存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Counts", "详情数量,缓存", "int")]
|
||||
[BindColumn("Counts", "详情数量,缓存", "")]
|
||||
public Int32 Counts { get { return _Counts; } set { if (OnPropertyChanging(__.Counts, value)) { _Counts = value; OnPropertyChanged(__.Counts); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
@@ -212,7 +212,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "int")]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _Rank; } set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
|
||||
private String _Icon;
|
||||
@@ -220,7 +220,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图标")]
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "nvarchar(100)")]
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
|
||||
private String _ClassName;
|
||||
@@ -228,7 +228,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("样式名称")]
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "nvarchar(50)")]
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
@@ -236,7 +236,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("banner图片")]
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "nvarchar(250)")]
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
|
||||
private String _KindInfo;
|
||||
@@ -244,7 +244,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目详细介绍")]
|
||||
[Description("栏目详细介绍")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "ntext")]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "")]
|
||||
public String KindInfo { get { return _KindInfo; } set { if (OnPropertyChanging(__.KindInfo, value)) { _KindInfo = value; OnPropertyChanged(__.KindInfo); } } }
|
||||
|
||||
private String _Pic;
|
||||
@@ -252,7 +252,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "nvarchar(250)")]
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
@@ -260,8 +260,16 @@ namespace COMCMS.Core
|
||||
[DisplayName("广告ID")]
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "int")]
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
|
||||
private String _FilePath;
|
||||
/// <summary>目录路径</summary>
|
||||
[DisplayName("目录路径")]
|
||||
[Description("目录路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("FilePath", "目录路径", "")]
|
||||
public String FilePath { get { return _FilePath; } set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -305,6 +313,7 @@ namespace COMCMS.Core
|
||||
case __.KindInfo : return _KindInfo;
|
||||
case __.Pic : return _Pic;
|
||||
case __.AdsId : return _AdsId;
|
||||
case __.FilePath : return _FilePath;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -312,7 +321,7 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(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;
|
||||
@@ -323,26 +332,27 @@ namespace COMCMS.Core
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.DetailTemplateFile : _DetailTemplateFile = Convert.ToString(value); break;
|
||||
case __.KindDomain : _KindDomain = Convert.ToString(value); break;
|
||||
case __.IsList : _IsList = Convert.ToInt32(value); break;
|
||||
case __.PageSize : _PageSize = Convert.ToInt32(value); break;
|
||||
case __.PId : _PId = Convert.ToInt32(value); break;
|
||||
case __.Level : _Level = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.IsLock : _IsLock = Convert.ToInt32(value); break;
|
||||
case __.IsDel : _IsDel = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsMember : _IsMember = Convert.ToInt32(value); break;
|
||||
case __.IsShowSubDetail : _IsShowSubDetail = Convert.ToInt32(value); break;
|
||||
case __.CatalogId : _CatalogId = Convert.ToInt32(value); break;
|
||||
case __.Counts : _Counts = Convert.ToInt32(value); break;
|
||||
case __.Rank : _Rank = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.AdsId : _AdsId = value.ToInt(); break;
|
||||
case __.FilePath : _FilePath = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -446,6 +456,9 @@ namespace COMCMS.Core
|
||||
/// <summary>广告ID</summary>
|
||||
public static readonly Field AdsId = FindByName(__.AdsId);
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public static readonly Field FilePath = FindByName(__.FilePath);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
@@ -544,6 +557,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
public const String AdsId = "AdsId";
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public const String FilePath = "FilePath";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -644,6 +660,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
Int32 AdsId { get; set; }
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
String FilePath { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NewLife.XCode" Version="9.9.6881.41312" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.1212" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COMCMS.Common\COMCMS.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies">
|
||||
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace COMCMS.Core
|
||||
{
|
||||
Ads model = new Ads();
|
||||
model = Find(_.Id == aid);
|
||||
if (model.TId == 4)
|
||||
if (model!=null && model.TId == 4)
|
||||
{
|
||||
List<ImgAds> listimg = new List<ImgAds>();
|
||||
listimg = JsonConvert.DeserializeObject<List<ImgAds>>(model.Content);
|
||||
|
||||
+20
-20
@@ -184,8 +184,8 @@ namespace COMCMS.Core
|
||||
{
|
||||
if (IsAdminLogin())
|
||||
{
|
||||
//return Find(_.UserName == SessionHelper.GetSession(sessionAdminNameKey).ToString());
|
||||
return Find(_.UserName == AuthenticationHelper.GetClaim(sessionAdminNameKey));
|
||||
return Find(_.UserName == SessionHelper.GetSession(sessionAdminNameKey).ToString());
|
||||
//return Find(_.UserName == AuthenticationHelper.GetClaim(sessionAdminNameKey));
|
||||
|
||||
}
|
||||
else
|
||||
@@ -241,8 +241,8 @@ namespace COMCMS.Core
|
||||
//写入Session 和 Cookies
|
||||
//SessionHelper.WriteSession("rtadminguid", GUID.ToString());
|
||||
//CookiesHelper.WriteCookie("rtadminguid", GUID.ToString(), 120);
|
||||
//SetAdminInfo(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt);
|
||||
SetAdminInfoAsync(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt).Wait();
|
||||
SetAdminInfo(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt);
|
||||
//SetAdminInfoAsync(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt).Wait();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -255,22 +255,22 @@ namespace COMCMS.Core
|
||||
/// <returns>是否登录</returns>
|
||||
public static bool IsAdminLogin()
|
||||
{
|
||||
//string adminName = SessionHelper.GetSession(sessionAdminNameKey).ToString();//用户名
|
||||
//string adminID = SessionHelper.GetSession(sessionAdminIDKey).ToString();//ID
|
||||
string adminName = AuthenticationHelper.GetClaim(sessionAdminNameKey);//用户名
|
||||
string adminID = AuthenticationHelper.GetClaim(sessionAdminIDKey);//ID
|
||||
string adminName = SessionHelper.GetSession(sessionAdminNameKey).ToString();//用户名
|
||||
string adminID = SessionHelper.GetSession(sessionAdminIDKey).ToString();//ID
|
||||
//string adminName = AuthenticationHelper.GetClaim(sessionAdminNameKey);//用户名
|
||||
//string adminID = AuthenticationHelper.GetClaim(sessionAdminIDKey);//ID
|
||||
|
||||
//如果Session失效,则用Cookies判断
|
||||
if (string.IsNullOrEmpty(adminName) || string.IsNullOrEmpty(adminID))
|
||||
{
|
||||
//string cooAdminName = CookiesHelper.GetCookie(cookiesAdminNameKey);//用户名
|
||||
//string cooAdminID = CookiesHelper.GetCookie(cookiesAdminIDKey);//ID
|
||||
//string cooLoginInfo = CookiesHelper.GetCookie(cookiesAdminInfoKey);//信息
|
||||
//string cooAdminLogID = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
||||
string cooAdminName = AuthenticationHelper.GetClaim(cookiesAdminNameKey);//用户名
|
||||
string cooAdminID = AuthenticationHelper.GetClaim(cookiesAdminIDKey);//ID
|
||||
string cooLoginInfo = AuthenticationHelper.GetClaim(cookiesAdminInfoKey);//信息
|
||||
string cooAdminLogID = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
||||
string cooAdminName = CookiesHelper.GetCookie(cookiesAdminNameKey);//用户名
|
||||
string cooAdminID = CookiesHelper.GetCookie(cookiesAdminIDKey);//ID
|
||||
string cooLoginInfo = CookiesHelper.GetCookie(cookiesAdminInfoKey);//信息
|
||||
string cooAdminLogID = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
||||
//string cooAdminName = AuthenticationHelper.GetClaim(cookiesAdminNameKey);//用户名
|
||||
//string cooAdminID = AuthenticationHelper.GetClaim(cookiesAdminIDKey);//ID
|
||||
//string cooLoginInfo = AuthenticationHelper.GetClaim(cookiesAdminInfoKey);//信息
|
||||
//string cooAdminLogID = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
||||
|
||||
if (string.IsNullOrEmpty(cooAdminID) || string.IsNullOrEmpty(cooAdminName) || string.IsNullOrEmpty(cooLoginInfo) || string.IsNullOrEmpty(cooAdminLogID))
|
||||
{
|
||||
@@ -298,16 +298,16 @@ namespace COMCMS.Core
|
||||
}
|
||||
|
||||
//重新写入Session 和 Cookies
|
||||
//SetAdminInfo(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt);
|
||||
SetAdminInfo(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt);
|
||||
|
||||
SetAdminInfoAsync(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt).Wait();
|
||||
//SetAdminInfoAsync(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt).Wait();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//ClearInfo();//清除信息
|
||||
ClearInfoAsync().Wait();
|
||||
ClearInfo();//清除信息
|
||||
//ClearInfoAsync().Wait();
|
||||
return false;//信息错误
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,22 @@ namespace COMCMS.Core
|
||||
|
||||
return Find(_.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>根据目录查找</summary>
|
||||
/// <param name="path">目录</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static Category FindByFilePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
|
||||
// 实体缓存
|
||||
if (Meta.Count < 1000) return Meta.Cache.Find(e => e.FilePath == path);
|
||||
|
||||
// 单对象缓存
|
||||
//return Meta.SingleCache[id];
|
||||
|
||||
return Find(_.FilePath == path);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据父ID查询所有子项
|
||||
/// </summary>
|
||||
|
||||
+65
-46
@@ -20,7 +20,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _KindName;
|
||||
@@ -28,7 +28,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目名称")]
|
||||
[Description("栏目名称")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindName", "栏目名称", "nvarchar(250)")]
|
||||
[BindColumn("KindName", "栏目名称", "")]
|
||||
public String KindName { get { return _KindName; } set { if (OnPropertyChanging(__.KindName, value)) { _KindName = value; OnPropertyChanged(__.KindName); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
@@ -36,7 +36,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目副标题")]
|
||||
[Description("栏目副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "栏目副标题", "nvarchar(250)")]
|
||||
[BindColumn("SubTitle", "栏目副标题", "")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
|
||||
private String _KindTitle;
|
||||
@@ -44,7 +44,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目标题")]
|
||||
[Description("栏目标题,填写则在浏览器替换此标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "nvarchar(250)")]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "")]
|
||||
public String KindTitle { get { return _KindTitle; } set { if (OnPropertyChanging(__.KindTitle, value)) { _KindTitle = value; OnPropertyChanged(__.KindTitle); } } }
|
||||
|
||||
private String _Keyword;
|
||||
@@ -52,7 +52,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("描述")]
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "nvarchar(250)")]
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
|
||||
private String _Description;
|
||||
@@ -60,7 +60,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("介绍")]
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "nvarchar(250)")]
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
@@ -68,7 +68,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("跳转链接")]
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "nvarchar(250)")]
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
@@ -76,7 +76,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别名称颜色")]
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "nvarchar(50)")]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
@@ -84,7 +84,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模板")]
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "nvarchar(250)")]
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
|
||||
private String _DetailTemplateFile;
|
||||
@@ -92,7 +92,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情模板")]
|
||||
[Description("详情模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "nvarchar(250)")]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "")]
|
||||
public String DetailTemplateFile { get { return _DetailTemplateFile; } set { if (OnPropertyChanging(__.DetailTemplateFile, value)) { _DetailTemplateFile = value; OnPropertyChanged(__.DetailTemplateFile); } } }
|
||||
|
||||
private String _KindDomain;
|
||||
@@ -100,7 +100,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别域名")]
|
||||
[Description("类别域名(保留)")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "nvarchar(250)")]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "")]
|
||||
public String KindDomain { get { return _KindDomain; } set { if (OnPropertyChanging(__.KindDomain, value)) { _KindDomain = value; OnPropertyChanged(__.KindDomain); } } }
|
||||
|
||||
private Int32 _IsList;
|
||||
@@ -108,7 +108,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否为列表页面")]
|
||||
[Description("是否为列表页面")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsList", "是否为列表页面", "int")]
|
||||
[BindColumn("IsList", "是否为列表页面", "")]
|
||||
public Int32 IsList { get { return _IsList; } set { if (OnPropertyChanging(__.IsList, value)) { _IsList = value; OnPropertyChanged(__.IsList); } } }
|
||||
|
||||
private Int32 _PageSize;
|
||||
@@ -116,7 +116,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("每页显示数量")]
|
||||
[Description("每页显示数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PageSize", "每页显示数量", "int")]
|
||||
[BindColumn("PageSize", "每页显示数量", "")]
|
||||
public Int32 PageSize { get { return _PageSize; } set { if (OnPropertyChanging(__.PageSize, value)) { _PageSize = value; OnPropertyChanged(__.PageSize); } } }
|
||||
|
||||
private Int32 _PId;
|
||||
@@ -124,7 +124,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("上级ID")]
|
||||
[Description("上级ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PId", "上级ID", "int")]
|
||||
[BindColumn("PId", "上级ID", "")]
|
||||
public Int32 PId { get { return _PId; } set { if (OnPropertyChanging(__.PId, value)) { _PId = value; OnPropertyChanged(__.PId); } } }
|
||||
|
||||
private Int32 _Level;
|
||||
@@ -132,7 +132,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("级别")]
|
||||
[Description("级别")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Level", "级别", "int")]
|
||||
[BindColumn("Level", "级别", "")]
|
||||
public Int32 Level { get { return _Level; } set { if (OnPropertyChanging(__.Level, value)) { _Level = value; OnPropertyChanged(__.Level); } } }
|
||||
|
||||
private String _Location;
|
||||
@@ -140,7 +140,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "nvarchar(100)")]
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
@@ -148,7 +148,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否隐藏")]
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "int")]
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
@@ -156,7 +156,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否锁定")]
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "int")]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
@@ -164,7 +164,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "int")]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
@@ -172,7 +172,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否允许评论")]
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "int")]
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
@@ -180,7 +180,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否会员栏目")]
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "int")]
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
|
||||
private Int32 _IsShowSubDetail;
|
||||
@@ -188,7 +188,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否显示下级栏目内容")]
|
||||
[Description("是否显示下级栏目内容")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "int")]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "")]
|
||||
public Int32 IsShowSubDetail { get { return _IsShowSubDetail; } set { if (OnPropertyChanging(__.IsShowSubDetail, value)) { _IsShowSubDetail = value; OnPropertyChanged(__.IsShowSubDetail); } } }
|
||||
|
||||
private Int32 _CatalogId;
|
||||
@@ -196,7 +196,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模型ID")]
|
||||
[Description("模型ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CatalogId", "模型ID", "int")]
|
||||
[BindColumn("CatalogId", "模型ID", "")]
|
||||
public Int32 CatalogId { get { return _CatalogId; } set { if (OnPropertyChanging(__.CatalogId, value)) { _CatalogId = value; OnPropertyChanged(__.CatalogId); } } }
|
||||
|
||||
private Int32 _Counts;
|
||||
@@ -204,7 +204,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情数量")]
|
||||
[Description("详情数量,缓存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Counts", "详情数量,缓存", "int")]
|
||||
[BindColumn("Counts", "详情数量,缓存", "")]
|
||||
public Int32 Counts { get { return _Counts; } set { if (OnPropertyChanging(__.Counts, value)) { _Counts = value; OnPropertyChanged(__.Counts); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
@@ -212,7 +212,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "int")]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _Rank; } set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
|
||||
private String _Icon;
|
||||
@@ -220,7 +220,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图标")]
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "nvarchar(100)")]
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
|
||||
private String _ClassName;
|
||||
@@ -228,7 +228,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("样式名称")]
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "nvarchar(50)")]
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
@@ -236,7 +236,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("banner图片")]
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "nvarchar(250)")]
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
|
||||
private String _KindInfo;
|
||||
@@ -244,7 +244,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目详细介绍")]
|
||||
[Description("栏目详细介绍")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "ntext")]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "")]
|
||||
public String KindInfo { get { return _KindInfo; } set { if (OnPropertyChanging(__.KindInfo, value)) { _KindInfo = value; OnPropertyChanged(__.KindInfo); } } }
|
||||
|
||||
private String _Pic;
|
||||
@@ -252,7 +252,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "nvarchar(250)")]
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
@@ -260,8 +260,16 @@ namespace COMCMS.Core
|
||||
[DisplayName("广告ID")]
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "int")]
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
|
||||
private String _FilePath;
|
||||
/// <summary>目录路径</summary>
|
||||
[DisplayName("目录路径")]
|
||||
[Description("目录路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("FilePath", "目录路径", "")]
|
||||
public String FilePath { get { return _FilePath; } set { if (OnPropertyChanging(__.FilePath, value)) { _FilePath = value; OnPropertyChanged(__.FilePath); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -305,6 +313,7 @@ namespace COMCMS.Core
|
||||
case __.KindInfo : return _KindInfo;
|
||||
case __.Pic : return _Pic;
|
||||
case __.AdsId : return _AdsId;
|
||||
case __.FilePath : return _FilePath;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -312,7 +321,7 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(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;
|
||||
@@ -323,26 +332,27 @@ namespace COMCMS.Core
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.DetailTemplateFile : _DetailTemplateFile = Convert.ToString(value); break;
|
||||
case __.KindDomain : _KindDomain = Convert.ToString(value); break;
|
||||
case __.IsList : _IsList = Convert.ToInt32(value); break;
|
||||
case __.PageSize : _PageSize = Convert.ToInt32(value); break;
|
||||
case __.PId : _PId = Convert.ToInt32(value); break;
|
||||
case __.Level : _Level = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.IsLock : _IsLock = Convert.ToInt32(value); break;
|
||||
case __.IsDel : _IsDel = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsMember : _IsMember = Convert.ToInt32(value); break;
|
||||
case __.IsShowSubDetail : _IsShowSubDetail = Convert.ToInt32(value); break;
|
||||
case __.CatalogId : _CatalogId = Convert.ToInt32(value); break;
|
||||
case __.Counts : _Counts = Convert.ToInt32(value); break;
|
||||
case __.Rank : _Rank = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.AdsId : _AdsId = value.ToInt(); break;
|
||||
case __.FilePath : _FilePath = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -446,6 +456,9 @@ namespace COMCMS.Core
|
||||
/// <summary>广告ID</summary>
|
||||
public static readonly Field AdsId = FindByName(__.AdsId);
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public static readonly Field FilePath = FindByName(__.FilePath);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
@@ -544,6 +557,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
public const String AdsId = "AdsId";
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
public const String FilePath = "FilePath";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -644,6 +660,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>广告ID</summary>
|
||||
Int32 AdsId { get; set; }
|
||||
|
||||
/// <summary>目录路径</summary>
|
||||
String FilePath { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
+46
-46
@@ -20,7 +20,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int")]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _KindName;
|
||||
@@ -28,7 +28,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目名称")]
|
||||
[Description("栏目名称")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindName", "栏目名称", "nvarchar(250)")]
|
||||
[BindColumn("KindName", "栏目名称", "")]
|
||||
public String KindName { get { return _KindName; } set { if (OnPropertyChanging(__.KindName, value)) { _KindName = value; OnPropertyChanged(__.KindName); } } }
|
||||
|
||||
private String _SubTitle;
|
||||
@@ -36,7 +36,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目副标题")]
|
||||
[Description("栏目副标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("SubTitle", "栏目副标题", "nvarchar(250)")]
|
||||
[BindColumn("SubTitle", "栏目副标题", "")]
|
||||
public String SubTitle { get { return _SubTitle; } set { if (OnPropertyChanging(__.SubTitle, value)) { _SubTitle = value; OnPropertyChanged(__.SubTitle); } } }
|
||||
|
||||
private String _KindTitle;
|
||||
@@ -44,7 +44,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目标题")]
|
||||
[Description("栏目标题,填写则在浏览器替换此标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "nvarchar(250)")]
|
||||
[BindColumn("KindTitle", "栏目标题,填写则在浏览器替换此标题", "")]
|
||||
public String KindTitle { get { return _KindTitle; } set { if (OnPropertyChanging(__.KindTitle, value)) { _KindTitle = value; OnPropertyChanged(__.KindTitle); } } }
|
||||
|
||||
private String _Keyword;
|
||||
@@ -52,7 +52,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("描述")]
|
||||
[Description("描述")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Keyword", "描述", "nvarchar(250)")]
|
||||
[BindColumn("Keyword", "描述", "")]
|
||||
public String Keyword { get { return _Keyword; } set { if (OnPropertyChanging(__.Keyword, value)) { _Keyword = value; OnPropertyChanged(__.Keyword); } } }
|
||||
|
||||
private String _Description;
|
||||
@@ -60,7 +60,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("介绍")]
|
||||
[Description("介绍")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Description", "介绍", "nvarchar(250)")]
|
||||
[BindColumn("Description", "介绍", "")]
|
||||
public String Description { get { return _Description; } set { if (OnPropertyChanging(__.Description, value)) { _Description = value; OnPropertyChanged(__.Description); } } }
|
||||
|
||||
private String _LinkURL;
|
||||
@@ -68,7 +68,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("跳转链接")]
|
||||
[Description("跳转链接")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkURL", "跳转链接", "nvarchar(250)")]
|
||||
[BindColumn("LinkURL", "跳转链接", "")]
|
||||
public String LinkURL { get { return _LinkURL; } set { if (OnPropertyChanging(__.LinkURL, value)) { _LinkURL = value; OnPropertyChanged(__.LinkURL); } } }
|
||||
|
||||
private String _TitleColor;
|
||||
@@ -76,7 +76,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别名称颜色")]
|
||||
[Description("类别名称颜色")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "nvarchar(50)")]
|
||||
[BindColumn("TitleColor", "类别名称颜色", "")]
|
||||
public String TitleColor { get { return _TitleColor; } set { if (OnPropertyChanging(__.TitleColor, value)) { _TitleColor = value; OnPropertyChanged(__.TitleColor); } } }
|
||||
|
||||
private String _TemplateFile;
|
||||
@@ -84,7 +84,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模板")]
|
||||
[Description("模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("TemplateFile", "模板", "nvarchar(250)")]
|
||||
[BindColumn("TemplateFile", "模板", "")]
|
||||
public String TemplateFile { get { return _TemplateFile; } set { if (OnPropertyChanging(__.TemplateFile, value)) { _TemplateFile = value; OnPropertyChanged(__.TemplateFile); } } }
|
||||
|
||||
private String _DetailTemplateFile;
|
||||
@@ -92,7 +92,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情模板")]
|
||||
[Description("详情模板")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "nvarchar(250)")]
|
||||
[BindColumn("DetailTemplateFile", "详情模板", "")]
|
||||
public String DetailTemplateFile { get { return _DetailTemplateFile; } set { if (OnPropertyChanging(__.DetailTemplateFile, value)) { _DetailTemplateFile = value; OnPropertyChanged(__.DetailTemplateFile); } } }
|
||||
|
||||
private String _KindDomain;
|
||||
@@ -100,7 +100,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("类别域名")]
|
||||
[Description("类别域名(保留)")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "nvarchar(250)")]
|
||||
[BindColumn("KindDomain", "类别域名(保留)", "")]
|
||||
public String KindDomain { get { return _KindDomain; } set { if (OnPropertyChanging(__.KindDomain, value)) { _KindDomain = value; OnPropertyChanged(__.KindDomain); } } }
|
||||
|
||||
private Int32 _IsList;
|
||||
@@ -108,7 +108,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否为列表页面")]
|
||||
[Description("是否为列表页面")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsList", "是否为列表页面", "int")]
|
||||
[BindColumn("IsList", "是否为列表页面", "")]
|
||||
public Int32 IsList { get { return _IsList; } set { if (OnPropertyChanging(__.IsList, value)) { _IsList = value; OnPropertyChanged(__.IsList); } } }
|
||||
|
||||
private Int32 _PageSize;
|
||||
@@ -116,7 +116,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("每页显示数量")]
|
||||
[Description("每页显示数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PageSize", "每页显示数量", "int")]
|
||||
[BindColumn("PageSize", "每页显示数量", "")]
|
||||
public Int32 PageSize { get { return _PageSize; } set { if (OnPropertyChanging(__.PageSize, value)) { _PageSize = value; OnPropertyChanged(__.PageSize); } } }
|
||||
|
||||
private Int32 _PId;
|
||||
@@ -124,7 +124,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("上级ID")]
|
||||
[Description("上级ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PId", "上级ID", "int")]
|
||||
[BindColumn("PId", "上级ID", "")]
|
||||
public Int32 PId { get { return _PId; } set { if (OnPropertyChanging(__.PId, value)) { _PId = value; OnPropertyChanged(__.PId); } } }
|
||||
|
||||
private Int32 _Level;
|
||||
@@ -132,7 +132,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("级别")]
|
||||
[Description("级别")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Level", "级别", "int")]
|
||||
[BindColumn("Level", "级别", "")]
|
||||
public Int32 Level { get { return _Level; } set { if (OnPropertyChanging(__.Level, value)) { _Level = value; OnPropertyChanged(__.Level); } } }
|
||||
|
||||
private String _Location;
|
||||
@@ -140,7 +140,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("路径")]
|
||||
[Description("路径")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Location", "路径", "nvarchar(100)")]
|
||||
[BindColumn("Location", "路径", "")]
|
||||
public String Location { get { return _Location; } set { if (OnPropertyChanging(__.Location, value)) { _Location = value; OnPropertyChanged(__.Location); } } }
|
||||
|
||||
private Int32 _IsHide;
|
||||
@@ -148,7 +148,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否隐藏")]
|
||||
[Description("是否隐藏")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsHide", "是否隐藏", "int")]
|
||||
[BindColumn("IsHide", "是否隐藏", "")]
|
||||
public Int32 IsHide { get { return _IsHide; } set { if (OnPropertyChanging(__.IsHide, value)) { _IsHide = value; OnPropertyChanged(__.IsHide); } } }
|
||||
|
||||
private Int32 _IsLock;
|
||||
@@ -156,7 +156,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否锁定")]
|
||||
[Description("是否锁定,不允许删除")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "int")]
|
||||
[BindColumn("IsLock", "是否锁定,不允许删除", "")]
|
||||
public Int32 IsLock { get { return _IsLock; } set { if (OnPropertyChanging(__.IsLock, value)) { _IsLock = value; OnPropertyChanged(__.IsLock); } } }
|
||||
|
||||
private Int32 _IsDel;
|
||||
@@ -164,7 +164,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否删除")]
|
||||
[Description("是否删除,已经删除到回收站")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "int")]
|
||||
[BindColumn("IsDel", "是否删除,已经删除到回收站", "")]
|
||||
public Int32 IsDel { get { return _IsDel; } set { if (OnPropertyChanging(__.IsDel, value)) { _IsDel = value; OnPropertyChanged(__.IsDel); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
@@ -172,7 +172,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否允许评论")]
|
||||
[Description("是否允许评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "是否允许评论", "int")]
|
||||
[BindColumn("IsComment", "是否允许评论", "")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private Int32 _IsMember;
|
||||
@@ -180,7 +180,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否会员栏目")]
|
||||
[Description("是否会员栏目")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsMember", "是否会员栏目", "int")]
|
||||
[BindColumn("IsMember", "是否会员栏目", "")]
|
||||
public Int32 IsMember { get { return _IsMember; } set { if (OnPropertyChanging(__.IsMember, value)) { _IsMember = value; OnPropertyChanged(__.IsMember); } } }
|
||||
|
||||
private Int32 _IsShowSubDetail;
|
||||
@@ -188,7 +188,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否显示下级栏目内容")]
|
||||
[Description("是否显示下级栏目内容")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "int")]
|
||||
[BindColumn("IsShowSubDetail", "是否显示下级栏目内容", "")]
|
||||
public Int32 IsShowSubDetail { get { return _IsShowSubDetail; } set { if (OnPropertyChanging(__.IsShowSubDetail, value)) { _IsShowSubDetail = value; OnPropertyChanged(__.IsShowSubDetail); } } }
|
||||
|
||||
private Int32 _CatalogId;
|
||||
@@ -196,7 +196,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("模型ID")]
|
||||
[Description("模型ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("CatalogId", "模型ID", "int")]
|
||||
[BindColumn("CatalogId", "模型ID", "")]
|
||||
public Int32 CatalogId { get { return _CatalogId; } set { if (OnPropertyChanging(__.CatalogId, value)) { _CatalogId = value; OnPropertyChanged(__.CatalogId); } } }
|
||||
|
||||
private Int32 _Counts;
|
||||
@@ -204,7 +204,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详情数量")]
|
||||
[Description("详情数量,缓存")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Counts", "详情数量,缓存", "int")]
|
||||
[BindColumn("Counts", "详情数量,缓存", "")]
|
||||
public Int32 Counts { get { return _Counts; } set { if (OnPropertyChanging(__.Counts, value)) { _Counts = value; OnPropertyChanged(__.Counts); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
@@ -212,7 +212,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "int")]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _Rank; } set { if (OnPropertyChanging(__.Rank, value)) { _Rank = value; OnPropertyChanged(__.Rank); } } }
|
||||
|
||||
private String _Icon;
|
||||
@@ -220,7 +220,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图标")]
|
||||
[Description("图标")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Icon", "图标", "nvarchar(100)")]
|
||||
[BindColumn("Icon", "图标", "")]
|
||||
public String Icon { get { return _Icon; } set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
|
||||
|
||||
private String _ClassName;
|
||||
@@ -228,7 +228,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("样式名称")]
|
||||
[Description("样式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ClassName", "样式名称", "nvarchar(50)")]
|
||||
[BindColumn("ClassName", "样式名称", "")]
|
||||
public String ClassName { get { return _ClassName; } set { if (OnPropertyChanging(__.ClassName, value)) { _ClassName = value; OnPropertyChanged(__.ClassName); } } }
|
||||
|
||||
private String _BannerImg;
|
||||
@@ -236,7 +236,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("banner图片")]
|
||||
[Description("banner图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("BannerImg", "banner图片", "nvarchar(250)")]
|
||||
[BindColumn("BannerImg", "banner图片", "")]
|
||||
public String BannerImg { get { return _BannerImg; } set { if (OnPropertyChanging(__.BannerImg, value)) { _BannerImg = value; OnPropertyChanged(__.BannerImg); } } }
|
||||
|
||||
private String _KindInfo;
|
||||
@@ -244,7 +244,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("栏目详细介绍")]
|
||||
[Description("栏目详细介绍")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "ntext")]
|
||||
[BindColumn("KindInfo", "栏目详细介绍", "")]
|
||||
public String KindInfo { get { return _KindInfo; } set { if (OnPropertyChanging(__.KindInfo, value)) { _KindInfo = value; OnPropertyChanged(__.KindInfo); } } }
|
||||
|
||||
private String _Pic;
|
||||
@@ -252,7 +252,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Pic", "图片", "nvarchar(250)")]
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _AdsId;
|
||||
@@ -260,7 +260,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("广告ID")]
|
||||
[Description("广告ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("AdsId", "广告ID", "int")]
|
||||
[BindColumn("AdsId", "广告ID", "")]
|
||||
public Int32 AdsId { get { return _AdsId; } set { if (OnPropertyChanging(__.AdsId, value)) { _AdsId = value; OnPropertyChanged(__.AdsId); } } }
|
||||
#endregion
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(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;
|
||||
@@ -323,26 +323,26 @@ namespace COMCMS.Core
|
||||
case __.TemplateFile : _TemplateFile = Convert.ToString(value); break;
|
||||
case __.DetailTemplateFile : _DetailTemplateFile = Convert.ToString(value); break;
|
||||
case __.KindDomain : _KindDomain = Convert.ToString(value); break;
|
||||
case __.IsList : _IsList = Convert.ToInt32(value); break;
|
||||
case __.PageSize : _PageSize = Convert.ToInt32(value); break;
|
||||
case __.PId : _PId = Convert.ToInt32(value); break;
|
||||
case __.Level : _Level = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.IsLock : _IsLock = Convert.ToInt32(value); break;
|
||||
case __.IsDel : _IsDel = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsMember : _IsMember = Convert.ToInt32(value); break;
|
||||
case __.IsShowSubDetail : _IsShowSubDetail = Convert.ToInt32(value); break;
|
||||
case __.CatalogId : _CatalogId = Convert.ToInt32(value); break;
|
||||
case __.Counts : _Counts = Convert.ToInt32(value); break;
|
||||
case __.Rank : _Rank = Convert.ToInt32(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 = Convert.ToInt32(value); break;
|
||||
case __.AdsId : _AdsId = value.ToInt(); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
|
||||
+57
-38
@@ -20,7 +20,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int", Master = true)]
|
||||
[BindColumn("Id", "编号", "", Master = true)]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _PayOrderNum;
|
||||
@@ -28,7 +28,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("在线支付订单号")]
|
||||
[Description("在线支付订单号,唯一")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("PayOrderNum", "在线支付订单号,唯一", "nvarchar(50)")]
|
||||
[BindColumn("PayOrderNum", "在线支付订单号,唯一", "")]
|
||||
public String PayOrderNum { get { return _PayOrderNum; } set { if (OnPropertyChanging(__.PayOrderNum, value)) { _PayOrderNum = value; OnPropertyChanged(__.PayOrderNum); } } }
|
||||
|
||||
private Int32 _OrderId;
|
||||
@@ -36,7 +36,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单ID")]
|
||||
[Description("订单ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("OrderId", "订单ID", "int")]
|
||||
[BindColumn("OrderId", "订单ID", "")]
|
||||
public Int32 OrderId { get { return _OrderId; } set { if (OnPropertyChanging(__.OrderId, value)) { _OrderId = value; OnPropertyChanged(__.OrderId); } } }
|
||||
|
||||
private String _OrderNum;
|
||||
@@ -44,7 +44,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单号")]
|
||||
[Description("订单号")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("OrderNum", "订单号", "nvarchar(50)")]
|
||||
[BindColumn("OrderNum", "订单号", "")]
|
||||
public String OrderNum { get { return _OrderNum; } set { if (OnPropertyChanging(__.OrderNum, value)) { _OrderNum = value; OnPropertyChanged(__.OrderNum); } } }
|
||||
|
||||
private Int32 _PayId;
|
||||
@@ -52,7 +52,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付方式ID")]
|
||||
[Description("支付方式ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PayId", "支付方式ID", "int")]
|
||||
[BindColumn("PayId", "支付方式ID", "")]
|
||||
public Int32 PayId { get { return _PayId; } set { if (OnPropertyChanging(__.PayId, value)) { _PayId = value; OnPropertyChanged(__.PayId); } } }
|
||||
|
||||
private String _PayType;
|
||||
@@ -60,7 +60,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("付款方式")]
|
||||
[Description("付款方式")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("PayType", "付款方式", "nvarchar(50)")]
|
||||
[BindColumn("PayType", "付款方式", "")]
|
||||
public String PayType { get { return _PayType; } set { if (OnPropertyChanging(__.PayType, value)) { _PayType = value; OnPropertyChanged(__.PayType); } } }
|
||||
|
||||
private String _PayTypeNotes;
|
||||
@@ -68,7 +68,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付备注")]
|
||||
[Description("支付备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("PayTypeNotes", "支付备注", "nvarchar(250)")]
|
||||
[BindColumn("PayTypeNotes", "支付备注", "")]
|
||||
public String PayTypeNotes { get { return _PayTypeNotes; } set { if (OnPropertyChanging(__.PayTypeNotes, value)) { _PayTypeNotes = value; OnPropertyChanged(__.PayTypeNotes); } } }
|
||||
|
||||
private String _Actions;
|
||||
@@ -76,7 +76,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("日志记录")]
|
||||
[Description("日志记录")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Actions", "日志记录", "nvarchar(200)")]
|
||||
[BindColumn("Actions", "日志记录", "")]
|
||||
public String Actions { get { return _Actions; } set { if (OnPropertyChanging(__.Actions, value)) { _Actions = value; OnPropertyChanged(__.Actions); } } }
|
||||
|
||||
private Int32 _UId;
|
||||
@@ -84,7 +84,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("用户ID")]
|
||||
[Description("用户ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UId", "用户ID", "int")]
|
||||
[BindColumn("UId", "用户ID", "")]
|
||||
public Int32 UId { get { return _UId; } set { if (OnPropertyChanging(__.UId, value)) { _UId = value; OnPropertyChanged(__.UId); } } }
|
||||
|
||||
private String _UserName;
|
||||
@@ -92,7 +92,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("用户名")]
|
||||
[Description("用户名")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UserName", "用户名", "nvarchar(50)")]
|
||||
[BindColumn("UserName", "用户名", "")]
|
||||
public String UserName { get { return _UserName; } set { if (OnPropertyChanging(__.UserName, value)) { _UserName = value; OnPropertyChanged(__.UserName); } } }
|
||||
|
||||
private Int32 _TotalQty;
|
||||
@@ -100,7 +100,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("总数量")]
|
||||
[Description("总数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalQty", "总数量", "int")]
|
||||
[BindColumn("TotalQty", "总数量", "")]
|
||||
public Int32 TotalQty { get { return _TotalQty; } set { if (OnPropertyChanging(__.TotalQty, value)) { _TotalQty = value; OnPropertyChanged(__.TotalQty); } } }
|
||||
|
||||
private Decimal _TotalPrice;
|
||||
@@ -108,7 +108,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("总价格")]
|
||||
[Description("总价格")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalPrice", "总价格", "money")]
|
||||
[BindColumn("TotalPrice", "总价格", "")]
|
||||
public Decimal TotalPrice { get { return _TotalPrice; } set { if (OnPropertyChanging(__.TotalPrice, value)) { _TotalPrice = value; OnPropertyChanged(__.TotalPrice); } } }
|
||||
|
||||
private String _PaymentStatus;
|
||||
@@ -116,7 +116,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付状态:未支付、已支付、已退款")]
|
||||
[Description("支付状态:未支付、已支付、已退款")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("PaymentStatus", "支付状态:未支付、已支付、已退款", "nvarchar(50)")]
|
||||
[BindColumn("PaymentStatus", "支付状态:未支付、已支付、已退款", "")]
|
||||
public String PaymentStatus { get { return _PaymentStatus; } set { if (OnPropertyChanging(__.PaymentStatus, value)) { _PaymentStatus = value; OnPropertyChanged(__.PaymentStatus); } } }
|
||||
|
||||
private String _PaymentNotes;
|
||||
@@ -124,7 +124,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付备注")]
|
||||
[Description("支付备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("PaymentNotes", "支付备注", "nvarchar(250)")]
|
||||
[BindColumn("PaymentNotes", "支付备注", "")]
|
||||
public String PaymentNotes { get { return _PaymentNotes; } set { if (OnPropertyChanging(__.PaymentNotes, value)) { _PaymentNotes = value; OnPropertyChanged(__.PaymentNotes); } } }
|
||||
|
||||
private Int32 _IsOK;
|
||||
@@ -132,23 +132,23 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否完成")]
|
||||
[Description("是否完成")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsOK", "是否完成", "int")]
|
||||
[BindColumn("IsOK", "是否完成", "")]
|
||||
public Int32 IsOK { get { return _IsOK; } set { if (OnPropertyChanging(__.IsOK, value)) { _IsOK = value; OnPropertyChanged(__.IsOK); } } }
|
||||
|
||||
private String _IP;
|
||||
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); } } }
|
||||
[BindColumn("Ip", "下单IP", "")]
|
||||
public String Ip { get { return _Ip; } set { if (OnPropertyChanging(__.Ip, value)) { _Ip = value; OnPropertyChanged(__.Ip); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
/// <summary>添加时间</summary>
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "datetime")]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private DateTime _ReceiveTime;
|
||||
@@ -156,7 +156,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("回传时间")]
|
||||
[Description("回传时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("ReceiveTime", "回传时间", "datetime")]
|
||||
[BindColumn("ReceiveTime", "回传时间", "")]
|
||||
public DateTime ReceiveTime { get { return _ReceiveTime; } set { if (OnPropertyChanging(__.ReceiveTime, value)) { _ReceiveTime = value; OnPropertyChanged(__.ReceiveTime); } } }
|
||||
|
||||
private Int32 _TypeId;
|
||||
@@ -164,7 +164,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付的类型")]
|
||||
[Description("支付的类型")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TypeId", "支付的类型", "int")]
|
||||
[BindColumn("TypeId", "支付的类型", "")]
|
||||
public Int32 TypeId { get { return _TypeId; } set { if (OnPropertyChanging(__.TypeId, value)) { _TypeId = value; OnPropertyChanged(__.TypeId); } } }
|
||||
|
||||
private Int32 _MyType;
|
||||
@@ -172,7 +172,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("系统类型")]
|
||||
[Description("系统类型")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("MyType", "系统类型", "int")]
|
||||
[BindColumn("MyType", "系统类型", "")]
|
||||
public Int32 MyType { get { return _MyType; } set { if (OnPropertyChanging(__.MyType, value)) { _MyType = value; OnPropertyChanged(__.MyType); } } }
|
||||
|
||||
private String _Title;
|
||||
@@ -180,8 +180,16 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单标题")]
|
||||
[Description("订单标题")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Title", "订单标题", "nvarchar(50)")]
|
||||
[BindColumn("Title", "订单标题", "")]
|
||||
public String Title { get { return _Title; } set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private String _OutTradeNo;
|
||||
/// <summary>支付成功流水号</summary>
|
||||
[DisplayName("支付成功流水号")]
|
||||
[Description("支付成功流水号")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("OutTradeNo", "支付成功流水号", "")]
|
||||
public String OutTradeNo { get { return _OutTradeNo; } set { if (OnPropertyChanging(__.OutTradeNo, value)) { _OutTradeNo = value; OnPropertyChanged(__.OutTradeNo); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -209,12 +217,13 @@ namespace COMCMS.Core
|
||||
case __.PaymentStatus : return _PaymentStatus;
|
||||
case __.PaymentNotes : return _PaymentNotes;
|
||||
case __.IsOK : return _IsOK;
|
||||
case __.IP : return _IP;
|
||||
case __.Ip : return _Ip;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.ReceiveTime : return _ReceiveTime;
|
||||
case __.TypeId : return _TypeId;
|
||||
case __.MyType : return _MyType;
|
||||
case __.Title : return _Title;
|
||||
case __.OutTradeNo : return _OutTradeNo;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -222,27 +231,28 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.PayOrderNum : _PayOrderNum = Convert.ToString(value); break;
|
||||
case __.OrderId : _OrderId = Convert.ToInt32(value); break;
|
||||
case __.OrderId : _OrderId = value.ToInt(); break;
|
||||
case __.OrderNum : _OrderNum = Convert.ToString(value); break;
|
||||
case __.PayId : _PayId = Convert.ToInt32(value); break;
|
||||
case __.PayId : _PayId = value.ToInt(); break;
|
||||
case __.PayType : _PayType = Convert.ToString(value); break;
|
||||
case __.PayTypeNotes : _PayTypeNotes = Convert.ToString(value); break;
|
||||
case __.Actions : _Actions = Convert.ToString(value); break;
|
||||
case __.UId : _UId = Convert.ToInt32(value); break;
|
||||
case __.UId : _UId = value.ToInt(); break;
|
||||
case __.UserName : _UserName = Convert.ToString(value); break;
|
||||
case __.TotalQty : _TotalQty = Convert.ToInt32(value); break;
|
||||
case __.TotalQty : _TotalQty = value.ToInt(); break;
|
||||
case __.TotalPrice : _TotalPrice = Convert.ToDecimal(value); break;
|
||||
case __.PaymentStatus : _PaymentStatus = Convert.ToString(value); break;
|
||||
case __.PaymentNotes : _PaymentNotes = Convert.ToString(value); break;
|
||||
case __.IsOK : _IsOK = Convert.ToInt32(value); break;
|
||||
case __.IP : _IP = Convert.ToString(value); break;
|
||||
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
|
||||
case __.ReceiveTime : _ReceiveTime = Convert.ToDateTime(value); break;
|
||||
case __.TypeId : _TypeId = Convert.ToInt32(value); break;
|
||||
case __.MyType : _MyType = Convert.ToInt32(value); break;
|
||||
case __.IsOK : _IsOK = value.ToInt(); break;
|
||||
case __.Ip : _Ip = Convert.ToString(value); break;
|
||||
case __.AddTime : _AddTime = value.ToDateTime(); break;
|
||||
case __.ReceiveTime : _ReceiveTime = value.ToDateTime(); break;
|
||||
case __.TypeId : _TypeId = value.ToInt(); break;
|
||||
case __.MyType : _MyType = value.ToInt(); break;
|
||||
case __.Title : _Title = Convert.ToString(value); break;
|
||||
case __.OutTradeNo : _OutTradeNo = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -299,7 +309,7 @@ namespace COMCMS.Core
|
||||
public static readonly Field IsOK = FindByName(__.IsOK);
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
public static readonly Field IP = FindByName(__.IP);
|
||||
public static readonly Field Ip = FindByName(__.Ip);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
@@ -316,6 +326,9 @@ namespace COMCMS.Core
|
||||
/// <summary>订单标题</summary>
|
||||
public static readonly Field Title = FindByName(__.Title);
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
public static readonly Field OutTradeNo = FindByName(__.OutTradeNo);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
@@ -368,7 +381,7 @@ namespace COMCMS.Core
|
||||
public const String IsOK = "IsOK";
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
public const String IP = "IP";
|
||||
public const String Ip = "Ip";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
@@ -384,6 +397,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>订单标题</summary>
|
||||
public const String Title = "Title";
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
public const String OutTradeNo = "OutTradeNo";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -438,7 +454,7 @@ namespace COMCMS.Core
|
||||
Int32 IsOK { get; set; }
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
String IP { get; set; }
|
||||
String Ip { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
@@ -454,6 +470,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>订单标题</summary>
|
||||
String Title { get; set; }
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
String OutTradeNo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
+99
-80
@@ -20,7 +20,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "int", Master = true)]
|
||||
[BindColumn("Id", "编号", "", Master = true)]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _OrderNum;
|
||||
@@ -28,7 +28,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单号")]
|
||||
[Description("订单号")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("OrderNum", "订单号", "nvarchar(50)")]
|
||||
[BindColumn("OrderNum", "订单号", "")]
|
||||
public String OrderNum { get { return _OrderNum; } set { if (OnPropertyChanging(__.OrderNum, value)) { _OrderNum = value; OnPropertyChanged(__.OrderNum); } } }
|
||||
|
||||
private Int32 _UId;
|
||||
@@ -36,7 +36,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("用户ID")]
|
||||
[Description("用户ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("UId", "用户ID", "int")]
|
||||
[BindColumn("UId", "用户ID", "")]
|
||||
public Int32 UId { get { return _UId; } set { if (OnPropertyChanging(__.UId, value)) { _UId = value; OnPropertyChanged(__.UId); } } }
|
||||
|
||||
private String _UserName;
|
||||
@@ -44,7 +44,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("下单用户名")]
|
||||
[Description("下单用户名")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("UserName", "下单用户名", "nvarchar(50)")]
|
||||
[BindColumn("UserName", "下单用户名", "")]
|
||||
public String UserName { get { return _UserName; } set { if (OnPropertyChanging(__.UserName, value)) { _UserName = value; OnPropertyChanged(__.UserName); } } }
|
||||
|
||||
private Int32 _ShopId;
|
||||
@@ -52,7 +52,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("商户ID")]
|
||||
[Description("商户ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ShopId", "商户ID", "int")]
|
||||
[BindColumn("ShopId", "商户ID", "")]
|
||||
public Int32 ShopId { get { return _ShopId; } set { if (OnPropertyChanging(__.ShopId, value)) { _ShopId = value; OnPropertyChanged(__.ShopId); } } }
|
||||
|
||||
private Int32 _Credit;
|
||||
@@ -60,7 +60,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("积分")]
|
||||
[Description("积分")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Credit", "积分", "int")]
|
||||
[BindColumn("Credit", "积分", "")]
|
||||
public Int32 Credit { get { return _Credit; } set { if (OnPropertyChanging(__.Credit, value)) { _Credit = value; OnPropertyChanged(__.Credit); } } }
|
||||
|
||||
private Int32 _TotalQty;
|
||||
@@ -68,7 +68,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("总数量")]
|
||||
[Description("总数量")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalQty", "总数量", "int")]
|
||||
[BindColumn("TotalQty", "总数量", "")]
|
||||
public Int32 TotalQty { get { return _TotalQty; } set { if (OnPropertyChanging(__.TotalQty, value)) { _TotalQty = value; OnPropertyChanged(__.TotalQty); } } }
|
||||
|
||||
private Decimal _TotalPrice;
|
||||
@@ -76,7 +76,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("总价格")]
|
||||
[Description("总价格")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalPrice", "总价格", "money")]
|
||||
[BindColumn("TotalPrice", "总价格", "")]
|
||||
public Decimal TotalPrice { get { return _TotalPrice; } set { if (OnPropertyChanging(__.TotalPrice, value)) { _TotalPrice = value; OnPropertyChanged(__.TotalPrice); } } }
|
||||
|
||||
private Decimal _Discount;
|
||||
@@ -84,7 +84,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("折扣")]
|
||||
[Description("折扣")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Discount", "折扣", "money")]
|
||||
[BindColumn("Discount", "折扣", "")]
|
||||
public Decimal Discount { get { return _Discount; } set { if (OnPropertyChanging(__.Discount, value)) { _Discount = value; OnPropertyChanged(__.Discount); } } }
|
||||
|
||||
private Decimal _Fare;
|
||||
@@ -92,7 +92,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("运费")]
|
||||
[Description("运费")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Fare", "运费", "money")]
|
||||
[BindColumn("Fare", "运费", "")]
|
||||
public Decimal Fare { get { return _Fare; } set { if (OnPropertyChanging(__.Fare, value)) { _Fare = value; OnPropertyChanged(__.Fare); } } }
|
||||
|
||||
private Decimal _TotalTax;
|
||||
@@ -100,7 +100,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("税")]
|
||||
[Description("税")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalTax", "税", "money")]
|
||||
[BindColumn("TotalTax", "税", "")]
|
||||
public Decimal TotalTax { get { return _TotalTax; } set { if (OnPropertyChanging(__.TotalTax, value)) { _TotalTax = value; OnPropertyChanged(__.TotalTax); } } }
|
||||
|
||||
private Decimal _TotalPay;
|
||||
@@ -108,7 +108,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("总支付价格")]
|
||||
[Description("总支付价格")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("TotalPay", "总支付价格", "money")]
|
||||
[BindColumn("TotalPay", "总支付价格", "")]
|
||||
public Decimal TotalPay { get { return _TotalPay; } set { if (OnPropertyChanging(__.TotalPay, value)) { _TotalPay = value; OnPropertyChanged(__.TotalPay); } } }
|
||||
|
||||
private Int32 _BackCredits;
|
||||
@@ -116,7 +116,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("返现积分")]
|
||||
[Description("返现积分")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("BackCredits", "返现积分", "int")]
|
||||
[BindColumn("BackCredits", "返现积分", "")]
|
||||
public Int32 BackCredits { get { return _BackCredits; } set { if (OnPropertyChanging(__.BackCredits, value)) { _BackCredits = value; OnPropertyChanged(__.BackCredits); } } }
|
||||
|
||||
private String _RealName;
|
||||
@@ -124,7 +124,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("姓名")]
|
||||
[Description("姓名")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("RealName", "姓名", "nvarchar(50)")]
|
||||
[BindColumn("RealName", "姓名", "")]
|
||||
public String RealName { get { return _RealName; } set { if (OnPropertyChanging(__.RealName, value)) { _RealName = value; OnPropertyChanged(__.RealName); } } }
|
||||
|
||||
private String _Country;
|
||||
@@ -132,7 +132,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("国家")]
|
||||
[Description("国家")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Country", "国家", "nvarchar(50)")]
|
||||
[BindColumn("Country", "国家", "")]
|
||||
public String Country { get { return _Country; } set { if (OnPropertyChanging(__.Country, value)) { _Country = value; OnPropertyChanged(__.Country); } } }
|
||||
|
||||
private String _Province;
|
||||
@@ -140,7 +140,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("省份")]
|
||||
[Description("省份")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("Province", "省份", "nvarchar(50)")]
|
||||
[BindColumn("Province", "省份", "")]
|
||||
public String Province { get { return _Province; } set { if (OnPropertyChanging(__.Province, value)) { _Province = value; OnPropertyChanged(__.Province); } } }
|
||||
|
||||
private String _City;
|
||||
@@ -148,7 +148,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("城市")]
|
||||
[Description("城市")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("City", "城市", "nvarchar(50)")]
|
||||
[BindColumn("City", "城市", "")]
|
||||
public String City { get { return _City; } set { if (OnPropertyChanging(__.City, value)) { _City = value; OnPropertyChanged(__.City); } } }
|
||||
|
||||
private String _District;
|
||||
@@ -156,7 +156,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("区")]
|
||||
[Description("区")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("District", "区", "nvarchar(50)")]
|
||||
[BindColumn("District", "区", "")]
|
||||
public String District { get { return _District; } set { if (OnPropertyChanging(__.District, value)) { _District = value; OnPropertyChanged(__.District); } } }
|
||||
|
||||
private String _Address;
|
||||
@@ -164,7 +164,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("详细地址")]
|
||||
[Description("详细地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Address", "详细地址", "nvarchar(250)")]
|
||||
[BindColumn("Address", "详细地址", "")]
|
||||
public String Address { get { return _Address; } set { if (OnPropertyChanging(__.Address, value)) { _Address = value; OnPropertyChanged(__.Address); } } }
|
||||
|
||||
private String _PostCode;
|
||||
@@ -172,7 +172,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("邮编")]
|
||||
[Description("邮编")]
|
||||
[DataObjectField(false, false, true, 20)]
|
||||
[BindColumn("PostCode", "邮编", "nvarchar(20)")]
|
||||
[BindColumn("PostCode", "邮编", "")]
|
||||
public String PostCode { get { return _PostCode; } set { if (OnPropertyChanging(__.PostCode, value)) { _PostCode = value; OnPropertyChanged(__.PostCode); } } }
|
||||
|
||||
private String _Tel;
|
||||
@@ -180,7 +180,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("手机")]
|
||||
[Description("手机")]
|
||||
[DataObjectField(false, false, true, 20)]
|
||||
[BindColumn("Tel", "手机", "nvarchar(20)")]
|
||||
[BindColumn("Tel", "手机", "")]
|
||||
public String Tel { get { return _Tel; } set { if (OnPropertyChanging(__.Tel, value)) { _Tel = value; OnPropertyChanged(__.Tel); } } }
|
||||
|
||||
private String _Mobile;
|
||||
@@ -188,7 +188,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("手机")]
|
||||
[Description("手机")]
|
||||
[DataObjectField(false, false, true, 20)]
|
||||
[BindColumn("Mobile", "手机", "nvarchar(20)")]
|
||||
[BindColumn("Mobile", "手机", "")]
|
||||
public String Mobile { get { return _Mobile; } set { if (OnPropertyChanging(__.Mobile, value)) { _Mobile = value; OnPropertyChanged(__.Mobile); } } }
|
||||
|
||||
private String _Email;
|
||||
@@ -196,7 +196,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("邮箱")]
|
||||
[Description("邮箱")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("Email", "邮箱", "nvarchar(100)")]
|
||||
[BindColumn("Email", "邮箱", "")]
|
||||
public String Email { get { return _Email; } set { if (OnPropertyChanging(__.Email, value)) { _Email = value; OnPropertyChanged(__.Email); } } }
|
||||
|
||||
private String _Notes;
|
||||
@@ -204,7 +204,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("备注")]
|
||||
[Description("备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Notes", "备注", "nvarchar(250)")]
|
||||
[BindColumn("Notes", "备注", "")]
|
||||
public String Notes { get { return _Notes; } set { if (OnPropertyChanging(__.Notes, value)) { _Notes = value; OnPropertyChanged(__.Notes); } } }
|
||||
|
||||
private String _AdminNotes;
|
||||
@@ -212,7 +212,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("管理员备注")]
|
||||
[Description("管理员备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("AdminNotes", "管理员备注", "nvarchar(250)")]
|
||||
[BindColumn("AdminNotes", "管理员备注", "")]
|
||||
public String AdminNotes { get { return _AdminNotes; } set { if (OnPropertyChanging(__.AdminNotes, value)) { _AdminNotes = value; OnPropertyChanged(__.AdminNotes); } } }
|
||||
|
||||
private String _Pic;
|
||||
@@ -220,7 +220,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("图片")]
|
||||
[Description("图片")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Pic", "图片", "ntext")]
|
||||
[BindColumn("Pic", "图片", "")]
|
||||
public String Pic { get { return _Pic; } set { if (OnPropertyChanging(__.Pic, value)) { _Pic = value; OnPropertyChanged(__.Pic); } } }
|
||||
|
||||
private Int32 _DeliverId;
|
||||
@@ -228,7 +228,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("配送方式ID")]
|
||||
[Description("配送方式ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("DeliverId", "配送方式ID", "int")]
|
||||
[BindColumn("DeliverId", "配送方式ID", "")]
|
||||
public Int32 DeliverId { get { return _DeliverId; } set { if (OnPropertyChanging(__.DeliverId, value)) { _DeliverId = value; OnPropertyChanged(__.DeliverId); } } }
|
||||
|
||||
private String _DeliverType;
|
||||
@@ -236,7 +236,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("配送方式名称")]
|
||||
[Description("配送方式名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("DeliverType", "配送方式名称", "nvarchar(50)")]
|
||||
[BindColumn("DeliverType", "配送方式名称", "")]
|
||||
public String DeliverType { get { return _DeliverType; } set { if (OnPropertyChanging(__.DeliverType, value)) { _DeliverType = value; OnPropertyChanged(__.DeliverType); } } }
|
||||
|
||||
private String _DeliverNO;
|
||||
@@ -244,7 +244,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("运单号")]
|
||||
[Description("运单号")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("DeliverNO", "运单号", "nvarchar(50)")]
|
||||
[BindColumn("DeliverNO", "运单号", "")]
|
||||
public String DeliverNO { get { return _DeliverNO; } set { if (OnPropertyChanging(__.DeliverNO, value)) { _DeliverNO = value; OnPropertyChanged(__.DeliverNO); } } }
|
||||
|
||||
private String _DeliverNotes;
|
||||
@@ -252,7 +252,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("配送备注")]
|
||||
[Description("配送备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("DeliverNotes", "配送备注", "nvarchar(250)")]
|
||||
[BindColumn("DeliverNotes", "配送备注", "")]
|
||||
public String DeliverNotes { get { return _DeliverNotes; } set { if (OnPropertyChanging(__.DeliverNotes, value)) { _DeliverNotes = value; OnPropertyChanged(__.DeliverNotes); } } }
|
||||
|
||||
private Int32 _PayId;
|
||||
@@ -260,7 +260,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付方式ID")]
|
||||
[Description("支付方式ID")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("PayId", "支付方式ID", "int")]
|
||||
[BindColumn("PayId", "支付方式ID", "")]
|
||||
public Int32 PayId { get { return _PayId; } set { if (OnPropertyChanging(__.PayId, value)) { _PayId = value; OnPropertyChanged(__.PayId); } } }
|
||||
|
||||
private String _PayType;
|
||||
@@ -268,7 +268,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("付款方式")]
|
||||
[Description("付款方式")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("PayType", "付款方式", "nvarchar(50)")]
|
||||
[BindColumn("PayType", "付款方式", "")]
|
||||
public String PayType { get { return _PayType; } set { if (OnPropertyChanging(__.PayType, value)) { _PayType = value; OnPropertyChanged(__.PayType); } } }
|
||||
|
||||
private String _PayTypeNotes;
|
||||
@@ -276,7 +276,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付备注")]
|
||||
[Description("支付备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("PayTypeNotes", "支付备注", "nvarchar(250)")]
|
||||
[BindColumn("PayTypeNotes", "支付备注", "")]
|
||||
public String PayTypeNotes { get { return _PayTypeNotes; } set { if (OnPropertyChanging(__.PayTypeNotes, value)) { _PayTypeNotes = value; OnPropertyChanged(__.PayTypeNotes); } } }
|
||||
|
||||
private String _OrderStatus;
|
||||
@@ -284,7 +284,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单状态:未确认、已确认、已完成、已取消")]
|
||||
[Description("订单状态:未确认、已确认、已完成、已取消")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("OrderStatus", "订单状态:未确认、已确认、已完成、已取消", "nvarchar(50)")]
|
||||
[BindColumn("OrderStatus", "订单状态:未确认、已确认、已完成、已取消", "")]
|
||||
public String OrderStatus { get { return _OrderStatus; } set { if (OnPropertyChanging(__.OrderStatus, value)) { _OrderStatus = value; OnPropertyChanged(__.OrderStatus); } } }
|
||||
|
||||
private String _PaymentStatus;
|
||||
@@ -292,7 +292,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("支付状态:未支付、已支付、已退款")]
|
||||
[Description("支付状态:未支付、已支付、已退款")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("PaymentStatus", "支付状态:未支付、已支付、已退款", "nvarchar(50)")]
|
||||
[BindColumn("PaymentStatus", "支付状态:未支付、已支付、已退款", "")]
|
||||
public String PaymentStatus { get { return _PaymentStatus; } set { if (OnPropertyChanging(__.PaymentStatus, value)) { _PaymentStatus = value; OnPropertyChanged(__.PaymentStatus); } } }
|
||||
|
||||
private String _DeliverStatus;
|
||||
@@ -300,7 +300,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("配送状态:未配送、配货中、已配送、已收到、退货中、已退货")]
|
||||
[Description("配送状态:未配送、配货中、已配送、已收到、退货中、已退货")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("DeliverStatus", "配送状态:未配送、配货中、已配送、已收到、退货中、已退货", "nvarchar(50)")]
|
||||
[BindColumn("DeliverStatus", "配送状态:未配送、配货中、已配送、已收到、退货中、已退货", "")]
|
||||
public String DeliverStatus { get { return _DeliverStatus; } set { if (OnPropertyChanging(__.DeliverStatus, value)) { _DeliverStatus = value; OnPropertyChanged(__.DeliverStatus); } } }
|
||||
|
||||
private DateTime _AddTime;
|
||||
@@ -308,23 +308,23 @@ namespace COMCMS.Core
|
||||
[DisplayName("添加时间")]
|
||||
[Description("添加时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("AddTime", "添加时间", "datetime")]
|
||||
[BindColumn("AddTime", "添加时间", "")]
|
||||
public DateTime AddTime { get { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private String _IP;
|
||||
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); } } }
|
||||
[BindColumn("Ip", "下单IP", "")]
|
||||
public String Ip { get { return _Ip; } set { if (OnPropertyChanging(__.Ip, value)) { _Ip = value; OnPropertyChanged(__.Ip); } } }
|
||||
|
||||
private Int32 _IsInvoice;
|
||||
/// <summary>是否需要发票</summary>
|
||||
[DisplayName("是否需要发票")]
|
||||
[Description("是否需要发票")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsInvoice", "是否需要发票", "int")]
|
||||
[BindColumn("IsInvoice", "是否需要发票", "")]
|
||||
public Int32 IsInvoice { get { return _IsInvoice; } set { if (OnPropertyChanging(__.IsInvoice, value)) { _IsInvoice = value; OnPropertyChanged(__.IsInvoice); } } }
|
||||
|
||||
private String _InvoiceCompanyName;
|
||||
@@ -332,7 +332,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("抬头")]
|
||||
[Description("抬头")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("InvoiceCompanyName", "抬头", "nvarchar(50)")]
|
||||
[BindColumn("InvoiceCompanyName", "抬头", "")]
|
||||
public String InvoiceCompanyName { get { return _InvoiceCompanyName; } set { if (OnPropertyChanging(__.InvoiceCompanyName, value)) { _InvoiceCompanyName = value; OnPropertyChanged(__.InvoiceCompanyName); } } }
|
||||
|
||||
private String _InvoiceCompanyID;
|
||||
@@ -340,7 +340,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("纳税人识别号")]
|
||||
[Description("纳税人识别号")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("InvoiceCompanyID", "纳税人识别号", "nvarchar(100)")]
|
||||
[BindColumn("InvoiceCompanyID", "纳税人识别号", "")]
|
||||
public String InvoiceCompanyID { get { return _InvoiceCompanyID; } set { if (OnPropertyChanging(__.InvoiceCompanyID, value)) { _InvoiceCompanyID = value; OnPropertyChanged(__.InvoiceCompanyID); } } }
|
||||
|
||||
private String _InvoiceType;
|
||||
@@ -348,7 +348,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("发票内容")]
|
||||
[Description("发票内容")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("InvoiceType", "发票内容", "nvarchar(50)")]
|
||||
[BindColumn("InvoiceType", "发票内容", "")]
|
||||
public String InvoiceType { get { return _InvoiceType; } set { if (OnPropertyChanging(__.InvoiceType, value)) { _InvoiceType = value; OnPropertyChanged(__.InvoiceType); } } }
|
||||
|
||||
private String _InvoiceNote;
|
||||
@@ -356,7 +356,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("发票备注")]
|
||||
[Description("发票备注")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("InvoiceNote", "发票备注", "nvarchar(250)")]
|
||||
[BindColumn("InvoiceNote", "发票备注", "")]
|
||||
public String InvoiceNote { get { return _InvoiceNote; } set { if (OnPropertyChanging(__.InvoiceNote, value)) { _InvoiceNote = value; OnPropertyChanged(__.InvoiceNote); } } }
|
||||
|
||||
private Int32 _IsRead;
|
||||
@@ -364,7 +364,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否未读")]
|
||||
[Description("是否未读")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsRead", "是否未读", "int")]
|
||||
[BindColumn("IsRead", "是否未读", "")]
|
||||
public Int32 IsRead { get { return _IsRead; } set { if (OnPropertyChanging(__.IsRead, value)) { _IsRead = value; OnPropertyChanged(__.IsRead); } } }
|
||||
|
||||
private Int32 _IsEnd;
|
||||
@@ -372,7 +372,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("是否结束")]
|
||||
[Description("是否结束")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsEnd", "是否结束", "int")]
|
||||
[BindColumn("IsEnd", "是否结束", "")]
|
||||
public Int32 IsEnd { get { return _IsEnd; } set { if (OnPropertyChanging(__.IsEnd, value)) { _IsEnd = value; OnPropertyChanged(__.IsEnd); } } }
|
||||
|
||||
private DateTime _EndTime;
|
||||
@@ -380,7 +380,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("结束时间")]
|
||||
[Description("结束时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("EndTime", "结束时间", "datetime")]
|
||||
[BindColumn("EndTime", "结束时间", "")]
|
||||
public DateTime EndTime { get { return _EndTime; } set { if (OnPropertyChanging(__.EndTime, value)) { _EndTime = value; OnPropertyChanged(__.EndTime); } } }
|
||||
|
||||
private Int32 _IsOk;
|
||||
@@ -388,7 +388,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单是否顺利完成")]
|
||||
[Description("订单是否顺利完成")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsOk", "订单是否顺利完成", "int")]
|
||||
[BindColumn("IsOk", "订单是否顺利完成", "")]
|
||||
public Int32 IsOk { get { return _IsOk; } set { if (OnPropertyChanging(__.IsOk, value)) { _IsOk = value; OnPropertyChanged(__.IsOk); } } }
|
||||
|
||||
private Int32 _IsComment;
|
||||
@@ -396,7 +396,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单已经评论")]
|
||||
[Description("订单已经评论")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsComment", "订单已经评论", "int")]
|
||||
[BindColumn("IsComment", "订单已经评论", "")]
|
||||
public Int32 IsComment { get { return _IsComment; } set { if (OnPropertyChanging(__.IsComment, value)) { _IsComment = value; OnPropertyChanged(__.IsComment); } } }
|
||||
|
||||
private String _Flag1;
|
||||
@@ -404,7 +404,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("预留字段1")]
|
||||
[Description("预留字段1")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Flag1", "预留字段1", "nvarchar(200)")]
|
||||
[BindColumn("Flag1", "预留字段1", "")]
|
||||
public String Flag1 { get { return _Flag1; } set { if (OnPropertyChanging(__.Flag1, value)) { _Flag1 = value; OnPropertyChanged(__.Flag1); } } }
|
||||
|
||||
private String _Flag2;
|
||||
@@ -412,7 +412,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("预留字段2")]
|
||||
[Description("预留字段2")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Flag2", "预留字段2", "nvarchar(200)")]
|
||||
[BindColumn("Flag2", "预留字段2", "")]
|
||||
public String Flag2 { get { return _Flag2; } set { if (OnPropertyChanging(__.Flag2, value)) { _Flag2 = value; OnPropertyChanged(__.Flag2); } } }
|
||||
|
||||
private String _Flag3;
|
||||
@@ -420,7 +420,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("预留字段3")]
|
||||
[Description("预留字段3")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Flag3", "预留字段3", "nvarchar(200)")]
|
||||
[BindColumn("Flag3", "预留字段3", "")]
|
||||
public String Flag3 { get { return _Flag3; } set { if (OnPropertyChanging(__.Flag3, value)) { _Flag3 = value; OnPropertyChanged(__.Flag3); } } }
|
||||
|
||||
private String _Title;
|
||||
@@ -428,7 +428,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单名称")]
|
||||
[Description("订单名称")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Title", "订单名称", "nvarchar(200)")]
|
||||
[BindColumn("Title", "订单名称", "")]
|
||||
public String Title { get { return _Title; } set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private DateTime _LastModTime;
|
||||
@@ -436,7 +436,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("最后操作时间")]
|
||||
[Description("最后操作时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("LastModTime", "最后操作时间", "datetime")]
|
||||
[BindColumn("LastModTime", "最后操作时间", "")]
|
||||
public DateTime LastModTime { get { return _LastModTime; } set { if (OnPropertyChanging(__.LastModTime, value)) { _LastModTime = value; OnPropertyChanged(__.LastModTime); } } }
|
||||
|
||||
private Int32 _OrderType;
|
||||
@@ -444,7 +444,7 @@ namespace COMCMS.Core
|
||||
[DisplayName("订单类型")]
|
||||
[Description("订单类型,0为商品订单")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("OrderType", "订单类型,0为商品订单", "int")]
|
||||
[BindColumn("OrderType", "订单类型,0为商品订单", "")]
|
||||
public Int32 OrderType { get { return _OrderType; } set { if (OnPropertyChanging(__.OrderType, value)) { _OrderType = value; OnPropertyChanged(__.OrderType); } } }
|
||||
|
||||
private Int32 _MyType;
|
||||
@@ -452,8 +452,16 @@ namespace COMCMS.Core
|
||||
[DisplayName("系统类型")]
|
||||
[Description("系统类型")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("MyType", "系统类型", "int")]
|
||||
[BindColumn("MyType", "系统类型", "")]
|
||||
public Int32 MyType { get { return _MyType; } set { if (OnPropertyChanging(__.MyType, value)) { _MyType = value; OnPropertyChanged(__.MyType); } } }
|
||||
|
||||
private String _OutTradeNo;
|
||||
/// <summary>支付成功流水号</summary>
|
||||
[DisplayName("支付成功流水号")]
|
||||
[Description("支付成功流水号")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("OutTradeNo", "支付成功流水号", "")]
|
||||
public String OutTradeNo { get { return _OutTradeNo; } set { if (OnPropertyChanging(__.OutTradeNo, value)) { _OutTradeNo = value; OnPropertyChanged(__.OutTradeNo); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
@@ -503,7 +511,7 @@ namespace COMCMS.Core
|
||||
case __.PaymentStatus : return _PaymentStatus;
|
||||
case __.DeliverStatus : return _DeliverStatus;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.IP : return _IP;
|
||||
case __.Ip : return _Ip;
|
||||
case __.IsInvoice : return _IsInvoice;
|
||||
case __.InvoiceCompanyName : return _InvoiceCompanyName;
|
||||
case __.InvoiceCompanyID : return _InvoiceCompanyID;
|
||||
@@ -521,6 +529,7 @@ namespace COMCMS.Core
|
||||
case __.LastModTime : return _LastModTime;
|
||||
case __.OrderType : return _OrderType;
|
||||
case __.MyType : return _MyType;
|
||||
case __.OutTradeNo : return _OutTradeNo;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
@@ -528,19 +537,19 @@ namespace COMCMS.Core
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = Convert.ToInt32(value); break;
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.OrderNum : _OrderNum = Convert.ToString(value); break;
|
||||
case __.UId : _UId = Convert.ToInt32(value); break;
|
||||
case __.UId : _UId = value.ToInt(); break;
|
||||
case __.UserName : _UserName = Convert.ToString(value); break;
|
||||
case __.ShopId : _ShopId = Convert.ToInt32(value); break;
|
||||
case __.Credit : _Credit = Convert.ToInt32(value); break;
|
||||
case __.TotalQty : _TotalQty = Convert.ToInt32(value); break;
|
||||
case __.ShopId : _ShopId = value.ToInt(); break;
|
||||
case __.Credit : _Credit = value.ToInt(); break;
|
||||
case __.TotalQty : _TotalQty = value.ToInt(); break;
|
||||
case __.TotalPrice : _TotalPrice = Convert.ToDecimal(value); break;
|
||||
case __.Discount : _Discount = Convert.ToDecimal(value); break;
|
||||
case __.Fare : _Fare = Convert.ToDecimal(value); break;
|
||||
case __.TotalTax : _TotalTax = Convert.ToDecimal(value); break;
|
||||
case __.TotalPay : _TotalPay = Convert.ToDecimal(value); break;
|
||||
case __.BackCredits : _BackCredits = Convert.ToInt32(value); break;
|
||||
case __.BackCredits : _BackCredits = value.ToInt(); break;
|
||||
case __.RealName : _RealName = Convert.ToString(value); break;
|
||||
case __.Country : _Country = Convert.ToString(value); break;
|
||||
case __.Province : _Province = Convert.ToString(value); break;
|
||||
@@ -554,35 +563,36 @@ namespace COMCMS.Core
|
||||
case __.Notes : _Notes = Convert.ToString(value); break;
|
||||
case __.AdminNotes : _AdminNotes = Convert.ToString(value); break;
|
||||
case __.Pic : _Pic = Convert.ToString(value); break;
|
||||
case __.DeliverId : _DeliverId = Convert.ToInt32(value); break;
|
||||
case __.DeliverId : _DeliverId = value.ToInt(); break;
|
||||
case __.DeliverType : _DeliverType = Convert.ToString(value); break;
|
||||
case __.DeliverNO : _DeliverNO = Convert.ToString(value); break;
|
||||
case __.DeliverNotes : _DeliverNotes = Convert.ToString(value); break;
|
||||
case __.PayId : _PayId = Convert.ToInt32(value); break;
|
||||
case __.PayId : _PayId = value.ToInt(); break;
|
||||
case __.PayType : _PayType = Convert.ToString(value); break;
|
||||
case __.PayTypeNotes : _PayTypeNotes = Convert.ToString(value); break;
|
||||
case __.OrderStatus : _OrderStatus = Convert.ToString(value); break;
|
||||
case __.PaymentStatus : _PaymentStatus = Convert.ToString(value); break;
|
||||
case __.DeliverStatus : _DeliverStatus = Convert.ToString(value); break;
|
||||
case __.AddTime : _AddTime = Convert.ToDateTime(value); break;
|
||||
case __.IP : _IP = Convert.ToString(value); break;
|
||||
case __.IsInvoice : _IsInvoice = Convert.ToInt32(value); break;
|
||||
case __.AddTime : _AddTime = value.ToDateTime(); break;
|
||||
case __.Ip : _Ip = Convert.ToString(value); break;
|
||||
case __.IsInvoice : _IsInvoice = value.ToInt(); break;
|
||||
case __.InvoiceCompanyName : _InvoiceCompanyName = Convert.ToString(value); break;
|
||||
case __.InvoiceCompanyID : _InvoiceCompanyID = Convert.ToString(value); break;
|
||||
case __.InvoiceType : _InvoiceType = Convert.ToString(value); break;
|
||||
case __.InvoiceNote : _InvoiceNote = Convert.ToString(value); break;
|
||||
case __.IsRead : _IsRead = Convert.ToInt32(value); break;
|
||||
case __.IsEnd : _IsEnd = Convert.ToInt32(value); break;
|
||||
case __.EndTime : _EndTime = Convert.ToDateTime(value); break;
|
||||
case __.IsOk : _IsOk = Convert.ToInt32(value); break;
|
||||
case __.IsComment : _IsComment = Convert.ToInt32(value); break;
|
||||
case __.IsRead : _IsRead = value.ToInt(); break;
|
||||
case __.IsEnd : _IsEnd = value.ToInt(); break;
|
||||
case __.EndTime : _EndTime = value.ToDateTime(); break;
|
||||
case __.IsOk : _IsOk = value.ToInt(); break;
|
||||
case __.IsComment : _IsComment = value.ToInt(); break;
|
||||
case __.Flag1 : _Flag1 = Convert.ToString(value); break;
|
||||
case __.Flag2 : _Flag2 = Convert.ToString(value); break;
|
||||
case __.Flag3 : _Flag3 = Convert.ToString(value); break;
|
||||
case __.Title : _Title = Convert.ToString(value); break;
|
||||
case __.LastModTime : _LastModTime = Convert.ToDateTime(value); break;
|
||||
case __.OrderType : _OrderType = Convert.ToInt32(value); break;
|
||||
case __.MyType : _MyType = Convert.ToInt32(value); break;
|
||||
case __.LastModTime : _LastModTime = value.ToDateTime(); break;
|
||||
case __.OrderType : _OrderType = value.ToInt(); break;
|
||||
case __.MyType : _MyType = value.ToInt(); break;
|
||||
case __.OutTradeNo : _OutTradeNo = Convert.ToString(value); break;
|
||||
default: base[name] = value; break;
|
||||
}
|
||||
}
|
||||
@@ -705,7 +715,7 @@ namespace COMCMS.Core
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
public static readonly Field IP = FindByName(__.IP);
|
||||
public static readonly Field Ip = FindByName(__.Ip);
|
||||
|
||||
/// <summary>是否需要发票</summary>
|
||||
public static readonly Field IsInvoice = FindByName(__.IsInvoice);
|
||||
@@ -758,6 +768,9 @@ namespace COMCMS.Core
|
||||
/// <summary>系统类型</summary>
|
||||
public static readonly Field MyType = FindByName(__.MyType);
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
public static readonly Field OutTradeNo = FindByName(__.OutTradeNo);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
@@ -876,7 +889,7 @@ namespace COMCMS.Core
|
||||
public const String AddTime = "AddTime";
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
public const String IP = "IP";
|
||||
public const String Ip = "Ip";
|
||||
|
||||
/// <summary>是否需要发票</summary>
|
||||
public const String IsInvoice = "IsInvoice";
|
||||
@@ -928,6 +941,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>系统类型</summary>
|
||||
public const String MyType = "MyType";
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
public const String OutTradeNo = "OutTradeNo";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1048,7 +1064,7 @@ namespace COMCMS.Core
|
||||
DateTime AddTime { get; set; }
|
||||
|
||||
/// <summary>下单IP</summary>
|
||||
String IP { get; set; }
|
||||
String Ip { get; set; }
|
||||
|
||||
/// <summary>是否需要发票</summary>
|
||||
Int32 IsInvoice { get; set; }
|
||||
@@ -1100,6 +1116,9 @@ namespace COMCMS.Core
|
||||
|
||||
/// <summary>系统类型</summary>
|
||||
Int32 MyType { get; set; }
|
||||
|
||||
/// <summary>支付成功流水号</summary>
|
||||
String OutTradeNo { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
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 WeixinResponseContent : Entity<WeixinResponseContent>
|
||||
{
|
||||
#region 对象操作
|
||||
static WeixinResponseContent()
|
||||
{
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化WeixinResponseContent[公众平台回复信息]数据……");
|
||||
|
||||
// var entity = new WeixinResponseContent();
|
||||
// entity.Id = 0;
|
||||
// entity.OpenId = "abc";
|
||||
// entity.RequestType = "abc";
|
||||
// entity.RequestContent = "abc";
|
||||
// entity.ResponseType = "abc";
|
||||
// entity.ReponseContent = "abc";
|
||||
// entity.XmlContent = "abc";
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化WeixinResponseContent[公众平台回复信息]数据!");
|
||||
//}
|
||||
|
||||
///// <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 WeixinResponseContent 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 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
|
||||
#region 业务
|
||||
public static string GetResponseType(int typeid)
|
||||
{
|
||||
//Text = 0,
|
||||
//Location = 1,
|
||||
//Image = 2,
|
||||
//Voice = 3,
|
||||
//Video = 4,
|
||||
//Link = 5,
|
||||
//ShortVideo = 6,
|
||||
//Event = 7,
|
||||
|
||||
switch (typeid)
|
||||
{
|
||||
case 0:
|
||||
return "text";
|
||||
case 1:
|
||||
return "location";
|
||||
case 2:
|
||||
return "image";
|
||||
case 3:
|
||||
return "voice";
|
||||
case 4:
|
||||
return "video";
|
||||
case 5:
|
||||
return "link";
|
||||
case 6:
|
||||
return "shortvideo";
|
||||
case 7:
|
||||
return "event";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>公众平台回复信息</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("公众平台回复信息")]
|
||||
[BindTable("WeixinResponseContent", Description = "公众平台回复信息", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class WeixinResponseContent : IWeixinResponseContent
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _OpenId;
|
||||
/// <summary>用户OpenId</summary>
|
||||
[DisplayName("用户OpenId")]
|
||||
[Description("用户OpenId")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("OpenId", "用户OpenId", "")]
|
||||
public String OpenId { get { return _OpenId; } set { if (OnPropertyChanging(__.OpenId, value)) { _OpenId = value; OnPropertyChanged(__.OpenId); } } }
|
||||
|
||||
private String _RequestType;
|
||||
/// <summary>请求类型</summary>
|
||||
[DisplayName("请求类型")]
|
||||
[Description("请求类型")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("RequestType", "请求类型", "")]
|
||||
public String RequestType { get { return _RequestType; } set { if (OnPropertyChanging(__.RequestType, value)) { _RequestType = value; OnPropertyChanged(__.RequestType); } } }
|
||||
|
||||
private String _RequestContent;
|
||||
/// <summary>内容</summary>
|
||||
[DisplayName("内容")]
|
||||
[Description("内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("RequestContent", "内容", "")]
|
||||
public String RequestContent { get { return _RequestContent; } set { if (OnPropertyChanging(__.RequestContent, value)) { _RequestContent = value; OnPropertyChanged(__.RequestContent); } } }
|
||||
|
||||
private String _ResponseType;
|
||||
/// <summary>回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link</summary>
|
||||
[DisplayName("回复的类型文本消息:text图片消息:image地理位置消息:location链接消息:link")]
|
||||
[Description("回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("ResponseType", "回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link", "")]
|
||||
public String ResponseType { get { return _ResponseType; } set { if (OnPropertyChanging(__.ResponseType, value)) { _ResponseType = value; OnPropertyChanged(__.ResponseType); } } }
|
||||
|
||||
private String _ReponseContent;
|
||||
/// <summary>系统回复的内容</summary>
|
||||
[DisplayName("系统回复的内容")]
|
||||
[Description("系统回复的内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("ReponseContent", "系统回复的内容", "")]
|
||||
public String ReponseContent { get { return _ReponseContent; } set { if (OnPropertyChanging(__.ReponseContent, value)) { _ReponseContent = value; OnPropertyChanged(__.ReponseContent); } } }
|
||||
|
||||
private String _XmlContent;
|
||||
/// <summary>xml原始内容</summary>
|
||||
[DisplayName("xml原始内容")]
|
||||
[Description("xml原始内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("XmlContent", "xml原始内容", "")]
|
||||
public String XmlContent { get { return _XmlContent; } set { if (OnPropertyChanging(__.XmlContent, value)) { _XmlContent = value; OnPropertyChanged(__.XmlContent); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>修改时间</summary>
|
||||
[DisplayName("修改时间")]
|
||||
[Description("修改时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "修改时间", "")]
|
||||
public DateTime UpdateTime { get { return _UpdateTime; } set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.OpenId : return _OpenId;
|
||||
case __.RequestType : return _RequestType;
|
||||
case __.RequestContent : return _RequestContent;
|
||||
case __.ResponseType : return _ResponseType;
|
||||
case __.ReponseContent : return _ReponseContent;
|
||||
case __.XmlContent : return _XmlContent;
|
||||
case __.UpdateTime : return _UpdateTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.OpenId : _OpenId = Convert.ToString(value); break;
|
||||
case __.RequestType : _RequestType = Convert.ToString(value); break;
|
||||
case __.RequestContent : _RequestContent = Convert.ToString(value); break;
|
||||
case __.ResponseType : _ResponseType = Convert.ToString(value); break;
|
||||
case __.ReponseContent : _ReponseContent = Convert.ToString(value); break;
|
||||
case __.XmlContent : _XmlContent = Convert.ToString(value); break;
|
||||
case __.UpdateTime : _UpdateTime = 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>用户OpenId</summary>
|
||||
public static readonly Field OpenId = FindByName(__.OpenId);
|
||||
|
||||
/// <summary>请求类型</summary>
|
||||
public static readonly Field RequestType = FindByName(__.RequestType);
|
||||
|
||||
/// <summary>内容</summary>
|
||||
public static readonly Field RequestContent = FindByName(__.RequestContent);
|
||||
|
||||
/// <summary>回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link</summary>
|
||||
public static readonly Field ResponseType = FindByName(__.ResponseType);
|
||||
|
||||
/// <summary>系统回复的内容</summary>
|
||||
public static readonly Field ReponseContent = FindByName(__.ReponseContent);
|
||||
|
||||
/// <summary>xml原始内容</summary>
|
||||
public static readonly Field XmlContent = FindByName(__.XmlContent);
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName(__.UpdateTime);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
/// <summary>取得公众平台回复信息字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>用户OpenId</summary>
|
||||
public const String OpenId = "OpenId";
|
||||
|
||||
/// <summary>请求类型</summary>
|
||||
public const String RequestType = "RequestType";
|
||||
|
||||
/// <summary>内容</summary>
|
||||
public const String RequestContent = "RequestContent";
|
||||
|
||||
/// <summary>回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link</summary>
|
||||
public const String ResponseType = "ResponseType";
|
||||
|
||||
/// <summary>系统回复的内容</summary>
|
||||
public const String ReponseContent = "ReponseContent";
|
||||
|
||||
/// <summary>xml原始内容</summary>
|
||||
public const String XmlContent = "XmlContent";
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>公众平台回复信息接口</summary>
|
||||
public partial interface IWeixinResponseContent
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>用户OpenId</summary>
|
||||
String OpenId { get; set; }
|
||||
|
||||
/// <summary>请求类型</summary>
|
||||
String RequestType { get; set; }
|
||||
|
||||
/// <summary>内容</summary>
|
||||
String RequestContent { get; set; }
|
||||
|
||||
/// <summary>回复的类型 文本消息:text 图片消息:image 地理位置消息:location 链接消息:link</summary>
|
||||
String ResponseType { get; set; }
|
||||
|
||||
/// <summary>系统回复的内容</summary>
|
||||
String ReponseContent { get; set; }
|
||||
|
||||
/// <summary>xml原始内容</summary>
|
||||
String XmlContent { get; set; }
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
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 WeixinRequestRule : Entity<WeixinRequestRule>
|
||||
{
|
||||
#region 对象操作
|
||||
static WeixinRequestRule()
|
||||
{
|
||||
// 累加字段
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(__.RequestType);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化WeixinRequestRule[微信公众号回复规则]数据……");
|
||||
|
||||
// var entity = new WeixinRequestRule();
|
||||
// entity.Id = 0;
|
||||
// entity.RuleName = "abc";
|
||||
// entity.Keywords = "abc";
|
||||
// entity.RequestType = 0;
|
||||
// entity.ResponseType = 0;
|
||||
// entity.IsLikeQuery = 0;
|
||||
// entity.IsDefault = 0;
|
||||
// entity.Rank = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化WeixinRequestRule[微信公众号回复规则]数据!");
|
||||
//}
|
||||
|
||||
///// <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 扩展属性
|
||||
private IList<WeixinRequestContent> _ListContent;
|
||||
/// <summary>
|
||||
/// 详细规则列表
|
||||
/// </summary>
|
||||
public IList<WeixinRequestContent> ListContent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ListContent == null && Id > 0 && !Dirtys["ListWechatRequestContent_" + Id])
|
||||
{
|
||||
_ListContent = WeixinRequestContent.FindAll(WeixinRequestContent._.RuleId == Id, WeixinRequestContent._.Rank.Asc(), null, 0, 0);
|
||||
|
||||
Dirtys["ListWechatRequestContent_" + Id] = true;
|
||||
}
|
||||
return _ListContent;
|
||||
}
|
||||
set { _ListContent = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 扩展查询
|
||||
/// <summary>根据编号查找</summary>
|
||||
/// <param name="id">编号</param>
|
||||
/// <returns>实体对象</returns>
|
||||
public static WeixinRequestRule 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 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
|
||||
#region 业务
|
||||
/// <summary>
|
||||
/// 微信请求类型
|
||||
/// 0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件
|
||||
/// </summary>
|
||||
public enum XRequestType
|
||||
{
|
||||
/// <summary>默认回复</summary>
|
||||
Default = 0,
|
||||
/// <summary>
|
||||
/// 文本请求
|
||||
/// </summary>
|
||||
Text = 1,
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
Image = 2,
|
||||
/// <summary>
|
||||
/// 语音
|
||||
/// </summary>
|
||||
Voice = 3,
|
||||
/// <summary>
|
||||
/// 链接
|
||||
/// </summary>
|
||||
Link = 4,
|
||||
/// <summary>
|
||||
/// 地理位置
|
||||
/// </summary>
|
||||
Location = 5,
|
||||
/// <summary>
|
||||
/// 关注
|
||||
/// </summary>
|
||||
Flow = 6,
|
||||
/// <summary>
|
||||
/// 取消关注
|
||||
/// </summary>
|
||||
Unflow = 7,
|
||||
/// <summary>
|
||||
/// 扫描二维码
|
||||
/// </summary>
|
||||
Scan = 8,
|
||||
/// <summary>
|
||||
/// 上报地理位置
|
||||
/// </summary>
|
||||
ReportingLocation = 9,
|
||||
/// <summary>
|
||||
/// 自定义菜单
|
||||
/// </summary>
|
||||
CustomMenu = 10,
|
||||
/// <summary>
|
||||
/// 没找到关键字
|
||||
/// </summary>
|
||||
NotFindKeyword = 11
|
||||
}
|
||||
/// <summary>
|
||||
/// 回复类型
|
||||
/// </summary>
|
||||
public enum XResponseType
|
||||
{
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
Text = 0,
|
||||
/// <summary>
|
||||
/// 地理位置
|
||||
/// </summary>
|
||||
Location = 1,
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
Image = 2,
|
||||
/// <summary>
|
||||
/// 语音
|
||||
/// </summary>
|
||||
Voice = 3,
|
||||
/// <summary>
|
||||
/// 视频
|
||||
/// </summary>
|
||||
Video = 4,
|
||||
/// <summary>
|
||||
/// 链接
|
||||
/// </summary>
|
||||
Link = 5,
|
||||
/// <summary>
|
||||
/// 短片
|
||||
/// </summary>
|
||||
ShortVideo = 6,
|
||||
/// <summary>
|
||||
/// 自定义事件
|
||||
/// </summary>
|
||||
Event = 7,
|
||||
/// <summary>
|
||||
/// 单张图片
|
||||
/// </summary>
|
||||
SingleImage = 8,
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>微信公众号回复规则</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("微信公众号回复规则")]
|
||||
[BindTable("WeixinRequestRule", Description = "微信公众号回复规则", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class WeixinRequestRule : IWeixinRequestRule
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private String _RuleName;
|
||||
/// <summary>规则名称</summary>
|
||||
[DisplayName("规则名称")]
|
||||
[Description("规则名称")]
|
||||
[DataObjectField(false, false, true, 50)]
|
||||
[BindColumn("RuleName", "规则名称", "")]
|
||||
public String RuleName { get { return _RuleName; } set { if (OnPropertyChanging(__.RuleName, value)) { _RuleName = value; OnPropertyChanged(__.RuleName); } } }
|
||||
|
||||
private String _Keywords;
|
||||
/// <summary>请求关键词,逗号分隔</summary>
|
||||
[DisplayName("请求关键词")]
|
||||
[Description("请求关键词,逗号分隔")]
|
||||
[DataObjectField(false, false, true, 200)]
|
||||
[BindColumn("Keywords", "请求关键词,逗号分隔", "")]
|
||||
public String Keywords { get { return _Keywords; } set { if (OnPropertyChanging(__.Keywords, value)) { _Keywords = value; OnPropertyChanged(__.Keywords); } } }
|
||||
|
||||
private Int32 _RequestType;
|
||||
/// <summary>请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)</summary>
|
||||
[DisplayName("请求类型")]
|
||||
[Description("请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("RequestType", "请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)", "")]
|
||||
public Int32 RequestType { get { return _RequestType; } set { if (OnPropertyChanging(__.RequestType, value)) { _RequestType = value; OnPropertyChanged(__.RequestType); } } }
|
||||
|
||||
private Int32 _ResponseType;
|
||||
/// <summary>回复类型(1文本2图文3语音4视频5第三方接口)</summary>
|
||||
[DisplayName("回复类型")]
|
||||
[Description("回复类型(1文本2图文3语音4视频5第三方接口)")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("ResponseType", "回复类型(1文本2图文3语音4视频5第三方接口)", "")]
|
||||
public Int32 ResponseType { get { return _ResponseType; } set { if (OnPropertyChanging(__.ResponseType, value)) { _ResponseType = value; OnPropertyChanged(__.ResponseType); } } }
|
||||
|
||||
private Int32 _IsLikeQuery;
|
||||
/// <summary>是否模糊查询 0 是完全匹配;1是模糊匹配</summary>
|
||||
[DisplayName("是否模糊查询0是完全匹配;1是模糊匹配")]
|
||||
[Description("是否模糊查询 0 是完全匹配;1是模糊匹配")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsLikeQuery", "是否模糊查询 0 是完全匹配;1是模糊匹配", "")]
|
||||
public Int32 IsLikeQuery { get { return _IsLikeQuery; } set { if (OnPropertyChanging(__.IsLikeQuery, value)) { _IsLikeQuery = value; OnPropertyChanged(__.IsLikeQuery); } } }
|
||||
|
||||
private Int32 _IsDefault;
|
||||
/// <summary>是否是默认回复</summary>
|
||||
[DisplayName("是否是默认回复")]
|
||||
[Description("是否是默认回复")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("IsDefault", "是否是默认回复", "")]
|
||||
public Int32 IsDefault { get { return _IsDefault; } set { if (OnPropertyChanging(__.IsDefault, value)) { _IsDefault = value; OnPropertyChanged(__.IsDefault); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _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 { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>修改时间</summary>
|
||||
[DisplayName("修改时间")]
|
||||
[Description("修改时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "修改时间", "")]
|
||||
public DateTime UpdateTime { get { return _UpdateTime; } set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.RuleName : return _RuleName;
|
||||
case __.Keywords : return _Keywords;
|
||||
case __.RequestType : return _RequestType;
|
||||
case __.ResponseType : return _ResponseType;
|
||||
case __.IsLikeQuery : return _IsLikeQuery;
|
||||
case __.IsDefault : return _IsDefault;
|
||||
case __.Rank : return _Rank;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.UpdateTime : return _UpdateTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.RuleName : _RuleName = Convert.ToString(value); break;
|
||||
case __.Keywords : _Keywords = Convert.ToString(value); break;
|
||||
case __.RequestType : _RequestType = value.ToInt(); break;
|
||||
case __.ResponseType : _ResponseType = value.ToInt(); break;
|
||||
case __.IsLikeQuery : _IsLikeQuery = value.ToInt(); break;
|
||||
case __.IsDefault : _IsDefault = value.ToInt(); break;
|
||||
case __.Rank : _Rank = value.ToInt(); break;
|
||||
case __.AddTime : _AddTime = value.ToDateTime(); break;
|
||||
case __.UpdateTime : _UpdateTime = 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>规则名称</summary>
|
||||
public static readonly Field RuleName = FindByName(__.RuleName);
|
||||
|
||||
/// <summary>请求关键词,逗号分隔</summary>
|
||||
public static readonly Field Keywords = FindByName(__.Keywords);
|
||||
|
||||
/// <summary>请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)</summary>
|
||||
public static readonly Field RequestType = FindByName(__.RequestType);
|
||||
|
||||
/// <summary>回复类型(1文本2图文3语音4视频5第三方接口)</summary>
|
||||
public static readonly Field ResponseType = FindByName(__.ResponseType);
|
||||
|
||||
/// <summary>是否模糊查询 0 是完全匹配;1是模糊匹配</summary>
|
||||
public static readonly Field IsLikeQuery = FindByName(__.IsLikeQuery);
|
||||
|
||||
/// <summary>是否是默认回复</summary>
|
||||
public static readonly Field IsDefault = FindByName(__.IsDefault);
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName(__.UpdateTime);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
/// <summary>取得微信公众号回复规则字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>规则名称</summary>
|
||||
public const String RuleName = "RuleName";
|
||||
|
||||
/// <summary>请求关键词,逗号分隔</summary>
|
||||
public const String Keywords = "Keywords";
|
||||
|
||||
/// <summary>请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)</summary>
|
||||
public const String RequestType = "RequestType";
|
||||
|
||||
/// <summary>回复类型(1文本2图文3语音4视频5第三方接口)</summary>
|
||||
public const String ResponseType = "ResponseType";
|
||||
|
||||
/// <summary>是否模糊查询 0 是完全匹配;1是模糊匹配</summary>
|
||||
public const String IsLikeQuery = "IsLikeQuery";
|
||||
|
||||
/// <summary>是否是默认回复</summary>
|
||||
public const String IsDefault = "IsDefault";
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public const String Rank = "Rank";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>微信公众号回复规则接口</summary>
|
||||
public partial interface IWeixinRequestRule
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>规则名称</summary>
|
||||
String RuleName { get; set; }
|
||||
|
||||
/// <summary>请求关键词,逗号分隔</summary>
|
||||
String Keywords { get; set; }
|
||||
|
||||
/// <summary>请求类型(0默认回复1文字2图片3语音4链接5地理位置6关注7取消关注8扫描带参数二维码事件9上报地理位置事件10自定义菜单事件)</summary>
|
||||
Int32 RequestType { get; set; }
|
||||
|
||||
/// <summary>回复类型(1文本2图文3语音4视频5第三方接口)</summary>
|
||||
Int32 ResponseType { get; set; }
|
||||
|
||||
/// <summary>是否模糊查询 0 是完全匹配;1是模糊匹配</summary>
|
||||
Int32 IsLikeQuery { get; set; }
|
||||
|
||||
/// <summary>是否是默认回复</summary>
|
||||
Int32 IsDefault { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
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 WeixinRequestContent : Entity<WeixinRequestContent>
|
||||
{
|
||||
#region 对象操作
|
||||
static WeixinRequestContent()
|
||||
{
|
||||
// 累加字段
|
||||
//var df = Meta.Factory.AdditionalFields;
|
||||
//df.Add(__.RuleId);
|
||||
|
||||
// 过滤器 UserModule、TimeModule、IPModule
|
||||
Meta.Modules.Add<TimeModule>();
|
||||
}
|
||||
|
||||
/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
|
||||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
// 如果没有脏数据,则不需要进行任何处理
|
||||
if (!HasDirty) return;
|
||||
|
||||
// 在新插入数据或者修改了指定字段时进行修正
|
||||
//if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
///// <summary>首次连接数据库时初始化数据,仅用于实体类重载,用户不应该调用该方法</summary>
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//protected override void InitData()
|
||||
//{
|
||||
// // InitData一般用于当数据表没有数据时添加一些默认数据,该实体类的任何第一次数据库操作都会触发该方法,默认异步调用
|
||||
// if (Meta.Session.Count > 0) return;
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("开始初始化WeixinRequestContent[请求回复的内容]数据……");
|
||||
|
||||
// var entity = new WeixinRequestContent();
|
||||
// entity.Id = 0;
|
||||
// entity.RuleId = 0;
|
||||
// entity.Title = "abc";
|
||||
// entity.Content = "abc";
|
||||
// entity.LinkUrl = "abc";
|
||||
// entity.ImgURL = "abc";
|
||||
// entity.MediaURL = "abc";
|
||||
// entity.MeidaHdURL = "abc";
|
||||
// entity.MediaID = "abc";
|
||||
// entity.WXAppAppId = "abc";
|
||||
// entity.WXAppPage = "abc";
|
||||
// entity.Rank = 0;
|
||||
// entity.AddTime = DateTime.Now;
|
||||
// entity.UpdateTime = DateTime.Now;
|
||||
// entity.Insert();
|
||||
|
||||
// if (XTrace.Debug) XTrace.WriteLine("完成初始化WeixinRequestContent[请求回复的内容]数据!");
|
||||
//}
|
||||
|
||||
///// <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 WeixinRequestContent 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 高级查询
|
||||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using XCode;
|
||||
using XCode.Configuration;
|
||||
using XCode.DataAccessLayer;
|
||||
|
||||
namespace COMCMS.Core
|
||||
{
|
||||
/// <summary>请求回复的内容</summary>
|
||||
[Serializable]
|
||||
[DataObject]
|
||||
[Description("请求回复的内容")]
|
||||
[BindTable("WeixinRequestContent", Description = "请求回复的内容", ConnName = "dbconn", DbType = DatabaseType.SqlServer)]
|
||||
public partial class WeixinRequestContent : IWeixinRequestContent
|
||||
{
|
||||
#region 属性
|
||||
private Int32 _Id;
|
||||
/// <summary>编号</summary>
|
||||
[DisplayName("编号")]
|
||||
[Description("编号")]
|
||||
[DataObjectField(true, true, false, 0)]
|
||||
[BindColumn("Id", "编号", "")]
|
||||
public Int32 Id { get { return _Id; } set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }
|
||||
|
||||
private Int32 _RuleId;
|
||||
/// <summary>规则名称</summary>
|
||||
[DisplayName("规则名称")]
|
||||
[Description("规则名称")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("RuleId", "规则名称", "")]
|
||||
public Int32 RuleId { get { return _RuleId; } set { if (OnPropertyChanging(__.RuleId, value)) { _RuleId = value; OnPropertyChanged(__.RuleId); } } }
|
||||
|
||||
private String _Title;
|
||||
/// <summary>回复标题</summary>
|
||||
[DisplayName("回复标题")]
|
||||
[Description("回复标题")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("Title", "回复标题", "", Master = true)]
|
||||
public String Title { get { return _Title; } set { if (OnPropertyChanging(__.Title, value)) { _Title = value; OnPropertyChanged(__.Title); } } }
|
||||
|
||||
private String _Content;
|
||||
/// <summary>回复内容</summary>
|
||||
[DisplayName("回复内容")]
|
||||
[Description("回复内容")]
|
||||
[DataObjectField(false, false, true, -1)]
|
||||
[BindColumn("Content", "回复内容", "")]
|
||||
public String Content { get { return _Content; } set { if (OnPropertyChanging(__.Content, value)) { _Content = value; OnPropertyChanged(__.Content); } } }
|
||||
|
||||
private String _LinkUrl;
|
||||
/// <summary>详情链接地址</summary>
|
||||
[DisplayName("详情链接地址")]
|
||||
[Description("详情链接地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("LinkUrl", "详情链接地址", "")]
|
||||
public String LinkUrl { get { return _LinkUrl; } set { if (OnPropertyChanging(__.LinkUrl, value)) { _LinkUrl = value; OnPropertyChanged(__.LinkUrl); } } }
|
||||
|
||||
private String _ImgURL;
|
||||
/// <summary>图片地址</summary>
|
||||
[DisplayName("图片地址")]
|
||||
[Description("图片地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("ImgURL", "图片地址", "")]
|
||||
public String ImgURL { get { return _ImgURL; } set { if (OnPropertyChanging(__.ImgURL, value)) { _ImgURL = value; OnPropertyChanged(__.ImgURL); } } }
|
||||
|
||||
private String _MediaURL;
|
||||
/// <summary>语音或视频地址</summary>
|
||||
[DisplayName("语音或视频地址")]
|
||||
[Description("语音或视频地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("MediaURL", "语音或视频地址", "")]
|
||||
public String MediaURL { get { return _MediaURL; } set { if (OnPropertyChanging(__.MediaURL, value)) { _MediaURL = value; OnPropertyChanged(__.MediaURL); } } }
|
||||
|
||||
private String _MeidaHdURL;
|
||||
/// <summary>高清语音或者视频地址</summary>
|
||||
[DisplayName("高清语音或者视频地址")]
|
||||
[Description("高清语音或者视频地址")]
|
||||
[DataObjectField(false, false, true, 250)]
|
||||
[BindColumn("MeidaHdURL", "高清语音或者视频地址", "")]
|
||||
public String MeidaHdURL { get { return _MeidaHdURL; } set { if (OnPropertyChanging(__.MeidaHdURL, value)) { _MeidaHdURL = value; OnPropertyChanged(__.MeidaHdURL); } } }
|
||||
|
||||
private String _MediaID;
|
||||
/// <summary>返回的素材ID</summary>
|
||||
[DisplayName("返回的素材ID")]
|
||||
[Description("返回的素材ID")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("MediaID", "返回的素材ID", "")]
|
||||
public String MediaID { get { return _MediaID; } set { if (OnPropertyChanging(__.MediaID, value)) { _MediaID = value; OnPropertyChanged(__.MediaID); } } }
|
||||
|
||||
private String _WXAppAppId;
|
||||
/// <summary>小程序APPId</summary>
|
||||
[DisplayName("小程序APPId")]
|
||||
[Description("小程序APPId")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("WXAppAppId", "小程序APPId", "")]
|
||||
public String WXAppAppId { get { return _WXAppAppId; } set { if (OnPropertyChanging(__.WXAppAppId, value)) { _WXAppAppId = value; OnPropertyChanged(__.WXAppAppId); } } }
|
||||
|
||||
private String _WXAppPage;
|
||||
/// <summary>小程序页面</summary>
|
||||
[DisplayName("小程序页面")]
|
||||
[Description("小程序页面")]
|
||||
[DataObjectField(false, false, true, 100)]
|
||||
[BindColumn("WXAppPage", "小程序页面", "")]
|
||||
public String WXAppPage { get { return _WXAppPage; } set { if (OnPropertyChanging(__.WXAppPage, value)) { _WXAppPage = value; OnPropertyChanged(__.WXAppPage); } } }
|
||||
|
||||
private Int32 _Rank;
|
||||
/// <summary>排序</summary>
|
||||
[DisplayName("排序")]
|
||||
[Description("排序")]
|
||||
[DataObjectField(false, false, false, 0)]
|
||||
[BindColumn("Rank", "排序", "")]
|
||||
public Int32 Rank { get { return _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 { return _AddTime; } set { if (OnPropertyChanging(__.AddTime, value)) { _AddTime = value; OnPropertyChanged(__.AddTime); } } }
|
||||
|
||||
private DateTime _UpdateTime;
|
||||
/// <summary>修改时间</summary>
|
||||
[DisplayName("修改时间")]
|
||||
[Description("修改时间")]
|
||||
[DataObjectField(false, false, true, 0)]
|
||||
[BindColumn("UpdateTime", "修改时间", "")]
|
||||
public DateTime UpdateTime { get { return _UpdateTime; } set { if (OnPropertyChanging(__.UpdateTime, value)) { _UpdateTime = value; OnPropertyChanged(__.UpdateTime); } } }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
public override Object this[String name]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : return _Id;
|
||||
case __.RuleId : return _RuleId;
|
||||
case __.Title : return _Title;
|
||||
case __.Content : return _Content;
|
||||
case __.LinkUrl : return _LinkUrl;
|
||||
case __.ImgURL : return _ImgURL;
|
||||
case __.MediaURL : return _MediaURL;
|
||||
case __.MeidaHdURL : return _MeidaHdURL;
|
||||
case __.MediaID : return _MediaID;
|
||||
case __.WXAppAppId : return _WXAppAppId;
|
||||
case __.WXAppPage : return _WXAppPage;
|
||||
case __.Rank : return _Rank;
|
||||
case __.AddTime : return _AddTime;
|
||||
case __.UpdateTime : return _UpdateTime;
|
||||
default: return base[name];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case __.Id : _Id = value.ToInt(); break;
|
||||
case __.RuleId : _RuleId = value.ToInt(); break;
|
||||
case __.Title : _Title = Convert.ToString(value); break;
|
||||
case __.Content : _Content = Convert.ToString(value); break;
|
||||
case __.LinkUrl : _LinkUrl = Convert.ToString(value); break;
|
||||
case __.ImgURL : _ImgURL = Convert.ToString(value); break;
|
||||
case __.MediaURL : _MediaURL = Convert.ToString(value); break;
|
||||
case __.MeidaHdURL : _MeidaHdURL = Convert.ToString(value); break;
|
||||
case __.MediaID : _MediaID = Convert.ToString(value); break;
|
||||
case __.WXAppAppId : _WXAppAppId = Convert.ToString(value); break;
|
||||
case __.WXAppPage : _WXAppPage = Convert.ToString(value); break;
|
||||
case __.Rank : _Rank = value.ToInt(); break;
|
||||
case __.AddTime : _AddTime = value.ToDateTime(); break;
|
||||
case __.UpdateTime : _UpdateTime = 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>规则名称</summary>
|
||||
public static readonly Field RuleId = FindByName(__.RuleId);
|
||||
|
||||
/// <summary>回复标题</summary>
|
||||
public static readonly Field Title = FindByName(__.Title);
|
||||
|
||||
/// <summary>回复内容</summary>
|
||||
public static readonly Field Content = FindByName(__.Content);
|
||||
|
||||
/// <summary>详情链接地址</summary>
|
||||
public static readonly Field LinkUrl = FindByName(__.LinkUrl);
|
||||
|
||||
/// <summary>图片地址</summary>
|
||||
public static readonly Field ImgURL = FindByName(__.ImgURL);
|
||||
|
||||
/// <summary>语音或视频地址</summary>
|
||||
public static readonly Field MediaURL = FindByName(__.MediaURL);
|
||||
|
||||
/// <summary>高清语音或者视频地址</summary>
|
||||
public static readonly Field MeidaHdURL = FindByName(__.MeidaHdURL);
|
||||
|
||||
/// <summary>返回的素材ID</summary>
|
||||
public static readonly Field MediaID = FindByName(__.MediaID);
|
||||
|
||||
/// <summary>小程序APPId</summary>
|
||||
public static readonly Field WXAppAppId = FindByName(__.WXAppAppId);
|
||||
|
||||
/// <summary>小程序页面</summary>
|
||||
public static readonly Field WXAppPage = FindByName(__.WXAppPage);
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public static readonly Field Rank = FindByName(__.Rank);
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public static readonly Field AddTime = FindByName(__.AddTime);
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public static readonly Field UpdateTime = FindByName(__.UpdateTime);
|
||||
|
||||
static Field FindByName(String name) { return Meta.Table.FindByName(name); }
|
||||
}
|
||||
|
||||
/// <summary>取得请求回复的内容字段名称的快捷方式</summary>
|
||||
public partial class __
|
||||
{
|
||||
/// <summary>编号</summary>
|
||||
public const String Id = "Id";
|
||||
|
||||
/// <summary>规则名称</summary>
|
||||
public const String RuleId = "RuleId";
|
||||
|
||||
/// <summary>回复标题</summary>
|
||||
public const String Title = "Title";
|
||||
|
||||
/// <summary>回复内容</summary>
|
||||
public const String Content = "Content";
|
||||
|
||||
/// <summary>详情链接地址</summary>
|
||||
public const String LinkUrl = "LinkUrl";
|
||||
|
||||
/// <summary>图片地址</summary>
|
||||
public const String ImgURL = "ImgURL";
|
||||
|
||||
/// <summary>语音或视频地址</summary>
|
||||
public const String MediaURL = "MediaURL";
|
||||
|
||||
/// <summary>高清语音或者视频地址</summary>
|
||||
public const String MeidaHdURL = "MeidaHdURL";
|
||||
|
||||
/// <summary>返回的素材ID</summary>
|
||||
public const String MediaID = "MediaID";
|
||||
|
||||
/// <summary>小程序APPId</summary>
|
||||
public const String WXAppAppId = "WXAppAppId";
|
||||
|
||||
/// <summary>小程序页面</summary>
|
||||
public const String WXAppPage = "WXAppPage";
|
||||
|
||||
/// <summary>排序</summary>
|
||||
public const String Rank = "Rank";
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
public const String AddTime = "AddTime";
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
public const String UpdateTime = "UpdateTime";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>请求回复的内容接口</summary>
|
||||
public partial interface IWeixinRequestContent
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>编号</summary>
|
||||
Int32 Id { get; set; }
|
||||
|
||||
/// <summary>规则名称</summary>
|
||||
Int32 RuleId { get; set; }
|
||||
|
||||
/// <summary>回复标题</summary>
|
||||
String Title { get; set; }
|
||||
|
||||
/// <summary>回复内容</summary>
|
||||
String Content { get; set; }
|
||||
|
||||
/// <summary>详情链接地址</summary>
|
||||
String LinkUrl { get; set; }
|
||||
|
||||
/// <summary>图片地址</summary>
|
||||
String ImgURL { get; set; }
|
||||
|
||||
/// <summary>语音或视频地址</summary>
|
||||
String MediaURL { get; set; }
|
||||
|
||||
/// <summary>高清语音或者视频地址</summary>
|
||||
String MeidaHdURL { get; set; }
|
||||
|
||||
/// <summary>返回的素材ID</summary>
|
||||
String MediaID { get; set; }
|
||||
|
||||
/// <summary>小程序APPId</summary>
|
||||
String WXAppAppId { get; set; }
|
||||
|
||||
/// <summary>小程序页面</summary>
|
||||
String WXAppPage { get; set; }
|
||||
|
||||
/// <summary>排序</summary>
|
||||
Int32 Rank { get; set; }
|
||||
|
||||
/// <summary>添加时间</summary>
|
||||
DateTime AddTime { get; set; }
|
||||
|
||||
/// <summary>修改时间</summary>
|
||||
DateTime UpdateTime { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 获取/设置 字段值
|
||||
/// <summary>获取/设置 字段值</summary>
|
||||
/// <param name="name">字段名</param>
|
||||
/// <returns></returns>
|
||||
Object this[String name] { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,34 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "文章栏目标题不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
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 (!AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.Insert();
|
||||
Core.Admin.WriteLogActions("添加文章栏目(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
@@ -127,6 +155,32 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
Json(tip);
|
||||
}
|
||||
|
||||
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 (!AdminUtils.CheckFilePathIsOK(model.FilePath, entity.Id, 0))
|
||||
{
|
||||
tip.Message = "栏目路径不可用,请重新填写!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (entity.PId != model.PId)
|
||||
{
|
||||
if (entity.Id == model.PId)
|
||||
@@ -149,6 +203,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
alist.Save();
|
||||
}
|
||||
}
|
||||
bool idNeedUpdateAllArticleFilePath = entity.FilePath == model.FilePath;
|
||||
//赋值
|
||||
entity.PId = model.PId;
|
||||
entity.KindName = model.KindName;
|
||||
@@ -171,9 +226,23 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
entity.KindDomain = model.KindDomain;
|
||||
entity.Rank = model.Rank;
|
||||
entity.Pic = model.Pic;
|
||||
entity.FilePath = model.FilePath;
|
||||
|
||||
|
||||
entity.Save();
|
||||
//修改所有文章的路径
|
||||
if (idNeedUpdateAllArticleFilePath)
|
||||
{
|
||||
IList<Article> listArticles = Article.FindAll(Article._.KId == entity.Id, null, null, 0, 0);
|
||||
if(listArticles !=null && listArticles.Count > 0)
|
||||
{
|
||||
foreach (var item in listArticles)
|
||||
{
|
||||
item.FilePath = entity.FilePath;
|
||||
}
|
||||
listArticles.BatchUpdate();
|
||||
}
|
||||
}
|
||||
Core.Admin.WriteLogActions("修改文章栏目(id:" + entity.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "修改文章栏目成功";
|
||||
@@ -276,8 +345,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
IList<Article> list = Article.FindAll(ex, Article._.Sequence.Asc().And(Article._.Id.Desc()), null, startRowIndex, numPerPage);
|
||||
long totalCount = Article.FindCount(ex, Article._.Sequence.Asc().And(Article._.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 }, JsonRequestBehavior.AllowGet);
|
||||
//return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain");
|
||||
return Json(new { total = totalCount, rows = list });
|
||||
}
|
||||
|
||||
//添加文章
|
||||
@@ -414,8 +483,6 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//处理三个勾选属性的
|
||||
string isnew = Request.Form["IsNew"];
|
||||
model.IsNew = isnew == "1" ? 1 : 0;
|
||||
|
||||
@@ -424,6 +491,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
string IsHide = Request.Form["IsHide"];
|
||||
model.IsHide = IsHide == "1" ? 1 : 0;
|
||||
//处理三个勾选属性的
|
||||
|
||||
model.Hits = entity.Hits;
|
||||
model.UpdateTime = DateTime.Now;
|
||||
|
||||
@@ -434,8 +503,43 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
content = ThumbnailHelper.SaveRemoteImgForContent(content);
|
||||
model.Content = content;
|
||||
}
|
||||
|
||||
|
||||
entity.AddTime = model.AddTime;
|
||||
entity.AdsId = model.AdsId;
|
||||
entity.BannerImg = model.BannerImg;
|
||||
entity.Content = model.Content;
|
||||
entity.Description = model.Description;
|
||||
entity.FilePath = model.FilePath;
|
||||
entity.Hits = model.Hits;
|
||||
entity.Icon = model.Icon;
|
||||
entity.IsBest = model.IsBest;
|
||||
entity.IsComment = model.IsComment;
|
||||
entity.IsDel = model.IsDel;
|
||||
entity.IsHide = model.IsHide;
|
||||
entity.IsLock = model.IsLock;
|
||||
entity.IsMember = model.IsMember;
|
||||
entity.IsNew = model.IsNew;
|
||||
entity.IsRecommend = model.IsRecommend;
|
||||
entity.IsTop = model.IsTop;
|
||||
entity.ItemImg = morIMG;
|
||||
entity.Keyword = model.Keyword;
|
||||
entity.KId = model.KId;
|
||||
entity.LinkURL = model.LinkURL;
|
||||
entity.Location = model.Location;
|
||||
entity.Origin = model.Origin;
|
||||
entity.OriginURL = model.OriginURL;
|
||||
entity.Pic = model.Pic;
|
||||
entity.Sequence = model.Sequence;
|
||||
entity.SubTitle = model.SubTitle;
|
||||
entity.Tags = model.Tags;
|
||||
entity.TemplateFile = model.TemplateFile;
|
||||
entity.Title = model.Title;
|
||||
entity.TitleColor = model.TitleColor;
|
||||
entity.UpdateTime = DateTime.Now;
|
||||
|
||||
//model.AuthorId = Core.Admin.GetMyInfo().Id;
|
||||
model.Save();
|
||||
entity.Update();
|
||||
//Tag.ModifyTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title);
|
||||
Core.Admin.WriteLogActions("编辑文章(id:" + model.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
@@ -466,5 +570,131 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 迁移文章
|
||||
[HttpGet]
|
||||
[MyAuthorize("batch", "article")]
|
||||
public IActionResult MoveArticle()
|
||||
{
|
||||
//获取上级栏目
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, true, false);
|
||||
ViewBag.ListKinds = list;
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
[MyAuthorize("batch", "article", "JSON")]
|
||||
public IActionResult MoveArticle(int from, int to)
|
||||
{
|
||||
if (from <= 0 || to <= 0)
|
||||
{
|
||||
tip.Message = "请选择好栏目";
|
||||
return Json(tip);
|
||||
}
|
||||
if (from == to)
|
||||
{
|
||||
tip.Message = "迁移前后栏目一致,无法迁移";
|
||||
return Json(tip);
|
||||
}
|
||||
Article.Update("KId=" + to, "KId=" + from);
|
||||
Core.Admin.WriteLogActions("迁移文章(from:" + from + ",to:" + to + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "迁移文章成功";
|
||||
tip.ReturnUrl = "close";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 批量隐藏文章
|
||||
[HttpPost]
|
||||
[MyAuthorize("batch", "article", "JSON")]
|
||||
public IActionResult DoBatchHideArticle(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 = 1;
|
||||
}
|
||||
|
||||
list.Update();
|
||||
Admin.WriteLogActions($"批量隐藏文章:{ids};");
|
||||
tip.Message = "批量隐藏文章成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 批量显示文章
|
||||
[HttpPost]
|
||||
[MyAuthorize("batch", "article", "JSON")]
|
||||
public IActionResult DoBatchShowArticle(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.Update();
|
||||
Admin.WriteLogActions($"批量显示文章:{ids};");
|
||||
tip.Message = "批量显示文章成功!";
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,16 @@ using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[DisplayName("留言板")]
|
||||
public class GuestbookController : AdminBaseController
|
||||
{
|
||||
#region 留言板分类
|
||||
[MyAuthorize("viewlist", "guestbookkinds")]
|
||||
[DisplayName("留言分类")]
|
||||
public IActionResult GuestbookCategorys()
|
||||
{
|
||||
IList<GuestbookCategory> list = GuestbookCategory.FindAll(null, GuestbookCategory._.Rank.Asc(), null, 0, 0);
|
||||
@@ -93,12 +96,14 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 留言列表
|
||||
[MyAuthorize("viewlist", "guestbook")]
|
||||
[DisplayName("留言列表")]
|
||||
public IActionResult GuestbookList()
|
||||
{
|
||||
IList<GuestbookCategory> list = GuestbookCategory.FindAll(null, GuestbookCategory._.Rank.Asc(), null, 0, 0);
|
||||
ViewBag.ListKinds = list;
|
||||
return View();
|
||||
}
|
||||
|
||||
[MyAuthorize("viewlist", "guestbook","JSON")]
|
||||
public IActionResult GetGuesbookList(string keyword, int page = 1, int limit = 20)
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[Area("AdminCP")]
|
||||
public class IndexController : AdminBaseController
|
||||
{
|
||||
private readonly IHostingEnvironment _env;
|
||||
public IndexController(IHostingEnvironment env)
|
||||
private readonly IWebHostEnvironment _env;
|
||||
public IndexController(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
@@ -32,7 +32,6 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
Admin admin = Admin.GetMyInfo();
|
||||
ViewBag.admin = admin;
|
||||
|
||||
//获取菜单
|
||||
List<AdminMenu> list = new List<AdminMenu>();
|
||||
//这里需要获取权限,暂时先所有
|
||||
|
||||
@@ -56,6 +56,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
}
|
||||
//判断并解密
|
||||
string key = SessionHelper.GetSession("des_key").ToString();
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
tip.Message = "页面访问超时,请刷新页面重新登录!";
|
||||
tip.Other = "reload";
|
||||
return Json(tip);
|
||||
}
|
||||
//解密
|
||||
string username = "";
|
||||
string password = "";
|
||||
@@ -67,14 +73,15 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
catch (Exception exp)
|
||||
{
|
||||
NewLife.Log.XTrace.WriteException(exp);
|
||||
tip.Message = "用户名或者密码错误!";
|
||||
tip.Message = "页面访问超时,请刷新页面重新登录!";
|
||||
tip.Other = "reload";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
//验证用户
|
||||
if (string.IsNullOrEmpty(username))
|
||||
{
|
||||
tip.Message = "请输入用户名!"+ key;
|
||||
tip.Message = "请输入用户名!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(password) || Utils.GetStringLength(password) < 5)
|
||||
@@ -115,8 +122,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// <returns></returns>
|
||||
public IActionResult Logout()
|
||||
{
|
||||
//Admin.ClearInfo();
|
||||
Admin.ClearInfoAsync().Wait();
|
||||
Admin.ClearInfo();
|
||||
//Admin.ClearInfoAsync().Wait();
|
||||
return Redirect("~/AdminCP/Login");
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -592,6 +592,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 用户组管理
|
||||
[MyAuthorize( "viewlist", "memberrole")]
|
||||
[DisplayName("用户组列表")]
|
||||
public IActionResult MemberRole()
|
||||
{
|
||||
IList<MemberRoles> list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0);
|
||||
@@ -786,6 +787,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 用户管理
|
||||
[MyAuthorize("viewlist", "members")]
|
||||
[DisplayName("用户列表")]
|
||||
public IActionResult Members()
|
||||
{
|
||||
//加载用户组
|
||||
@@ -1026,11 +1028,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 后台管理日志列表
|
||||
[MyAuthorize("viewlist", "admincplog")]
|
||||
[DisplayName("后台管理日志")]
|
||||
public IActionResult AdminCPLogList()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[MyAuthorize("viewlist", "admincplog")]
|
||||
[MyAuthorize("viewlist", "admincplog","JSON")]
|
||||
public IActionResult GetAdminCPLogList(string keyword, int page = 1, int limit = 20)
|
||||
{
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -12,10 +13,12 @@ using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[DisplayName("订单")]
|
||||
public class OrderController : AdminBaseController
|
||||
{
|
||||
#region 订单列表
|
||||
[MyAuthorize("viewlist", "order")]
|
||||
[DisplayName("订单列表")]
|
||||
public IActionResult OrderList()
|
||||
{
|
||||
Core.Admin.WriteLogActions("查看订单列表;");
|
||||
@@ -298,6 +301,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 在线支付成功记录
|
||||
[MyAuthorize("viewlist", "payonline")]
|
||||
[DisplayName("支付订单")]
|
||||
public IActionResult PayOnlineList()
|
||||
{
|
||||
Core.Admin.WriteLogActions("查看在线支付订单列表;");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -13,11 +14,13 @@ using COMCMS.Core.Models;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[DisplayName("其它")]
|
||||
public class OtherController : AdminBaseController
|
||||
{
|
||||
#region 广告分类管理
|
||||
//查看&编辑广告分类(同一个页面执行)
|
||||
[MyAuthorize("viewlist", "adskinds")]
|
||||
[DisplayName("广告分类")]
|
||||
public IActionResult AdsCategoryList()
|
||||
{
|
||||
IList<AdsKind> list = AdsKind.FindAll(null, AdsKind._.Rank.Asc(), null, 0, 0);
|
||||
@@ -96,6 +99,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 广告管理
|
||||
[MyAuthorize("viewlist", "ads")]
|
||||
[DisplayName("广告列表")]
|
||||
public IActionResult AdsList()
|
||||
{
|
||||
IList<AdsKind> list = AdsKind.FindAll(null, AdsKind._.Rank.Asc(), null, 0, 0);
|
||||
@@ -528,6 +532,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
#region 友情链接分类管理
|
||||
//查看&编辑友情链接分类(同一个页面执行)
|
||||
[MyAuthorize("viewlist", "adskinds")]
|
||||
[DisplayName("友情链接分类")]
|
||||
public IActionResult LinkCategoryList()
|
||||
{
|
||||
IList<LinkKind> list = LinkKind.FindAll(null, LinkKind._.Rank.Asc(), null, 0, 0);
|
||||
@@ -608,6 +613,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
#region 友情链接管理
|
||||
//查看友情链接列表
|
||||
[MyAuthorize("viewlist", "link")]
|
||||
[DisplayName("友情链接列表")]
|
||||
|
||||
public IActionResult LinkList()
|
||||
{
|
||||
IList<LinkKind> list = LinkKind.FindAll(null, LinkKind._.Rank.Asc(), null, 0, 0);
|
||||
|
||||
@@ -10,6 +10,11 @@ using XCode;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.IO;
|
||||
using NewLife.Log;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using System.Text;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
@@ -17,6 +22,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[DisplayName("后台权限")]
|
||||
public class PermissionController : AdminBaseController
|
||||
{
|
||||
private IWebHostEnvironment _env;
|
||||
public PermissionController(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
#region 事件管理
|
||||
/// <summary>
|
||||
/// 目标事件
|
||||
@@ -329,5 +340,77 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统运行日志
|
||||
[HttpGet]
|
||||
[MyAuthorize("viewlist", "runlogs")]
|
||||
[DisplayName("系统运行日志")]
|
||||
public IActionResult RunLogs()
|
||||
{
|
||||
string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}";
|
||||
List<string> lognames = new List<string>();
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(logPath))
|
||||
{
|
||||
DirectoryInfo directory = new DirectoryInfo(logPath);
|
||||
List<string> listFiles = new List<string>();
|
||||
DirectoryInfo[] directorys = directory.GetDirectories();
|
||||
FileInfo[] files;
|
||||
files = directory.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
lognames.Add(file.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
XTrace.WriteException(ex);
|
||||
}
|
||||
lognames.Reverse();//倒序排列一下
|
||||
ViewBag.logPath = logPath;
|
||||
return View(lognames);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取日志详情
|
||||
[HttpPost]
|
||||
[MyAuthorize("viewlist", "runlogs")]
|
||||
public async Task<IActionResult> GetRunLogDetail(string logname)
|
||||
{
|
||||
if (string.IsNullOrEmpty(logname))
|
||||
{
|
||||
return Content("错误日志名称!");
|
||||
}
|
||||
string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}";
|
||||
string logFullPath = logPath + logname;
|
||||
|
||||
|
||||
if (!System.IO.File.Exists(logFullPath))
|
||||
{
|
||||
return Content("系统找不到本日志文件!");
|
||||
}
|
||||
//XTrace.WriteLine("查看日志:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
IFileProvider fileProvider = new PhysicalFileProvider(logPath);
|
||||
StringBuilder detail = new StringBuilder();
|
||||
using (Stream stream = fileProvider.GetFileInfo(logname).CreateReadStream())
|
||||
{
|
||||
byte[] buffer = new byte[stream.Length];
|
||||
await stream.ReadAsync(buffer, 0, buffer.Length);
|
||||
detail.Append(Encoding.Default.GetString(buffer));
|
||||
}
|
||||
|
||||
|
||||
//using (StreamReader fs = new StreamReader(logFullPath))
|
||||
//{
|
||||
// detail.Append(fs.ReadToEndAsync());
|
||||
//}
|
||||
|
||||
//string detail = await System.IO.File.ReadAllTextAsync(logFullPath);
|
||||
return Content(detail.ToString());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -12,6 +13,7 @@ using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[DisplayName("商品")]
|
||||
public class ProductController : AdminBaseController
|
||||
{
|
||||
#region 商品栏目
|
||||
@@ -20,6 +22,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MyAuthorize("viewlist", "category")]
|
||||
[DisplayName("商品栏目")]
|
||||
public IActionResult CategoryList()
|
||||
{
|
||||
IList<Category> list = Category.GetListTree(0, -1, false, true);
|
||||
@@ -187,6 +190,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 商品列表
|
||||
[MyAuthorize("viewlist", "product")]
|
||||
[DisplayName("商品列表")]
|
||||
public IActionResult ProductList()
|
||||
{
|
||||
//获取上级栏目
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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 ServerController : AdminBaseController
|
||||
{
|
||||
#region 中文转拼音
|
||||
public IActionResult Hanzi2Pinyin(string name)
|
||||
{
|
||||
string pinyin = "";
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
pinyin = PinYinHelper.GetPinyin(name).ToLower().Replace(" ","-");
|
||||
}
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = pinyin;
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
[Area("AdminCP")]
|
||||
public class SystemController : AdminBaseController
|
||||
{
|
||||
private IHostingEnvironment _env;
|
||||
public SystemController(IHostingEnvironment env)
|
||||
private IWebHostEnvironment _env;
|
||||
public SystemController(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ using COMCMS.Core.Models;
|
||||
using System.DrawingCore;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Internal;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using NewLife.UserGroup.WebUploader;
|
||||
|
||||
@@ -47,9 +46,9 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
public class UploadController : AdminBaseController
|
||||
{
|
||||
private readonly SystemSetting _attachsetting;
|
||||
private IHostingEnvironment _env;
|
||||
private IWebHostEnvironment _env;
|
||||
private AttachConfigEntity attach;
|
||||
public UploadController(IHostingEnvironment env, IOptions<SystemSetting> attachsetting)
|
||||
public UploadController(IWebHostEnvironment env, IOptions<SystemSetting> attachsetting)
|
||||
{
|
||||
attach = Config.GetSystemConfig().AttachConfigEntity;
|
||||
_env = env;
|
||||
@@ -264,6 +263,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
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(upload.FileName);
|
||||
switch (attach.IsRandomFileName)
|
||||
@@ -357,7 +358,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
fileName = imgname,
|
||||
uploaded = 1,
|
||||
url = $"/{attach.AttachPatch}/images/{imgPath.Replace("\\", "/")}/" + imgname
|
||||
url = $"/{attach.AttachPatch}/files/{imgPath.Replace("\\", "/")}/" + imgname
|
||||
};
|
||||
return Json(successJson);
|
||||
//return Content(string.Format(tpl, $"/{attach.AttachPatch}/fales/{imgPath.Replace("\\", "/")}/" + imgname, callback, ""), "text/html");
|
||||
@@ -422,7 +423,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
var req = HttpContext.Request;
|
||||
var f = Request.Form.Files[0];
|
||||
|
||||
Request.EnableRewind();
|
||||
//Request.EnableRewind();
|
||||
Image image = null;
|
||||
using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章标题:</label>
|
||||
<label class="col-sm-3 control-label text-danger">文章标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题">
|
||||
</div>
|
||||
@@ -110,6 +110,9 @@
|
||||
<label class="col-sm-3 control-label">文章图片:</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="Pic" name="Pic" maxlength="250" type="text" class="form-control upload-path" placeholder="请选择或上传一个图片" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写栏目名称">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写栏目名称" onblur="aoutoTransform()">
|
||||
</div>
|
||||
</div>
|
||||
<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级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -154,4 +160,28 @@
|
||||
DoPost("addArticleKindForm");
|
||||
CKEDITOR.replace('KindInfo');
|
||||
})
|
||||
function aoutoTransform() {
|
||||
var title = $("#KindName").val();
|
||||
var filePath = $("#FilePath").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);
|
||||
}
|
||||
} else {
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -41,7 +41,15 @@
|
||||
<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>
|
||||
@@ -105,45 +113,45 @@
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: true, //是否启用点击选中行
|
||||
height: 0, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
uniqueId: "id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
field: 'id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'ArticleKind.KindName',
|
||||
field: 'articleKind.kindName',
|
||||
title: '所属栏目'
|
||||
}, {
|
||||
field: 'Title',
|
||||
field: 'title',
|
||||
title: '文章标题'
|
||||
}, {
|
||||
field: 'Sequence',
|
||||
field: 'sequence',
|
||||
title: '排序'
|
||||
}, {
|
||||
field: 'AddTime',
|
||||
field: 'addTime',
|
||||
title: '添加时间'
|
||||
}, {
|
||||
field: 'IsNew',
|
||||
field: 'isNew',
|
||||
title: '最新',
|
||||
align: 'center',
|
||||
formatter: 'newFormatter'
|
||||
}, {
|
||||
field: 'IsRecommend',
|
||||
field: 'isRecommend',
|
||||
title: '推荐',
|
||||
align: 'center',
|
||||
formatter: 'recommendFormatter'
|
||||
}, {
|
||||
field: 'IsHide',
|
||||
field: 'isHide',
|
||||
title: '隐藏',
|
||||
align: 'center',
|
||||
formatter: 'hideFormatter'
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
field: 'id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
@@ -205,6 +213,92 @@
|
||||
|
||||
return oInit;
|
||||
};
|
||||
function doBatchHide() {
|
||||
var list = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||
var ids = [];
|
||||
if (!list || list.length <1) {
|
||||
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)},
|
||||
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;
|
||||
}
|
||||
|
||||
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>
|
||||
</div>
|
||||
|
||||
@@ -109,6 +109,9 @@
|
||||
<label class="col-sm-3 control-label">文章图片:</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="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>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">栏目名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" value="@Model.KindName" required aria-required="true" placeholder="填写栏目名称">
|
||||
<input id="KindName" name="KindName" maxlength="200" type="text" class="form-control" value="@Model.KindName" required aria-required="true" placeholder="填写栏目名称" onblur="aoutoTransform()">
|
||||
</div>
|
||||
</div>
|
||||
<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级目录,可以输入字母、数字和-">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -37,6 +43,7 @@
|
||||
<input id="SubTitle" type="text" class="form-control" name="SubTitle" placeholder="栏目副标题,非必填" value="@Model.SubTitle" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -157,5 +164,29 @@
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp", notwater: true });
|
||||
DoPost("editArticleKindForm");
|
||||
CKEDITOR.replace('KindInfo');
|
||||
})
|
||||
});
|
||||
function aoutoTransform() {
|
||||
var title = $("#KindName").val();
|
||||
var filePath = $("#FilePath").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);
|
||||
}
|
||||
} else {
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,58 @@
|
||||
@{
|
||||
ViewBag.title = "批量迁移文章";
|
||||
}
|
||||
<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">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "moveArticleForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
注意:请务必确认迁移栏目文章,本操作不可逆,请慎重操作!
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">从本栏目:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="from" id="from">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">迁移至此栏目:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="to" id="to">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("moveArticleForm");
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -113,11 +113,11 @@
|
||||
<nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
|
||||
<form role="search" class="navbar-form-custom" method="post" action="" onsubmit="return false;">
|
||||
@*<form role="search" class="navbar-form-custom" method="post" action="" onsubmit="return false;">
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
|
||||
</div>
|
||||
</form>
|
||||
</form>*@
|
||||
</div>
|
||||
<ul class="nav navbar-top-links navbar-right">
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -41,42 +41,44 @@
|
||||
<input id="Rank" type="number" class="form-control" name="Rank" placeholder="排序" value="" maxlength="3">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="CashBack" type="text" class="form-control" name="CashBack" placeholder="30为30%,消费后返现百分比到自己账号" value="" maxlength="10">
|
||||
<div class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="CashBack" type="text" class="form-control" name="CashBack" placeholder="30为30%,消费后返现百分比到自己账号" value="" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">父级返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="ParentCashBack" type="text" class="form-control" name="ParentCashBack" placeholder="15为15%,消费后返现百分比到父级账号" value="" maxlength="10">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">父级返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="ParentCashBack" type="text" class="form-control" name="ParentCashBack" placeholder="15为15%,消费后返现百分比到父级账号" value="" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">爷级返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="GrandfatherCashBack" type="text" class="form-control" name="GrandfatherCashBack" placeholder="15为15%,消费后返现百分比到爷级账号" value="" maxlength="10">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">爷级返现百分比:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="GrandfatherCashBack" type="text" class="form-control" name="GrandfatherCashBack" placeholder="15为15%,消费后返现百分比到爷级账号" value="" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">入驻费用:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="JoinPrice" type="text" class="form-control" name="JoinPrice" placeholder="入驻成为本用户组费用" value="" maxlength="20">
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">入驻费用:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="JoinPrice" type="text" class="form-control" name="JoinPrice" placeholder="入驻成为本用户组费用" value="" maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">返现减半:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsHalved" id="IsHalved"> 超过父级级别是否减半(勾选,则如果自己超过父级级别,提成减半)
|
||||
</label>
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">返现减半:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsHalved" id="IsHalved"> 超过父级级别是否减半(勾选,则如果自己超过父级级别,提成减半)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">年业务量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="YearsPerformance" type="text" class="form-control" name="YearsPerformance" placeholder="年业务量,不达标自动降级" value="" maxlength="10">
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-3 control-label">年业务量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="YearsPerformance" type="text" class="form-control" name="YearsPerformance" placeholder="年业务量,不达标自动降级" value="" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
roleid: $("#roleid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
keyword: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
<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="top.showDialog('addmemberrole', '添加用户组', '/Admin/Member/AddMemberRole', 0, 0)">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addmemberrole', '添加用户组', '/AdminCP/Member/AddMemberRole', 0, 0)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
<div id="toolbar2" class="btn-group pull-right">
|
||||
<button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
|
||||
@@ -53,7 +53,7 @@
|
||||
<td>@m.RoleDescription</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog('eidtrole', '编辑用户组详情', '/AdminCP/Member/EditMemberRole/@m.Id', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
@*<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/Admin/Member/DelMemberRole',@m.Id);"><i class="fa fa-close"></i> 删除</a>*@
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Member/DelMemberRole',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">下单IP:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="control-label">@Model.IP</label>
|
||||
<label class="control-label">@Model.Ip</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -251,16 +251,16 @@
|
||||
data: { id: Id, fare: Fare },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
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 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
@@ -287,16 +287,16 @@
|
||||
data: { id: Id, DeliverType: DeliverType, DeliverNO: DeliverNO },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
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 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
@@ -328,16 +328,16 @@
|
||||
data: { id: Id, Flag1: Flag1, Flag2: Flag2 },
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.Status == "success") {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.Message, {
|
||||
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 });
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@{
|
||||
ViewBag.title = "添加广告";
|
||||
}
|
||||
<script src="~/js/jquery.tablednd.min.js"></script>
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
@@ -157,7 +158,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover" id="sildeTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
@@ -247,7 +248,7 @@
|
||||
}
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-addon my-upload-span upload-img" id="basic-addon_{0}"></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="slide_Link" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="slide_Alt" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button></td></tr>';
|
||||
@@ -259,6 +260,7 @@
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
$("#basic-addon_" + items).InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
items += 1;
|
||||
$("#sildeTable").tableDnD();
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
@@ -270,5 +272,6 @@
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
$(".upload-swf").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderFile", swf: "/js/webuploader/uploader.swf", filetypes: "swf", notwater: true });
|
||||
DoPost("addAdsForm");
|
||||
$("#sildeTable").tableDnD();
|
||||
})
|
||||
</script>
|
||||
@@ -6,6 +6,7 @@
|
||||
Model.Content = "[]";
|
||||
}
|
||||
}
|
||||
<script src="~/js/jquery.tablednd.min.js"></script>
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
@@ -161,7 +162,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover" id="sildeTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
@@ -264,6 +265,7 @@
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
$("#basic-addon_" + items).InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
items += 1;
|
||||
$("#sildeTable").tableDnD();
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
|
||||
@@ -40,12 +40,11 @@
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="BannerImg" name="BannerImg" maxlength="250" type="text" class="form-control" placeholder="请选择或上传一个Banner图片" value="">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('BannerImg')">
|
||||
选择图片
|
||||
</button>
|
||||
<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="请选择或上传一个图片" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,6 +140,8 @@
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
//初始化上传控件
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
DoPost("addArticleKindForm");
|
||||
CKEDITOR.replace('KindInfo');
|
||||
})
|
||||
|
||||
@@ -41,12 +41,11 @@
|
||||
<label class="col-sm-3 control-label">Banner图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="BannerImg" name="BannerImg" maxlength="250" type="text" class="form-control" placeholder="请选择或上传一个Banner图片" value="@Model.BannerImg">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('BannerImg')">
|
||||
选择图片
|
||||
</button>
|
||||
<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="请选择或上传一个图片" value="@Model.BannerImg">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -151,6 +150,8 @@
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
//初始化上传控件
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
DoPost("editCategoryForm");
|
||||
CKEDITOR.replace('KindInfo');
|
||||
})
|
||||
|
||||
@@ -81,6 +81,30 @@
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
$(".my-preview").click(function () {
|
||||
var url = $(this).siblings(".upload-path").val();
|
||||
if (url) {
|
||||
var data = {
|
||||
"status": 1,
|
||||
"msg": "",
|
||||
"title": "预览图片",
|
||||
"id": 1,
|
||||
"start": 0,
|
||||
"data": [
|
||||
{
|
||||
"alt": "",
|
||||
"pid": 1,
|
||||
"src": url,
|
||||
"thumb": ""
|
||||
}
|
||||
]
|
||||
};
|
||||
layer.photos({
|
||||
photos: data,
|
||||
anim: 0
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
$("input").each(function (index, item) {
|
||||
if ($(this).attr("placeholder") && $(this).attr("placeholder") != "") {
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "添加公众号点击事件回复详情";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="alert alert-info">
|
||||
KEY,为点击事件KEY,配置好后,自定义菜单选择 CLICK事件,然后key填入此key即可。
|
||||
</div>
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addClickReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">KEYS:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Keywords" type="text" class="form-control" name="Keywords" value="@(Model.Keywords)" maxlength="250" placeholder="请输入一个点击关键字" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" name="RequestType" id="RequestType" value="@Model.RequestType" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("addClickReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,191 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "添加公众号文本关键字回复详情";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addTextReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">关键字:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Keywords" type="text" class="form-control" name="Keywords" value="@(Model.Keywords)" maxlength="250" placeholder="请输入一个关键字" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否模糊匹配:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="IsLikeQuery" id="IsLikeQuery">
|
||||
<option value="0">精确匹配</option>
|
||||
<option value="1">模糊匹配</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" name="RequestType" id="RequestType" value="1" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("addTextReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "微信公众号点击事件回复规则管理";
|
||||
}
|
||||
<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="doSearch(); return false; ">
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addclickreplyrule','添加点击菜单回复规则','/AdminCP/Weixin/AddClickReplyRule',0,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);
|
||||
return false;
|
||||
}
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/Weixin/GetClickReplyRuleList', //请求后台的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: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'Keywords',
|
||||
title: '事件KEY'
|
||||
},
|
||||
{
|
||||
field: 'ResponseType',
|
||||
title: '回复类型',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "文本";
|
||||
break;
|
||||
case 2:
|
||||
return "图文";
|
||||
break;
|
||||
case 3:
|
||||
return "语音";
|
||||
break;
|
||||
case 8:
|
||||
return "单图";
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'AddTime',
|
||||
title: '添加时间',
|
||||
formatter: function (value, row, index) {
|
||||
if (value) {
|
||||
return value.replace('T00:00:00', '');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
departmentname: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtreplyrule\', \'查看/编辑规则详情\', \'/AdminCP/Weixin/EditClickReplyRule/' + 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/Weixin/DelClickReplyRule\',' + 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>
|
||||
@@ -0,0 +1,225 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "修改公众号点击事件回复详情";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="alert alert-info">
|
||||
KEY,为点击事件KEY,配置好后,自定义菜单选择 CLICK事件,然后key填入此key即可。
|
||||
</div>
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editClickReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">KEYS:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Keywords" type="text" class="form-control" name="Keywords" value="@(Model.Keywords)" maxlength="250" placeholder="请输入一个关键字" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
@if (Model.ResponseType == (int)WeixinRequestRule.XResponseType.Image)
|
||||
{
|
||||
if (Model.ListContent.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < Model.ListContent.Count; i++)
|
||||
{
|
||||
<tr id="slideTR_old@(@Model.ListContent[i].Id)">
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_old@(@Model.ListContent[i].Id)" name="item_imgurl" value="@Model.ListContent[i].ImgURL" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_old@(@Model.ListContent[i].Id)')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="@Model.ListContent[i].LinkUrl" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="@Model.ListContent[i].Title" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2">@Model.ListContent[i].Content</textarea></td>
|
||||
<td>
|
||||
@if (i == 0)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow('old@(@Model.ListContent[i].Id)')"><i class="fa fa-minus-square"></i> 删除</button>
|
||||
}
|
||||
<input type="hidden" name="item_id" value="@(@Model.ListContent[i].Id)" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" name="RequestType" id="RequestType" value="@Model.RequestType" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("editClickReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,229 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "修改公众号文本关键字回复详情";
|
||||
}
|
||||
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editTextReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">关键字:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Keywords" type="text" class="form-control" name="Keywords" value="@(Model.Keywords)" maxlength="250" placeholder="请输入一个关键字" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否模糊匹配:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" asp-for="IsLikeQuery">
|
||||
<option value="0" >精确匹配</option>
|
||||
<option value="1" >模糊匹配</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
@if (Model.ResponseType == (int)WeixinRequestRule.XResponseType.Image)
|
||||
{
|
||||
if (Model.ListContent.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < Model.ListContent.Count; i++)
|
||||
{
|
||||
<tr id="slideTR_old@(@Model.ListContent[i].Id)">
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_old@(@Model.ListContent[i].Id)" name="item_imgurl" value="@Model.ListContent[i].ImgURL" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_old@(@Model.ListContent[i].Id)')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="@Model.ListContent[i].LinkUrl" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="@Model.ListContent[i].Title" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2">@Model.ListContent[i].Content</textarea></td>
|
||||
<td>
|
||||
@if (i == 0)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow('old@(@Model.ListContent[i].Id)')"><i class="fa fa-minus-square"></i> 删除</button>
|
||||
}
|
||||
<input type="hidden" name="item_id" value="@(@Model.ListContent[i].Id)" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" name="RequestType" id="RequestType" value="1" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("editTextReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,194 @@
|
||||
@model Senparc.Weixin.MP.Entities.GetMenuResult
|
||||
@{
|
||||
ViewBag.Title = "自定义菜单管理";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
<button type="button" class="btn btn-success btn-sm" v-on:click="doPostToWeixin">发送到微信服务器</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:120px">#</th>
|
||||
<th>第一列</th>
|
||||
<th>第二列</th>
|
||||
<th>第三列</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>一级菜单</td>
|
||||
<td v-for="item in topitem">
|
||||
<select class="form-control m-b-sm" v-model="menudata.button[item].type">
|
||||
<option value="view" v-for="p in typelist" v-bind:value="p.val">
|
||||
{{p.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input type="text" placeholder="菜单名称" class="form-control m-b-sm" title="菜单名称" v-model="menudata.button[item].name">
|
||||
<input type="text" placeholder="KEY" class="form-control m-b-sm" title="KEY" v-model="menudata.button[item].key">
|
||||
<input type="text" placeholder="URL地址" class="form-control m-b-sm" title="URL地址" v-model="menudata.button[item].url">
|
||||
<input type="text" placeholder="小程序appid" class="form-control m-b-sm" title="小程序appid" v-model="menudata.button[item].appid" v-if="menudata.button[item].type =='miniprogram'">
|
||||
<input type="text" placeholder="小程序的页面路径" class="form-control m-b-sm" title="小程序的页面路径" v-model="menudata.button[item].pagepath" v-if="menudata.button[item].type =='miniprogram'">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr v-for="(item,index) in subitem">
|
||||
<td>二级菜单NO.{{item + 1}}</td>
|
||||
<td v-for="titem in topitem">
|
||||
<select class="form-control m-b-sm" v-model="menudata.button[titem].sub_button[item].type">
|
||||
<option value="view" v-for="p in typelist" v-bind:value="p.val">
|
||||
{{p.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input type="text" placeholder="菜单名称" class="form-control m-b-sm" title="菜单名称" v-model="menudata.button[titem].sub_button[item].name">
|
||||
<input type="text" placeholder="KEY" class="form-control m-b-sm" title="KEY" v-model="menudata.button[titem].sub_button[item].key">
|
||||
<input type="text" placeholder="URL地址" class="form-control m-b-sm" title="URL地址" v-model="menudata.button[titem].sub_button[item].url">
|
||||
<input type="text" placeholder="小程序appid" class="form-control m-b-sm" title="小程序appid" v-model="menudata.button[titem].sub_button[item].appid" v-if="menudata.button[titem].sub_button[item].type == 'miniprogram'">
|
||||
<input type="text" placeholder="小程序的页面路径" class="form-control m-b-sm" title="小程序的页面路径" v-model="menudata.button[titem].sub_button[item].pagepath" v-if="menudata.button[titem].sub_button[item].type == 'miniprogram'">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var sysmenudata = { button: [] };
|
||||
for (var i = 0; i < 3; i++) {
|
||||
sysmenudata.button.push({
|
||||
type: 'view',
|
||||
name: '',
|
||||
key: '',
|
||||
url: '',
|
||||
appid: '',
|
||||
pagepath: '',
|
||||
media_id: '',
|
||||
sub_button: []
|
||||
});
|
||||
for (j = 0; j < 5; j++) {
|
||||
sysmenudata.button[i].sub_button.push({
|
||||
type: 'view',
|
||||
name: '',
|
||||
key: '',
|
||||
url: '',
|
||||
appid: '',
|
||||
pagepath: '',
|
||||
media_id: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
//初始化的时候,再修改一下
|
||||
var sysoldmenu = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
|
||||
if (sysoldmenu.menu) {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (sysoldmenu.menu.button[i]) {
|
||||
|
||||
}
|
||||
}
|
||||
sysoldmenu.menu.button.map(function (item, index) {
|
||||
sysmenudata.button[index].name = item.name || '';
|
||||
sysmenudata.button[index].type = item.type || 'view';
|
||||
sysmenudata.button[index].key = item.key || '';
|
||||
sysmenudata.button[index].url = item.url || '';
|
||||
sysmenudata.button[index].appid = item.appid || '';
|
||||
sysmenudata.button[index].pagepath = item.pagepath || '';
|
||||
sysmenudata.button[index].media_id = item.media_id || '';
|
||||
|
||||
if (item.sub_button) {//如果有子菜单
|
||||
item.sub_button.map(function (sub, i) {
|
||||
sysmenudata.button[index].sub_button[i].name = sub.name || '';
|
||||
sysmenudata.button[index].sub_button[i].type = sub.type || '';
|
||||
sysmenudata.button[index].sub_button[i].key = sub.key || '';
|
||||
sysmenudata.button[index].sub_button[i].url = sub.url || '';
|
||||
sysmenudata.button[index].sub_button[i].appid = sub.appid || '';
|
||||
sysmenudata.button[index].sub_button[i].pagepath = sub.pagepath || '';
|
||||
sysmenudata.button[index].sub_button[i].media_id = sub.media_id || '';
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data:{
|
||||
menuList:@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model)),
|
||||
topitem:[0,1,2],
|
||||
subitem: [0, 1, 2, 3, 4],
|
||||
typelist: [
|
||||
{ name: '跳转地址(view)', val: 'view' },
|
||||
{ name: '对接动作处理(click)', val: 'click' },
|
||||
{ name: '扫码(scancode_push)', val: 'scancode_push' },
|
||||
{ name: '小程序(miniprogram)', val:'miniprogram'}
|
||||
],
|
||||
postdata: {},
|
||||
menudata: sysmenudata
|
||||
},
|
||||
methods: {
|
||||
doPostToWeixin: function () {
|
||||
var that = this;
|
||||
//alert(JSON.stringify(that.menudata));
|
||||
//处理这个数据表
|
||||
var postdata = { button: [] };
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (that.menudata.button[i] && that.menudata.button[i].name != '') {
|
||||
var tempbutton = JSON.stringify(that.menudata.button[i])
|
||||
postdata.button.push(JSON.parse(tempbutton));
|
||||
postdata.button[i].sub_button = [];
|
||||
|
||||
for (j = 0; j < 5; j++) {
|
||||
if (that.menudata.button[i].sub_button[j] && that.menudata.button[i].sub_button[j].name != '') {
|
||||
var tmepsubbutton = JSON.stringify(that.menudata.button[i].sub_button[j]);
|
||||
//console.log(that.menudata.button[i].sub_button[j].name);
|
||||
postdata.button[i].sub_button.push(JSON.parse(tmepsubbutton));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//alert(JSON.stringify(postdata));
|
||||
//return;
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/AdminCP/Weixin/DoPostMenuData',
|
||||
data: {
|
||||
allmenu: JSON.stringify(postdata)
|
||||
},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
layer.close(loading);
|
||||
if (data.Status == "success") {
|
||||
layer.msg(data.Message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
window.location.href = window.location.href;
|
||||
});
|
||||
}
|
||||
else {
|
||||
layer.alert(data.Message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.alert("执行出错,请联系管理员!", { icon: 2 });
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
//console.log(this.menudata);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,221 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "编辑/查看公众号未找到关键字自动回复详情";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editSubscribeReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
@if (Model.ResponseType == (int)WeixinRequestRule.XResponseType.Image)
|
||||
{
|
||||
if (Model.ListContent.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < Model.ListContent.Count; i++)
|
||||
{
|
||||
<tr id="slideTR_old@(@Model.ListContent[i].Id)">
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_old@(@Model.ListContent[i].Id)" name="item_imgurl" value="@Model.ListContent[i].ImgURL" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_old@(@Model.ListContent[i].Id)')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="@Model.ListContent[i].LinkUrl" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="@Model.ListContent[i].Title" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2">@Model.ListContent[i].Content</textarea></td>
|
||||
<td>
|
||||
@if (i == 0)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow('old@(@Model.ListContent[i].Id)')"><i class="fa fa-minus-square"></i> 删除</button>
|
||||
}
|
||||
<input type="hidden" name="item_id" value="@(@Model.ListContent[i].Id)" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td>
|
||||
<textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" id="RuleName" name="RuleName" value="关注自动回复" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("editSubscribeReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "微信公众号关键字回复规则管理";
|
||||
}
|
||||
<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="doSearch(); return false; ">
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addtxtreplyrule','添加文本回复规则','/AdminCP/Weixin/AddTextReplyRule',0,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);
|
||||
return false;
|
||||
}
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/Weixin/GetReplyRuleList', //请求后台的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: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'IsLikeQuery',
|
||||
title: '模糊匹配',
|
||||
formatter: function (value, row, index) {
|
||||
if (value > 0) {
|
||||
return '模糊匹配'
|
||||
} else {
|
||||
return '精确匹配'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'Keywords',
|
||||
title: '关键字'
|
||||
},
|
||||
{
|
||||
field: 'ResponseType',
|
||||
title: '回复类型',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return "文本";
|
||||
case 2:
|
||||
return "图文";
|
||||
case 3:
|
||||
return "语音";
|
||||
case 8:
|
||||
return "单图";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'AddTime',
|
||||
title: '添加时间',
|
||||
formatter: function (value, row, index) {
|
||||
if (value) {
|
||||
return value.replace('T00:00:00', '');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
departmentname: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtreplyrule\', \'查看/编辑规则详情\', \'/AdminCP/Weixin/EditTextReplyRule/' + 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/Weixin/DelTextReplyRule\',' + 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>
|
||||
@@ -0,0 +1,220 @@
|
||||
@model WeixinRequestRule
|
||||
@{
|
||||
ViewBag.Title = "编辑/查看公众号关注自动回复详情";
|
||||
}
|
||||
<script src="~/js/vue/vue.min.js"></script>
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins" id="app">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editSubscribeReplyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">回复类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="ResponseType" id="ResponseType" v-model="responseType">
|
||||
<option v-for="(item,index) in trs" v-bind:value="item.id">{{item.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="detail_0" v-show="responseType == 0">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字回复:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea id="txtContent" name="txtContent" class="form-control" placeholder="可以输入文字回复介绍">@ViewBag.txtContent</textarea>
|
||||
</div>
|
||||
@if (Model.ListContent != null && Model.ListContent.Count > 0)
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="@Model.ListContent[0].Id" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="hdfTID" id="hdfTID" value="0" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_2" v-show="responseType == 3">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundTitle" type="text" class="form-control" name="txtSoundTitle" value="@(ViewBag.txtSoundTitle)" maxlength="250" placeholder="您可以输入语音标题">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音描述:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="txtSoundUrl" type="text" class="form-control" name="txtSoundContent" value="@(ViewBag.txtSoundContent)" maxlength="250" placeholder="您可以输入语音描述">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">语音:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSoundUrl" name="txtSoundUrl" maxlength="250" type="text" class="form-control" placeholder="选择一个语音" value="@(ViewBag.txtSoundUrl)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSoundUrl')">
|
||||
选择一个语音
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_1" v-show="responseType == 2">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th>图片说明</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
@if (Model.ResponseType == (int)WeixinRequestRule.XResponseType.Image)
|
||||
{
|
||||
if (Model.ListContent.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < Model.ListContent.Count; i++)
|
||||
{
|
||||
<tr id="slideTR_old@(@Model.ListContent[i].Id)">
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_old@(@Model.ListContent[i].Id)" name="item_imgurl" value="@Model.ListContent[i].ImgURL" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_old@(@Model.ListContent[i].Id)')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="@Model.ListContent[i].LinkUrl" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="@Model.ListContent[i].Title" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2">@Model.ListContent[i].Content</textarea></td>
|
||||
<td>
|
||||
@if (i == 0)
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow('old@(@Model.ListContent[i].Id)')"><i class="fa fa-minus-square"></i> 删除</button>
|
||||
}
|
||||
<input type="hidden" name="item_id" value="@(@Model.ListContent[i].Id)" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer('slide_Img_0')"><i class="fa fa-search"></i></button></span></div></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_linkurl" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="" name="item_title" value="" placeholder="请输入图片标题"></td>
|
||||
<td>
|
||||
<textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button>
|
||||
<input type="hidden" name="item_id" value="0" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="detail_8" v-show="responseType == 8">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="txtSingleImage" name="txtSingleImage" maxlength="250" type="text" class="form-control" placeholder="选择一张图片(图片不能大于1M,否则微信显示不了!)" value="@(ViewBag.txtSingleImage)">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary" onclick="BrowseServer('txtSingleImage')">
|
||||
选择一张图片
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<input type="hidden" id="RuleName" name="RuleName" value="关注自动回复" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
function closethisdialog() {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="item_imgurl" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="item_linkurl" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="item_title" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><textarea class="form-control" name="item_imginfo" placeholder="请输入图片说明" rows="2"></textarea></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button><input type="hidden" name="item_id" value="0" /></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
$(function () {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
});
|
||||
DoPost("editSubscribeReplyForm");
|
||||
})
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
trs: [{ id: 0, name: '纯文本回复' }, { id: 2, name: '多图文回复' }, { id: 3, name: '语音回复' }, { id: 8, name: '单图片回复' }],
|
||||
responseType:@Model.ResponseType,
|
||||
my:'abc'
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -1,26 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.1.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.6" />
|
||||
<PackageReference Include="MimeKit" Version="2.1.0" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.13" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.9.6881.41312" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.2.1" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.5.1" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.0.2" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.2.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
|
||||
<PackageReference Include="MailKit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
|
||||
<PackageReference Include="MimeKit" Version="2.4.1" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.19" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.15.2020.204" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Senparc.NeuChar" Version="1.0.104" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.104.1" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.104.1" />
|
||||
<PackageReference Include="Senparc.Weixin.MP.MvcExtension" Version="4.1.1" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.104" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.104" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COMCMS.API\COMCMS.API.csproj" />
|
||||
<ProjectReference Include="..\COMCMS.Common\COMCMS.Common.csproj" />
|
||||
<ProjectReference Include="..\COMCMS.Core\COMCMS.Core.csproj" />
|
||||
<ProjectReference Include="..\Lib.Core\Lib.Core.csproj" />
|
||||
@@ -32,6 +35,7 @@
|
||||
<Folder Include="Areas\AdminCP\Models\" />
|
||||
<Folder Include="wwwroot\lib\webuploader\" />
|
||||
<Folder Include="wwwroot\userfiles\" />
|
||||
<Folder Include="Configuration\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -54,5 +54,48 @@ namespace COMCMS.Web.Common
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 判断文章栏目或者商品栏目,栏目路径是否已经存在
|
||||
/// <summary>
|
||||
/// 判断路径名称是否合法
|
||||
/// </summary>
|
||||
/// <param name="pathname"></param>
|
||||
/// <param name="kid">id,大于0是修改</param>
|
||||
/// <param name="typeid">类型,0文章,1商品</param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckFilePathIsOK(string pathname, int kid, int typeid)
|
||||
{
|
||||
bool flag = true;
|
||||
|
||||
if (string.IsNullOrEmpty(pathname))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(typeid ==0)//文章
|
||||
{
|
||||
if (ArticleCategory.FindCount(ArticleCategory._.FilePath == pathname & ArticleCategory._.Id != kid, null, null, 0, 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Category.FindCount(Category._.FilePath == pathname, null, null, 0, 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(typeid == 1)
|
||||
{
|
||||
if (ArticleCategory.FindCount(ArticleCategory._.FilePath == pathname , null, null, 0, 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Category.FindCount(Category._.FilePath == pathname & Category._.Id != kid, null, null, 0, 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace COMCMS.Web.Common
|
||||
public IActionResult AlertAndGoBack(string str)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(str)) str = str.Replace("'", "\\'");
|
||||
return Content($"<script type=\"text/javascript\">alert('{str}');window.history.go(-1)</script>");
|
||||
return Content($"<script type=\"text/javascript\">alert('{str}');window.history.go(-1)</script>", "text/html", System.Text.Encoding.UTF8);
|
||||
}
|
||||
/// <summary>
|
||||
/// Alert提示并跳转到指定URL
|
||||
@@ -39,7 +39,7 @@ namespace COMCMS.Web.Common
|
||||
public IActionResult AlertAndRedirect(string str, string url)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(str)) str = str.Replace("'", "\\'");
|
||||
return Content($"<script type=\"text/javascript\">alert('{str}');window.location='{url}'</script>");
|
||||
return Content($"<script type=\"text/javascript\">alert('{str}');window.location='{url}'</script>", "text/html", System.Text.Encoding.UTF8);
|
||||
}
|
||||
|
||||
#region MyRegion
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace COMCMS.Web.Common
|
||||
{
|
||||
public class HttpGlobalExceptionFilter : IExceptionFilter
|
||||
{
|
||||
readonly IHostingEnvironment _env;
|
||||
public HttpGlobalExceptionFilter(IHostingEnvironment env)
|
||||
readonly IWebHostEnvironment _env;
|
||||
public HttpGlobalExceptionFilter(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace COMCMS.Web.Common
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
Task.Run(() => { StartRegister(); }).LogException();
|
||||
Task.Run(() => { StartRegister(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using COMCMS.Core;
|
||||
using COMCMS.Common;
|
||||
using XCode;
|
||||
|
||||
|
||||
namespace COMCMS.Web.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// 识图方法
|
||||
/// </summary>
|
||||
public class ViewsHelper
|
||||
{
|
||||
#region 获取分类链接
|
||||
/// <summary>
|
||||
/// 文章分类
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public static string EchoURL(ArticleCategory model)
|
||||
{
|
||||
if (model == null)
|
||||
return "";
|
||||
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 "";
|
||||
if (!string.IsNullOrEmpty(model.FilePath))
|
||||
return model.FilePath + "/index.html";
|
||||
else
|
||||
return $"/product/index/{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;
|
||||
default:
|
||||
url= "/";
|
||||
break;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using XCode;
|
||||
|
||||
namespace COMCMS.Web.Configuration
|
||||
{
|
||||
public class JsonOptionsConfig
|
||||
{
|
||||
public static void ConfigJsonOptions(MvcNewtonsoftJsonOptions options)
|
||||
{
|
||||
var settings = options.SerializerSettings;
|
||||
//日期类型默认格式化处理
|
||||
// //setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
|
||||
settings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
//// 空值处理
|
||||
//setting.NullValueHandling = NullValueHandling.Ignore;
|
||||
|
||||
// 最大序列化深度,包括请求传参的序列化深度,不可设置太小了
|
||||
settings.MaxDepth = 5;
|
||||
|
||||
// 忽略循环引用
|
||||
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
|
||||
// 全局设置要排除的字段
|
||||
settings.ContractResolver = new LimitPropsContractResolver(new[] { "password", "extends" }, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 限制某些属性输出或排除,设置为保留时,只输出保留属性,其他属性全部忽略。
|
||||
/// 设置为排除,只排除设置的属性
|
||||
/// </summary>
|
||||
public class LimitPropsContractResolver : CamelCasePropertyNamesContractResolver// DefaultContractResolver
|
||||
{
|
||||
private readonly string[] _props = null;
|
||||
|
||||
private readonly bool _retain;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="props">传入的属性数组</param>
|
||||
/// <param name="retain">true:表示props是需要保留的字段 false:表示props是要排除的字段</param>
|
||||
public LimitPropsContractResolver(string[] props, bool retain = false)
|
||||
{
|
||||
//指定要序列化属性的清单
|
||||
this._props = props;
|
||||
|
||||
this._retain = retain;
|
||||
}
|
||||
|
||||
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
|
||||
{
|
||||
var list = base.CreateProperties(type, memberSerialization);
|
||||
|
||||
// 非实体类型直接返回
|
||||
if (!typeof(EntityBase).IsAssignableFrom(type))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
//只保留清单有列出的属性
|
||||
list = list.Where(p =>
|
||||
{
|
||||
var has = _props.Any(a => a.Equals(p.PropertyName, StringComparison.OrdinalIgnoreCase));
|
||||
if (_retain)
|
||||
{
|
||||
return has;
|
||||
}
|
||||
|
||||
return !has;
|
||||
}).ToList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ namespace COMCMS.Web.Controllers
|
||||
public IActionResult Index(int id = 0, int page = 1)
|
||||
{
|
||||
ArticleCategory model = ArticleCategory.FindById(id);
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return AlertAndGoBack("系统找不到本记录");
|
||||
@@ -88,16 +89,13 @@ namespace COMCMS.Web.Controllers
|
||||
}
|
||||
|
||||
ViewBag.cfg = cfg;
|
||||
string templatesname = "";//模板名称
|
||||
string templatesname = "Index.cshtml";//模板名称
|
||||
if (!string.IsNullOrEmpty(model.TemplateFile))
|
||||
{
|
||||
templatesname = model.TemplateFile.Replace(".cshtml", "").Replace(".aspx", "");
|
||||
return View(templatesname, model);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(model);
|
||||
templatesname = model.TemplateFile;
|
||||
//return Content(templatesname);
|
||||
}
|
||||
return View("~/Views/Article/" + templatesname, model); //固定死就是这个
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace COMCMS.Web.Controllers
|
||||
{
|
||||
ViewBag.cfg = cfg;
|
||||
ViewBag.about = Article.FindById(1);//关于我们
|
||||
return View();
|
||||
return View("~/Views/Home/Index.cshtml");
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -46,5 +46,67 @@ namespace COMCMS.Web.Controllers
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
#region 测试
|
||||
//[Route("c/{*path}/index2.html")]
|
||||
//public IActionResult Test(string path = "")
|
||||
//{
|
||||
// string tel = "13332835377";
|
||||
// return Content(tel.Substring(tel.Length - 5) + ";path:" + path);
|
||||
//}
|
||||
//[Route("{path1:regex([[a-zA-Z0-9-]])}/{path2:regex([[a-zA-Z0-9-]])}/index.html")]
|
||||
//public IActionResult Test2(string path1 = "", string path2 = "")
|
||||
//{
|
||||
// ArticleController ac = new ArticleController();
|
||||
// return ac.Index(1);
|
||||
// //return Content(";ath1:" + path1+";path2:"+path2);
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 测试拼音
|
||||
public IActionResult Test3()
|
||||
{
|
||||
var mac = Utils.GetMacs().ToList();
|
||||
string re = "";
|
||||
foreach (var item in mac)
|
||||
{
|
||||
if (string.IsNullOrEmpty(re))
|
||||
re = item.ToHex();
|
||||
else
|
||||
re += "-" + item.ToHex();
|
||||
}
|
||||
return Content(re);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 系统文章栏目、商品栏目路由
|
||||
/// <summary>
|
||||
/// 一级路径栏目
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
[Route("{path:regex([[a-zA-Z0-9-]])}/index.html")]
|
||||
[Route("{path:regex([[a-zA-Z0-9-]])}/index-{page:int}.html")]
|
||||
[Route("{path:regex([[a-zA-Z0-9-]])}/")]
|
||||
public IActionResult ShowCategory(string path,int page=1)
|
||||
{
|
||||
//先判断文章栏目
|
||||
ArticleCategory articleCategory = ArticleCategory.FindByFilePath("/" + path);
|
||||
if(articleCategory != null)
|
||||
{
|
||||
//return Content(articleCategory.Id.ToString());
|
||||
ArticleController ac = new ArticleController();
|
||||
return ac.Index(articleCategory.Id);
|
||||
}
|
||||
//再判断商品
|
||||
Category category = Category.FindByFilePath("/" + path);
|
||||
if(category != null)
|
||||
{
|
||||
ProductController pc = new ProductController();
|
||||
return pc.Index(category.Id,page);
|
||||
}
|
||||
return EchoTip("系统找不到本栏目!"+"/"+path);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Senparc.Weixin.MP.Entities.Request;
|
||||
using COMCMS.Web.Common;
|
||||
using Senparc.Weixin.MP;
|
||||
using NewLife.Log;
|
||||
using COMCMS.Common;
|
||||
using Senparc.CO2NET.HttpUtility;
|
||||
using System.Threading;
|
||||
using COMCMS.API.Weixin.CustomMessageHandler;
|
||||
using Senparc.Weixin;
|
||||
using Senparc.NeuChar.MessageHandlers;
|
||||
using Senparc.Weixin.MP.MvcExtension;
|
||||
|
||||
namespace COMCMS.Web.Controllers
|
||||
{
|
||||
public class WeixinController : HomeBaseController
|
||||
{
|
||||
[HttpGet]
|
||||
[ActionName("Index")]
|
||||
public Task<ActionResult> Get(string signature, string timestamp, string nonce, string echostr)
|
||||
{
|
||||
string token = cfg.Token;
|
||||
|
||||
return Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (CheckSignature.Check(signature, timestamp, nonce, token))
|
||||
{
|
||||
return echostr; //返回随机字符串则表示验证通过
|
||||
}
|
||||
else
|
||||
{
|
||||
return "failed:" + signature + "," + Senparc.Weixin.MP.CheckSignature.GetSignature(timestamp, nonce, token) + "。" +
|
||||
"如果你在浏览器中看到这句话,说明此地址可以被作为微信公众账号后台的Url,请注意保持Token一致。";
|
||||
}
|
||||
}).ContinueWith<ActionResult>(task => Content(task.Result));
|
||||
}
|
||||
|
||||
|
||||
#region 处理微信接口 消息,事件等
|
||||
[HttpPost]
|
||||
[ActionName("Index")]
|
||||
public async Task<IActionResult> Post(PostModel postModel)
|
||||
{
|
||||
string token = cfg.Token;
|
||||
if (!CheckSignature.Check(postModel.Signature, postModel.Timestamp, postModel.Nonce, token))
|
||||
{
|
||||
return Content("参数错误!");
|
||||
}
|
||||
var cancellationToken = new CancellationToken();//给异步方法使用
|
||||
var messageHandler = new CustomMessageHandler(Request.GetRequestMemoryStream(), postModel, 10);
|
||||
#region 设置消息去重
|
||||
|
||||
/* 如果需要添加消息去重功能,只需打开OmitRepeatedMessage功能,SDK会自动处理。
|
||||
* 收到重复消息通常是因为微信服务器没有及时收到响应,会持续发送2-5条不等的相同内容的RequestMessage*/
|
||||
messageHandler.OmitRepeatedMessage = true;//默认已经开启,此处仅作为演示,也可以设置为false在本次请求中停用此功能
|
||||
|
||||
messageHandler.DefaultMessageHandlerAsyncEvent = DefaultMessageHandlerAsyncEvent.SelfSynicMethod;
|
||||
|
||||
#endregion
|
||||
await messageHandler.ExecuteAsync(cancellationToken); //执行微信处理过程(关键)
|
||||
|
||||
string content = messageHandler.TextResponseMessage.Replace("\r\n", "\n");
|
||||
|
||||
return Content(content, "text/xml");
|
||||
//return new FixWeixinBugWeixinResult(messageHandler);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
@@ -30,7 +29,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetArticleList(int kid, int pagesize = 10, int page = 1, string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetArticleList(int kid, int pagesize = 10, int page = 1)
|
||||
{
|
||||
var where = Article._.IsHide != 1;
|
||||
if (kid > 0)
|
||||
@@ -83,7 +82,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetArticleListWidthSub(int kid, int pagesize = 10, int page = 1, string key = "", string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetArticleListWidthSub(int kid, int pagesize = 10, int page = 1, string key = "")
|
||||
{
|
||||
|
||||
var where = Article._.IsHide != 1;
|
||||
@@ -154,7 +153,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetArticleDetail(int id, string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetArticleDetail(int id)
|
||||
{
|
||||
//获取商品
|
||||
Article entity = Article.FindById(id);
|
||||
@@ -173,7 +172,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
#region 获取文章栏目详情,并带下一级栏目
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetArticleCategory(int id, string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetArticleCategory(int id)
|
||||
{
|
||||
ArticleCategory entity = ArticleCategory.FindById(id);
|
||||
if (entity == null)
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
{
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object Get()
|
||||
{
|
||||
Config cfg = Config.GetSystemConfig();
|
||||
@@ -37,10 +38,19 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public ReJson CheckSign(string id, string random = "", string timeStamp = "", string signature = "")
|
||||
public ReJson CheckSign(string id)
|
||||
{
|
||||
return new ReJson("验签成功!");
|
||||
}
|
||||
|
||||
//POST验证
|
||||
[HttpPost]
|
||||
[CheckFilter]
|
||||
public ReJson ChekSignWidhPost(int id)
|
||||
{
|
||||
return new ReJson("验证通过!");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//#region 测试出错
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
#region 微信小程序订单支付
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public ReJson DoPayOrder(string ordernum, string random = "", string timeStamp = "", string signature = "")
|
||||
public ReJson DoPayOrder(string ordernum)
|
||||
{
|
||||
//获取订单
|
||||
Order entity = Order.Find(Order._.OrderNum == ordernum);
|
||||
@@ -59,21 +59,26 @@ namespace COMCMS.Web.Controllers.api
|
||||
return new ReJson(40000, "用户状态错误,无法使用本功能!");
|
||||
}
|
||||
//开始生成支付订单
|
||||
OnlinePayOrder model = new OnlinePayOrder();
|
||||
model.OrderId = entity.Id;
|
||||
model.OrderNum = entity.OrderNum;
|
||||
model.PayId = 1;
|
||||
model.PaymentNotes = "微信支付";
|
||||
model.PaymentStatus = Utils.PaymentState[0];
|
||||
model.PayOrderNum = Utils.GetOrderNum();//在线支付订单的订单号
|
||||
model.PayType = "微信支付";
|
||||
model.TotalPrice = entity.TotalPay;
|
||||
model.TotalQty = entity.TotalQty;
|
||||
model.UId = entity.UId;
|
||||
model.IP = Utils.GetIP();
|
||||
model.IsOK = 0;
|
||||
model.AddTime = DateTime.Now;
|
||||
model.Insert();
|
||||
OnlinePayOrder model = OnlinePayOrder.Find(OnlinePayOrder._.OrderNum == entity.OrderNum);
|
||||
if(model == null)
|
||||
{
|
||||
model = new OnlinePayOrder();
|
||||
model.OrderId = entity.Id;
|
||||
model.OrderNum = entity.OrderNum;
|
||||
model.PayId = 1;
|
||||
model.PaymentNotes = "微信支付";
|
||||
model.PaymentStatus = Utils.PaymentState[0];
|
||||
model.PayOrderNum = Utils.GetOrderNum();//在线支付订单的订单号
|
||||
model.PayType = "微信支付";
|
||||
model.TotalPrice = entity.TotalPay;
|
||||
model.TotalQty = entity.TotalQty;
|
||||
model.UId = entity.UId;
|
||||
model.Ip = Utils.GetIP();
|
||||
model.IsOK = 0;
|
||||
model.AddTime = DateTime.Now;
|
||||
model.Insert();
|
||||
}
|
||||
|
||||
|
||||
//写入日志
|
||||
OrderLog log = new OrderLog();
|
||||
@@ -92,7 +97,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
|
||||
|
||||
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey, Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey,"","", Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info.TenPayV3Notify = Utils.GetServerUrl() + "/wxpayment/notify";
|
||||
XTrace.WriteLine("微信支付异步通知地址:" + TenPayV3Info.TenPayV3Notify);
|
||||
//创建支付应答对象
|
||||
@@ -102,7 +107,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
string rtimeStamp = Utils.GetTimeStamp();
|
||||
|
||||
//创建请求统一订单接口参数
|
||||
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, entity.Title, model.PayOrderNum, (int)(entity.TotalPay * 100), Utils.GetIP(), TenPayV3Info.TenPayV3Notify, Senparc.Weixin.TenPay.TenPayV3Type.JSAPI, my.WeixinAppOpenId, TenPayV3Info.Key, nonceStr);
|
||||
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, entity.Title, model.OrderNum, (int)(entity.TotalPay * 100), Utils.GetIP(), TenPayV3Info.TenPayV3Notify, Senparc.Weixin.TenPay.TenPayV3Type.JSAPI, my.WeixinAppOpenId, TenPayV3Info.Key, nonceStr);
|
||||
|
||||
//返回给微信的请求
|
||||
RequestHandler res = new RequestHandler(null);
|
||||
|
||||
@@ -11,7 +11,6 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
@@ -34,7 +33,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetCategories(int level, int pid = 0, string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetCategories(int level, int pid = 0)
|
||||
{
|
||||
var list = Category.GetListTree(pid, level, false, false);
|
||||
|
||||
@@ -74,7 +73,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public object GetProductList(int kid, int page, int pageSize = 10, string random = "", string timeStamp = "", string signature = "")
|
||||
public object GetProductList(int kid, int page, int pageSize = 10)
|
||||
{
|
||||
var where = Product._.IsHide == 0;
|
||||
if (kid > 0)
|
||||
|
||||
@@ -11,10 +11,10 @@ using XCode;
|
||||
using System.Web;
|
||||
using COMCMS.Web.Filter;
|
||||
using NewLife.Log;
|
||||
using static COMCMS.Web.Models.APIModels;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
using COMCMS.Web.Models;
|
||||
|
||||
namespace COMCMS.Web.Controllers.api
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[CheckFilter]
|
||||
public ReJson UserLogin(string code, string random = "", string timeStamp = "", string signature = "")
|
||||
public ReJson UserLogin(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace COMCMS.Web.Controllers.api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ReJson SyncWeixinInfo(string sessionkey, string userInfo, int inviteid = 0, string random = "", string timeStamp = "", string signature = "")
|
||||
public ReJson SyncWeixinInfo(string sessionkey, string userInfo, int inviteid = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sessionkey))
|
||||
{
|
||||
|
||||
@@ -14,10 +14,11 @@ using Senparc.Weixin.TenPay.V3;
|
||||
using System.Collections;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using COMCMS.Web.Common;
|
||||
|
||||
namespace COMCMS.Web.Controllers
|
||||
{
|
||||
public class wxpaymentController : HomeController
|
||||
public class wxpaymentController : HomeBaseController
|
||||
{
|
||||
#region 微信支付异步通知
|
||||
/// <summary>
|
||||
@@ -41,7 +42,7 @@ namespace COMCMS.Web.Controllers
|
||||
string wxmchId = cfg.MCHId;// ConfigurationManager.AppSettings["WeixinMCHId"];
|
||||
string wxmchKey = cfg.MCHKey;// ConfigurationManager.AppSettings["WeixinMCHKey"];
|
||||
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey, Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey,"","", Utils.GetServerUrl() + "/wxpayment/notify", Utils.GetServerUrl() + "/wxpayment/notify");
|
||||
string res = null;
|
||||
|
||||
resHandler.SetKey(TenPayV3Info.Key);
|
||||
@@ -53,7 +54,7 @@ namespace COMCMS.Web.Controllers
|
||||
string out_trade_no = resHandler.GetParameter("out_trade_no");//商户订单号
|
||||
XTrace.WriteLine("微信异步通知订单号:" + out_trade_no + ";" + JsonConvert.SerializeObject(resHandler));
|
||||
|
||||
OnlinePayOrder payOrder = OnlinePayOrder.Find(OnlinePayOrder._.PayOrderNum == out_trade_no);
|
||||
OnlinePayOrder payOrder = OnlinePayOrder.Find(OnlinePayOrder._.OrderNum == out_trade_no);
|
||||
if (payOrder == null)
|
||||
{
|
||||
XTrace.WriteLine($"支付成功,但是支付订单不存在:{out_trade_no}");
|
||||
@@ -66,6 +67,7 @@ namespace COMCMS.Web.Controllers
|
||||
//更新支付订单
|
||||
payOrder.PaymentStatus = Utils.PaymentState[1];
|
||||
payOrder.ReceiveTime = DateTime.Now;
|
||||
payOrder.OutTradeNo = out_trade_no;
|
||||
payOrder.IsOK = 1;
|
||||
payOrder.Update();
|
||||
|
||||
@@ -75,6 +77,8 @@ namespace COMCMS.Web.Controllers
|
||||
{
|
||||
order.PaymentStatus = Utils.PaymentState[1];
|
||||
order.PayType = "微信支付";
|
||||
order.OutTradeNo = out_trade_no;
|
||||
|
||||
if (order.MyType == (int)Utils.MyType.分销商认证)
|
||||
{
|
||||
order.OrderStatus = Utils.OrdersState[2];
|
||||
|
||||
@@ -9,8 +9,6 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
|
||||
|
||||
namespace COMCMS.Web.Filter
|
||||
{
|
||||
public class CheckFilterAttribute : ActionFilterAttribute
|
||||
@@ -33,7 +31,13 @@ namespace COMCMS.Web.Filter
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception(error);
|
||||
ReJson re = new ReJson(40000, error);
|
||||
context.Result = new ContentResult()
|
||||
{
|
||||
Content = re.ToJson(),
|
||||
ContentType = "application/json"
|
||||
};
|
||||
//throw new Exception(error);
|
||||
}
|
||||
|
||||
var notVali = ValiSignature(context.HttpContext);
|
||||
@@ -49,35 +53,60 @@ namespace COMCMS.Web.Filter
|
||||
}
|
||||
}
|
||||
|
||||
#region 详细验证
|
||||
private ReJson ValiSignature(HttpContext context)
|
||||
{
|
||||
var Request = context.Request;
|
||||
|
||||
var queryStrings = Request.Query;
|
||||
List<string> keys = new List<string>();
|
||||
//string[] keys = HttpContext.Current.Request.QueryString.AllKeys;
|
||||
if (queryStrings == null)
|
||||
{
|
||||
throw new Exception("queryStrings Is Null");
|
||||
}
|
||||
foreach (var item in queryStrings.Keys)
|
||||
{
|
||||
keys.Add(item);
|
||||
}
|
||||
SortedDictionary<string, string> pars = new SortedDictionary<string, string>();
|
||||
string signature = "";
|
||||
foreach (var k in keys)
|
||||
string method = Request.Method.ToUpper();
|
||||
if (method == "GET")
|
||||
{
|
||||
if (k != "signature")
|
||||
var queryStrings = Request.Query;
|
||||
List<string> keys = new List<string>();
|
||||
//string[] keys = HttpContext.Current.Request.QueryString.AllKeys;
|
||||
if (queryStrings == null)
|
||||
{
|
||||
string v = Request.Query[k];
|
||||
pars.Add(k, v);
|
||||
return new ReJson(40000, "参数错误!");
|
||||
}
|
||||
else
|
||||
foreach (var item in queryStrings.Keys)
|
||||
{
|
||||
signature = Request.Query[k];
|
||||
keys.Add(item);
|
||||
}
|
||||
foreach (var k in keys)
|
||||
{
|
||||
if (k != "signature")
|
||||
{
|
||||
string v = Request.Query[k];
|
||||
pars.Add(k, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
signature = Request.Query[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(method == "POST")
|
||||
{
|
||||
var stream = context.Request.Form;
|
||||
foreach (var item in stream)
|
||||
{
|
||||
if (item.Key != "signature")
|
||||
{
|
||||
pars.Add(item.Key, item.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
signature = item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ReJson(50000, "不支持的HTTP方法!");
|
||||
}
|
||||
|
||||
|
||||
//没有签名返回错误
|
||||
if (string.IsNullOrEmpty(signature))
|
||||
return new ReJson(40004, "signature 为空!");
|
||||
@@ -91,12 +120,15 @@ namespace COMCMS.Web.Filter
|
||||
string timeStamp = pars["timeStamp"];
|
||||
//判断时间有效性
|
||||
DateTime postTime = Utils.StampToDateTime(timeStamp);
|
||||
if (postTime < DateTime.Now.AddSeconds(-120))//30秒有效期
|
||||
if (postTime < DateTime.UtcNow.AddSeconds(-120))//30秒有效期
|
||||
{
|
||||
return new ReJson(40004, "signature 错误!", 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,57 +5,104 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace COMCMS.Web.Models
|
||||
{
|
||||
public class APIModels
|
||||
#region 修改我的个人资料Model
|
||||
public class APIModMyInfo
|
||||
{
|
||||
#region 修改我的个人资料Model
|
||||
public class APIModMyInfo
|
||||
{
|
||||
public string RealName { get; set; }
|
||||
public string Tel { get; set; }
|
||||
public string Weixin { get; set; }
|
||||
public string Alipay { get; set; }
|
||||
public string BankCardNO { get; set; }
|
||||
public string Bank { get; set; }
|
||||
public string SessionKey { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 小程序获得用户信息
|
||||
/// <summary>
|
||||
/// 小程序获得用户信息
|
||||
/// </summary>
|
||||
public class WXAppUserInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string nickName { get; set; }
|
||||
/// <summary>
|
||||
/// 性别 0 未知,1 男,2女
|
||||
/// </summary>
|
||||
public int gender { get; set; }
|
||||
/// <summary>
|
||||
/// 语言
|
||||
/// </summary>
|
||||
public string language { get; set; }
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string city { get; set; }
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public string province { get; set; }
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string country { get; set; }
|
||||
/// <summary>
|
||||
/// 用户头像
|
||||
/// </summary>
|
||||
public string avatarUrl { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
public string RealName { get; set; }
|
||||
public string Tel { get; set; }
|
||||
public string Weixin { get; set; }
|
||||
public string Alipay { get; set; }
|
||||
public string BankCardNO { get; set; }
|
||||
public string Bank { get; set; }
|
||||
public string SessionKey { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 小程序获得用户信息
|
||||
/// <summary>
|
||||
/// 小程序获得用户信息
|
||||
/// </summary>
|
||||
public class WXAppUserInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string nickName { get; set; }
|
||||
/// <summary>
|
||||
/// 性别 0 未知,1 男,2女
|
||||
/// </summary>
|
||||
public int gender { get; set; }
|
||||
/// <summary>
|
||||
/// 语言
|
||||
/// </summary>
|
||||
public string language { get; set; }
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string city { get; set; }
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public string province { get; set; }
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string country { get; set; }
|
||||
/// <summary>
|
||||
/// 用户头像
|
||||
/// </summary>
|
||||
public string avatarUrl { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 通用返回信息
|
||||
public class ReJson
|
||||
{
|
||||
public ReJson(string message)
|
||||
{
|
||||
this.message = message;
|
||||
code = 0;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message, int isReload)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.isReload = isReload;
|
||||
}
|
||||
|
||||
public ReJson(int code, string message, object detail)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回代码 0 为正确
|
||||
/// </summary>
|
||||
public int code { get; set; } = 40000;
|
||||
|
||||
/// <summary>
|
||||
/// 提示语
|
||||
/// </summary>
|
||||
public string message { get; set; }
|
||||
/// <summary>
|
||||
/// 是否重新加载
|
||||
/// </summary>
|
||||
public int isReload { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 数据详情 object
|
||||
/// </summary>
|
||||
public object detail { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace COMCMS.Web
|
||||
@@ -14,12 +15,14 @@ namespace COMCMS.Web
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
BuildWebHost(args).Run();
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHost BuildWebHost(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+48
-36
@@ -4,30 +4,29 @@ using System.Linq;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Unicode;
|
||||
using System.Threading.Tasks;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Web.Common;
|
||||
using COMCMS.Web.ExceptionHandler;
|
||||
using COMCMS.Web.Models;
|
||||
using Lib.Core.MiddlewareExtension.Extension;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.WebEncoders;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Web.Models;
|
||||
using COMCMS.Web.Common;
|
||||
using COMCMS.Web.ExceptionHandler;
|
||||
using Lib.Core.MiddlewareExtension.Extension;
|
||||
using Senparc.Weixin.Entities;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Senparc.CO2NET;
|
||||
using Senparc.CO2NET.Cache;
|
||||
using Senparc.CO2NET.RegisterServices;
|
||||
using Senparc.Weixin;
|
||||
using Senparc.CO2NET.Cache;
|
||||
using System.Configuration;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Senparc.Weixin.Entities;
|
||||
using Senparc.Weixin.RegisterServices;
|
||||
using Microsoft.AspNetCore.Routing.Constraints;
|
||||
|
||||
namespace COMCMS.Web
|
||||
{
|
||||
@@ -68,22 +67,28 @@ namespace COMCMS.Web
|
||||
{
|
||||
options.IdleTimeout = TimeSpan.FromSeconds(120);
|
||||
options.Cookie.HttpOnly = true;
|
||||
|
||||
|
||||
});
|
||||
//部分系统配置
|
||||
services.Configure<SystemSetting>(Configuration.GetSection("SystemSetting"));
|
||||
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); ;
|
||||
services
|
||||
.AddControllersWithViews(options =>
|
||||
{
|
||||
//记录错误
|
||||
options.Filters.Add<HttpGlobalExceptionFilter>();
|
||||
})
|
||||
.AddNewtonsoftJson(options => {
|
||||
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||
});
|
||||
|
||||
//防止汉字被自动编码
|
||||
services.Configure<WebEncoderOptions>(options =>
|
||||
{
|
||||
options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All);
|
||||
});
|
||||
//记录错误
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.Filters.Add<HttpGlobalExceptionFilter>();
|
||||
});
|
||||
|
||||
services.AddSenparcGlobalServices(Configuration)//Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(Configuration);//Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
@@ -91,22 +96,27 @@ namespace COMCMS.Web
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||
|
||||
// 设置表单内容限制
|
||||
services.Configure<FormOptions>(formOptions =>
|
||||
services.Configure<FormOptions>(options =>
|
||||
{
|
||||
formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
||||
formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
||||
//formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
||||
//formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
||||
options.ValueCountLimit = int.MaxValue;
|
||||
options.ValueLengthLimit = int.MaxValue;
|
||||
options.KeyLengthLimit = int.MaxValue;
|
||||
options.MultipartBodyLengthLimit = int.MaxValue;
|
||||
options.MultipartBoundaryLengthLimit = int.MaxValue;
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider svp, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider svp, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
||||
await next();
|
||||
});
|
||||
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
|
||||
@@ -117,7 +127,7 @@ namespace COMCMS.Web
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//其他错误页面处理
|
||||
app.UseStatusCodePagesWithReExecute("/StatusCode/{0}");
|
||||
@@ -129,25 +139,26 @@ namespace COMCMS.Web
|
||||
app.UseCookiePolicy();
|
||||
app.UseAuthentication();
|
||||
app.UseStaticHttpContext();
|
||||
app.UseRouting();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
endpoints.MapControllerRoute(
|
||||
name: "areas",
|
||||
template: "{area:exists}/{controller=Index}/{action=Index}/{id?}"
|
||||
pattern: "{area:exists}/{controller=Index}/{action=Index}/{id?}"
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
routes.MapRoute(
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
endpoints.MapControllerRoute(
|
||||
name: "article",
|
||||
template: "{title}/index.html",
|
||||
defaults:new { controller ="Home", action= "Article" }
|
||||
pattern: "{title}/index.html",
|
||||
defaults: new { controller = "Home", action = "Article" }
|
||||
);
|
||||
routes.MapRoute(
|
||||
endpoints.MapControllerRoute(
|
||||
name: "article2",
|
||||
template: "{title}/",
|
||||
pattern: "{title}/",
|
||||
defaults: new { controller = "Home", action = "Article" }
|
||||
);
|
||||
});
|
||||
@@ -160,6 +171,7 @@ namespace COMCMS.Web
|
||||
|
||||
app.UseMiddlewareExtension(new ResultExceptionHandler());
|
||||
IRegisterService register = RegisterService.Start(env, senparcSetting.Value).UseSenparcGlobal();
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
//加入HttpContext
|
||||
//MyHttpContext.ServiceProvider = svp;
|
||||
}
|
||||
|
||||
+212
-185
@@ -6,7 +6,6 @@
|
||||
ViewBag.description = cfg.Description;
|
||||
|
||||
Article about = ViewBag.about;
|
||||
|
||||
IList<Link> listLinks = Link.FindAll(Link._.KId == 1, Link._.Sequence.Asc(), null, 0, 0);
|
||||
|
||||
//处理bannr广告
|
||||
@@ -18,11 +17,16 @@
|
||||
<div class="banner normal">
|
||||
<div class="swiper-container">
|
||||
<div class="swiper-wrapper">
|
||||
@foreach (var img in bannerPC)
|
||||
{
|
||||
<div class="swiper-slide">
|
||||
<a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size:cover"></a>
|
||||
</div>
|
||||
@{
|
||||
if(bannerPC != null && bannerPC.Any())
|
||||
{
|
||||
foreach (var img in bannerPC)
|
||||
{
|
||||
<div class="swiper-slide">
|
||||
<a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size:cover"></a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="cont">
|
||||
@@ -35,12 +39,17 @@
|
||||
<div class="banner mobile">
|
||||
<div class="swiper-container">
|
||||
<div class="swiper-wrapper">
|
||||
@foreach (var img in bannerPC)
|
||||
{
|
||||
<div class="swiper-slide">
|
||||
<a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size: 100%;"></a>
|
||||
</div>
|
||||
}
|
||||
@{
|
||||
if(bannerPC != null && bannerPC.Any())
|
||||
{
|
||||
foreach (var img in bannerPC)
|
||||
{
|
||||
<div class="swiper-slide">
|
||||
<a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size: 100%;"></a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -169,13 +178,13 @@
|
||||
<div class="i-au-left">
|
||||
<div class="pic-box">
|
||||
<a href="/Article/detail/1" title="关于我们">
|
||||
<img src="@(about.Pic)" alt="关于我们">
|
||||
<img src="@(about?.Pic)" alt="关于我们">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-au-right">
|
||||
<p>
|
||||
@(Utils.CutString(Utils.NoHTML(about.Content), 700))
|
||||
@(Utils.CutString(Utils.NoHTML(about?.Content), 700))
|
||||
</p>
|
||||
<a href="/Article/detail/1" title="查看详情" class="read-d">查看详情</a>
|
||||
</div>
|
||||
@@ -192,60 +201,65 @@
|
||||
<small>product display</small>
|
||||
</p>
|
||||
</div>
|
||||
@{
|
||||
//获取前5个商品
|
||||
IList<Product> listPorducts = Product.FindAll(null, null, null, 0, 5);
|
||||
}
|
||||
<div class="i-pro-cont" id="div1">
|
||||
<ul class="i-pro-list">
|
||||
@foreach(var p in listPorducts)
|
||||
{
|
||||
<li>
|
||||
<a asp-controller="Product" asp-action="Detail" asp-route-id="@(p.Id)" title="@(p.Title)">
|
||||
<div class="i-pro-top">
|
||||
<div class="i-pro-pic">
|
||||
<div class="pic-box">
|
||||
<img src="@p.Pic" alt="@(p.Title)">
|
||||
@{
|
||||
//获取前5个商品
|
||||
IList<Product> listPorducts = Product.FindAll(null, null, null, 0, 5);
|
||||
}
|
||||
<div class="i-pro-cont" id="div1">
|
||||
<ul class="i-pro-list">
|
||||
@foreach(var p in listPorducts)
|
||||
{
|
||||
<li>
|
||||
<a asp-controller="Product" asp-action="Detail" asp-route-id="@(p.Id)" title="@(p.Title)">
|
||||
<div class="i-pro-top">
|
||||
<div class="i-pro-pic">
|
||||
<div class="pic-box">
|
||||
<img src="@p.Pic" alt="@(p.Title)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-pro-hover">
|
||||
<i></i>
|
||||
<span>@(p.Title)</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-pro-hover">
|
||||
<i></i>
|
||||
<div class="i-pro-text mobile">
|
||||
<span>@(p.Title)</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-pro-text mobile">
|
||||
<span>@(p.Title)</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function proShow() {
|
||||
mr = parseFloat($('.i-pro-list li').css('margin-right'));
|
||||
var odiv = document.getElementById('div1');
|
||||
var oul = odiv.getElementsByTagName('ul')[0];
|
||||
var ali = oul.getElementsByTagName('li');
|
||||
var spa = -2;
|
||||
oul.innerHTML = oul.innerHTML + oul.innerHTML;
|
||||
oul.style.width = (ali[0].offsetWidth + mr) * ali.length + 3 + 'px';
|
||||
function move() {
|
||||
if (oul.offsetLeft < -oul.offsetWidth / 2) {
|
||||
oul.style.left = 0;
|
||||
}
|
||||
oul.style.left = oul.offsetLeft + spa + 'px';
|
||||
}
|
||||
var timer = setInterval(move, 30);
|
||||
|
||||
odiv.onmousemove = function () { clearInterval(timer); }
|
||||
odiv.onmouseout = function () { timer = setInterval(move, 30) };
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</script>
|
||||
|
||||
<a asp-controller="Product" asp-action="Index" asp-route-id="1" title="查看更多" class="read-d">查看更多<i></i></a>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function proShow() {
|
||||
mr = parseFloat($('.i-pro-list li').css('margin-right'));
|
||||
var odiv = document.getElementById('div1');
|
||||
var oul = odiv.getElementsByTagName('ul')[0];
|
||||
var ali = oul.getElementsByTagName('li');
|
||||
var spa = -2;
|
||||
oul.innerHTML = oul.innerHTML + oul.innerHTML;
|
||||
oul.style.width = (ali[0].offsetWidth + mr) * ali.length + 3 + 'px';
|
||||
|
||||
function move() {
|
||||
if (oul.offsetLeft < -oul.offsetWidth / 2) {
|
||||
oul.style.left = 0;
|
||||
}
|
||||
oul.style.left = oul.offsetLeft + spa + 'px';
|
||||
}
|
||||
var timer = setInterval(move, 30);
|
||||
|
||||
odiv.onmousemove = function () {
|
||||
clearInterval(timer);
|
||||
}
|
||||
odiv.onmouseout = function () {
|
||||
timer = setInterval(move, 30)
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<a asp-controller="Product" asp-action="Index" asp-route-id="1" title="查看更多" class="read-d">查看更多<i></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -266,13 +280,14 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="i-news-main">
|
||||
@{
|
||||
IList<Article> listNews1 = Article.FindAll(Article._.KId == 6, Article._.Sequence.Asc(), null, 0, 4);
|
||||
}
|
||||
<div class="i-news-box">
|
||||
<!-- 左边 -->
|
||||
@if (listNews1.Count > 0)
|
||||
{
|
||||
@{
|
||||
IList<Article> listNews1 = Article.FindAll(Article._.KId == 6, Article._.Sequence.Asc(), null, 0,
|
||||
4);
|
||||
}
|
||||
<div class="i-news-box">
|
||||
<!-- 左边 -->
|
||||
@if (listNews1.Count > 0)
|
||||
{
|
||||
<div class="i-news-left">
|
||||
<a href="/article/detail/@listNews1[0].Id" title="@listNews1[0].Title">
|
||||
<div class="i-news-pic">
|
||||
@@ -290,111 +305,110 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
<!-- 右边 -->
|
||||
}
|
||||
<!-- 右边 -->
|
||||
<div class="i-news-right">
|
||||
@if (listNews1.Count > 1)
|
||||
{
|
||||
<ul class="i-news-list">
|
||||
@for(int i=1; i < listNews1.Count; i++) { <li>
|
||||
<a href="/article/detail/@listNews1[i].Id" title="@listNews1[i].Title">
|
||||
<div class="i-news-time">
|
||||
<div class="pic-box">
|
||||
<p>
|
||||
<span>@listNews1[i].AddTime.ToString("dd")</span>
|
||||
<small>@listNews1[i].AddTime.ToString("yyyy-MM")</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-text2">
|
||||
<span>@listNews1[i].Title</span>
|
||||
<p>@Utils.CutString(Utils.NoHTML(listNews1[i].Content), 100)</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-box">
|
||||
<!-- 左边 -->
|
||||
@{
|
||||
IList<Article> listNews2 = Article.FindAll(Article._.KId == 7, Article._.Sequence.Asc(),
|
||||
null, 0, 4);
|
||||
}
|
||||
@if (listNews2.Count > 0)
|
||||
{
|
||||
<div class="i-news-left">
|
||||
<a href="/article/detail/@listNews2[0].Id" title="@listNews2[0].Title">
|
||||
<div class="i-news-pic">
|
||||
<div class="pic-box">
|
||||
<img src="@listNews2[0].Pic" alt="@listNews2[0].Title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-text">
|
||||
<p class="i-news-title">
|
||||
<span>@listNews2[0].Title</span>
|
||||
<small>@listNews2[0].AddTime.ToString("yyyy-MM-dd")</small>
|
||||
</p>
|
||||
<p class="i-news-t"><span>@Utils.CutString(Utils.NoHTML(listNews2[0].Content),
|
||||
200)</span></p>
|
||||
<b class="normal read-d">查看详情</b>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
<!-- 右边 -->
|
||||
<div class="i-news-right">
|
||||
@if (listNews2.Count > 1)
|
||||
{
|
||||
<ul class="i-news-list">
|
||||
@for(int i=1; i < listNews1.Count; i++)
|
||||
{
|
||||
<li>
|
||||
<a href="/article/detail/@listNews1[i].Id" title="@listNews1[i].Title">
|
||||
@for (int i = 1; i < listNews2.Count; i++) { <li>
|
||||
<a href="/article/detail/@listNews2[i].Id" title="@listNews2[i].Title">
|
||||
<div class="i-news-time">
|
||||
<div class="pic-box">
|
||||
<p>
|
||||
<span>@listNews1[i].AddTime.ToString("dd")</span>
|
||||
<small>@listNews1[i].AddTime.ToString("yyyy-MM")</small>
|
||||
<span>@listNews2[i].AddTime.ToString("dd")</span>
|
||||
<small>@listNews2[i].AddTime.ToString("yyyy-MM")</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-text2">
|
||||
<span>@listNews1[i].Title</span>
|
||||
<p>@Utils.CutString(Utils.NoHTML(listNews1[i].Content), 100)</p>
|
||||
<span>@listNews2[i].Title</span>
|
||||
<p>@Utils.CutString(Utils.NoHTML(listNews2[i].Content), 100)</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-box">
|
||||
<!-- 左边 -->
|
||||
@{
|
||||
IList<Article> listNews2 = Article.FindAll(Article._.KId == 7, Article._.Sequence.Asc(), null, 0, 4);
|
||||
}
|
||||
@if (listNews2.Count > 0)
|
||||
{
|
||||
<div class="i-news-left">
|
||||
<a href="/article/detail/@listNews2[0].Id" title="@listNews2[0].Title">
|
||||
<div class="i-news-pic">
|
||||
<div class="pic-box">
|
||||
<img src="@listNews2[0].Pic" alt="@listNews2[0].Title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-text">
|
||||
<p class="i-news-title">
|
||||
<span>@listNews2[0].Title</span>
|
||||
<small>@listNews2[0].AddTime.ToString("yyyy-MM-dd")</small>
|
||||
</p>
|
||||
<p class="i-news-t"><span>@Utils.CutString(Utils.NoHTML(listNews2[0].Content), 200)</span></p>
|
||||
<b class="normal read-d">查看详情</b>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
<!-- 右边 -->
|
||||
<div class="i-news-right">
|
||||
@if (listNews2.Count > 1)
|
||||
{
|
||||
<ul class="i-news-list">
|
||||
@for (int i = 1; i < listNews2.Count; i++)
|
||||
{
|
||||
<li>
|
||||
<a href="/article/detail/@listNews2[i].Id" title="@listNews2[i].Title">
|
||||
<div class="i-news-time">
|
||||
<div class="pic-box">
|
||||
<p>
|
||||
<span>@listNews2[i].AddTime.ToString("dd")</span>
|
||||
<small>@listNews2[i].AddTime.ToString("yyyy-MM")</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="i-news-text2">
|
||||
<span>@listNews2[i].Title</span>
|
||||
<p>@Utils.CutString(Utils.NoHTML(listNews2[i].Content), 100)</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
iNews();
|
||||
function iNews() {
|
||||
var index = $('.i-news-on').index();
|
||||
$('.i-news-box').eq(index).show();
|
||||
var num = $('.i-btn-list li').length;
|
||||
iNews();
|
||||
|
||||
$('.i-btn-list').on('click', 'li', function () {
|
||||
index = $(this).index();
|
||||
for (var i = 0; i < num; i++) {
|
||||
$('.i-btn-list li').eq(i).removeClass('i-news-on');
|
||||
$('.i-news-box').eq(i).hide();
|
||||
}
|
||||
$(this).addClass('i-news-on');
|
||||
$('.i-news-box').eq(index).show();
|
||||
});
|
||||
function iNews() {
|
||||
var index = $('.i-news-on').index();
|
||||
$('.i-news-box').eq(index).show();
|
||||
var num = $('.i-btn-list li').length;
|
||||
|
||||
$('.i-btn-list').on('click', 'li', function () {
|
||||
index = $(this).index();
|
||||
for (var i = 0; i < num; i++) {
|
||||
$('.i-btn-list li').eq(i).removeClass('i-news-on');
|
||||
$('.i-news-box').eq(i).hide();
|
||||
}
|
||||
$(this).addClass('i-news-on');
|
||||
$('.i-news-box').eq(index).show();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -426,51 +440,51 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="swiper-pagination"></div>
|
||||
</div>
|
||||
<div class="swiper-container mobile">
|
||||
<div class="swiper-wrapper">
|
||||
@foreach (var l in listLinks)
|
||||
{
|
||||
<div class="swiper-slide">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="@l.LinkURL" class="pic-box" title="@l.Title" target="_blank">
|
||||
<img src="@l.Logo" alt="@l.Title">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="swiper-slide">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="@l.LinkURL" class="pic-box" title="@l.Title" target="_blank">
|
||||
<img src="@l.Logo" alt="@l.Title">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="swiper-pagination"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<i class="coop-prev"></i>
|
||||
<i class="coop-next"></i>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var mySwiper2;
|
||||
var mySwiper3;
|
||||
function coopSwiper() {
|
||||
if ($('#main').attr('class') === 'pc') {
|
||||
mySwiper3 = new Swiper('.i-coop-cont .normal', {
|
||||
loop: true,
|
||||
autoplay: 3000,
|
||||
slidesPerView: 5,
|
||||
nextButton: '.coop-next',
|
||||
prevButton: '.coop-prev',
|
||||
});
|
||||
} else if ($('#main').attr('class') === 'mb') {
|
||||
mySwiper4 = new Swiper('.i-coop-cont .mobile', {
|
||||
loop: true,
|
||||
autoplay: 3000,
|
||||
slidesPerView: 2,
|
||||
nextButton: '.coop-next',
|
||||
prevButton: '.coop-prev',
|
||||
});
|
||||
}
|
||||
var mySwiper2;
|
||||
var mySwiper3;
|
||||
|
||||
function coopSwiper() {
|
||||
if ($('#main').attr('class') === 'pc') {
|
||||
mySwiper3 = new Swiper('.i-coop-cont .normal', {
|
||||
loop: true,
|
||||
autoplay: 3000,
|
||||
slidesPerView: 5,
|
||||
nextButton: '.coop-next',
|
||||
prevButton: '.coop-prev',
|
||||
});
|
||||
} else if ($('#main').attr('class') === 'mb') {
|
||||
mySwiper4 = new Swiper('.i-coop-cont .mobile', {
|
||||
loop: true,
|
||||
autoplay: 3000,
|
||||
slidesPerView: 2,
|
||||
nextButton: '.coop-next',
|
||||
prevButton: '.coop-prev',
|
||||
});
|
||||
}
|
||||
}
|
||||
var mySwiper = new Swiper('.banner .swiper-container', {
|
||||
loop: true,
|
||||
@@ -479,8 +493,21 @@
|
||||
nextButton: '.banner-next',
|
||||
prevButton: '.banner-prev',
|
||||
autoplay: 3000,
|
||||
})
|
||||
});
|
||||
|
||||
$("#nav_0").addClass("nav-on");
|
||||
|
||||
var swiper = new Swiper('.i-coop-cont .swiper-container', {
|
||||
slidesPerView: 3,
|
||||
spaceBetween: 30,
|
||||
loop: true,
|
||||
autoplay: 3000,
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
@{
|
||||
Layout = null;
|
||||
ViewBag.Title = "信息提示";
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>@ViewBag.Title</title>
|
||||
<link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/hplus/css/style.css" rel="stylesheet" />
|
||||
<link href="~/hplus/css/font-awesome.min.css" rel="stylesheet" />
|
||||
<link href="~/hplus/css/animate.min.css" rel="stylesheet" />
|
||||
<link href="~/hplus/css/login.css" rel="stylesheet" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<h2>
|
||||
<i class="fa fa-info-circle"></i> 信息提示<br />
|
||||
</h2>
|
||||
<h3>
|
||||
@ViewBag.Message
|
||||
</h3>
|
||||
<p class="text-center">
|
||||
<a class="btn btn-primary" href="/">返回首页</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -31,12 +31,13 @@
|
||||
<div class="menu-bg"></div>
|
||||
<ul class="nav-list">
|
||||
<li id="nav_0"><a href="/" title="首页">首页</a><i></i></li>
|
||||
<li id="nav_1"><a asp-controller="Article" asp-action="Index" asp-route-id="1" title="关于我们">关于我们</a><i></i></li>
|
||||
<li id="nav_P"><a asp-controller="Product" asp-action="Index" asp-route-id="1" title="产品中心">产品中心</a><i></i></li>
|
||||
<li id="nav_2"><a asp-controller="Article" asp-action="Index" asp-route-id="2" title="新闻资讯">新闻资讯</a><i></i></li>
|
||||
<li id="nav_3"><a asp-controller="Article" asp-action="Index" asp-route-id="3" title="项目案例">项目案例</a><i></i></li>
|
||||
<li id="nav_4"><a asp-controller="Article" asp-action="Index" asp-route-id="4" title="用户服务">用户服务</a><i></i></li>
|
||||
<li id="nav_5"><a asp-controller="Article" asp-action="Index" asp-route-id="5" title="联系我们">联系我们</a><i></i></li>
|
||||
|
||||
<li id="nav_1"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,1)" title="关于我们">关于我们</a><i></i></li>
|
||||
<li id="nav_P"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ProductCategory,1)" title="产品中心">产品中心</a><i></i></li>
|
||||
<li id="nav_2"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,2)" title="新闻资讯">新闻资讯</a><i></i></li>
|
||||
<li id="nav_3"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,3)" title="项目案例">项目案例</a><i></i></li>
|
||||
<li id="nav_4"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,4)" title="用户服务">用户服务</a><i></i></li>
|
||||
<li id="nav_5"><a href="@ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory,5)" title="联系我们">联系我们</a><i></i></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -210,7 +211,7 @@
|
||||
</div>
|
||||
<div class="foot-bottom">
|
||||
<div class="cont">
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a></span>
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a> Powered by .NET Core 3.1.0 on Windows Server</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
@using COMCMS.Core
|
||||
@using COMCMS.Common
|
||||
@using XCode
|
||||
@using COMCMS.Web.Common
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ Software License Agreement
|
||||
==========================
|
||||
|
||||
CKEditor - The text editor for Internet - https://ckeditor.com/
|
||||
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
|
||||
Licensed under the terms of any of the following licenses at your
|
||||
choice:
|
||||
@@ -37,9 +37,10 @@ done by developers outside of CKSource with their express permission.
|
||||
|
||||
The following libraries are included in CKEditor under the MIT license (see Appendix D):
|
||||
|
||||
* CKSource Samples Framework (included in the samples) - Copyright (c) 2014-2018, CKSource - Frederico Knabben.
|
||||
* CKSource Samples Framework (included in the samples) - Copyright (c) 2014-2019, CKSource - Frederico Knabben.
|
||||
* PicoModal (included in `samples/js/sf.js`) - Copyright (c) 2012 James Frasca.
|
||||
* CodeMirror (included in the samples) - Copyright (C) 2014 by Marijn Haverbeke <marijnh@gmail.com> and others.
|
||||
* ES6Promise - Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors.
|
||||
|
||||
Parts of code taken from the following libraries are included in CKEditor under the MIT license (see Appendix D):
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CKEditor 4
|
||||
==========
|
||||
|
||||
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
http://ckeditor.com - See LICENSE.md for license information.
|
||||
|
||||
CKEditor is a text editor to be used inside web pages. It's not a replacement
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
||||
*/
|
||||
(function(a){if("undefined"==typeof a)throw Error("jQuery should be loaded before CKEditor jQuery adapter.");if("undefined"==typeof CKEDITOR)throw Error("CKEditor should be loaded before CKEditor jQuery adapter.");CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a},
|
||||
ckeditor:function(g,d){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g)){var m=d;d=g;g=m}var k=[];d=d||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(arguments.callee,100)},0)},
|
||||
null,null,9999);else{if(d.autoUpdateElement||"undefined"==typeof d.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)d.autoUpdateElementJquery=!0;d.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,d):CKEDITOR.inline(h,d);b.data("ckeditorInstance",c);c.on("instanceReady",function(d){var e=d.editor;setTimeout(function(){if(e.element){d.removeListener();e.on("dataReady",function(){b.trigger("dataReady.ckeditor",[e])});e.on("setData",function(a){b.trigger("setData.ckeditor",
|
||||
[e,a.data])});e.on("getData",function(a){b.trigger("getData.ckeditor",[e,a.data])},999);e.on("destroy",function(){b.trigger("destroy.ckeditor",[e])});e.on("save",function(){a(h.form).submit();return!1},null,null,20);if(e.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){e.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize",
|
||||
c)})}e.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[e]);g&&g.apply(e,[h]);l.resolve()}else setTimeout(arguments.callee,100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,k).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}});CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(d){if(arguments.length){var m=
|
||||
this,k=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(d,function(){f.resolve()});k.push(f.promise());return!0}return g.call(b,d)});if(k.length){var b=new a.Deferred;a.when.apply(this,k).done(function(){b.resolveWith(m)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}}))})(window.jQuery);
|
||||
ckeditor:function(g,e){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g)){var m=e;e=g;g=m}var k=[];e=e||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function d(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(d,100)},0)},null,null,9999);
|
||||
else{if(e.autoUpdateElement||"undefined"==typeof e.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)e.autoUpdateElementJquery=!0;e.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,e):CKEDITOR.inline(h,e);b.data("ckeditorInstance",c);c.on("instanceReady",function(e){var d=e.editor;setTimeout(function n(){if(d.element){e.removeListener();d.on("dataReady",function(){b.trigger("dataReady.ckeditor",[d])});d.on("setData",function(a){b.trigger("setData.ckeditor",
|
||||
[d,a.data])});d.on("getData",function(a){b.trigger("getData.ckeditor",[d,a.data])},999);d.on("destroy",function(){b.trigger("destroy.ckeditor",[d])});d.on("save",function(){a(h.form).submit();return!1},null,null,20);if(d.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){d.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize",
|
||||
c)})}d.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[d]);g&&g.apply(d,[h]);l.resolve()}else setTimeout(n,100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,k).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}});CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(e){if(arguments.length){var m=
|
||||
this,k=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(e,function(){f.resolve()});k.push(f.promise());return!0}return g.call(b,e)});if(k.length){var b=new a.Deferred;a.when.apply(this,k).done(function(){b.resolveWith(m)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}}))})(window.jQuery);
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/license
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -10,13 +10,13 @@
|
||||
* If you would like to build CKEditor online again
|
||||
* (for example to upgrade), visit one the following links:
|
||||
*
|
||||
* (1) http://ckeditor.com/builder
|
||||
* (1) https://ckeditor.com/cke4/builder
|
||||
* Visit online builder to build CKEditor from scratch.
|
||||
*
|
||||
* (2) http://ckeditor.com/builder/c3fc0dcaa9c80d707aab3e60fdcddbfb
|
||||
* (2) https://ckeditor.com/cke4/builder/4e3a4ca28d8cb0c407b480601a63d4b6
|
||||
* Visit online builder to build CKEditor, starting with the same setup as before.
|
||||
*
|
||||
* (3) http://ckeditor.com/builder/download/c3fc0dcaa9c80d707aab3e60fdcddbfb
|
||||
* (3) https://ckeditor.com/cke4/builder/download/4e3a4ca28d8cb0c407b480601a63d4b6
|
||||
* Straight download link to the latest version of CKEditor (Optimized) with the same setup as before.
|
||||
*
|
||||
* NOTE:
|
||||
@@ -89,8 +89,10 @@ var CKBUILDER_CONFIG = {
|
||||
'maximize' : 1,
|
||||
'newpage' : 1,
|
||||
'pagebreak' : 1,
|
||||
'pastefromgdocs' : 1,
|
||||
'pastefromword' : 1,
|
||||
'pastetext' : 1,
|
||||
'pastetools' : 1,
|
||||
'preview' : 1,
|
||||
'print' : 1,
|
||||
'removeformat' : 1,
|
||||
|
||||
+918
-882
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ CKEDITOR.editorConfig = function( config ) {
|
||||
config.filebrowserUploadUrl = '/AdminCP/Upload/CKUploadFile?action=uploadfile';
|
||||
config.font_names = '宋体/宋体;黑体/黑体;楷体/楷体;幼圆/幼圆;微软雅黑/微软雅黑;' + config.font_names;
|
||||
config.allowedContent = true;
|
||||
config.extraPlugins = 'html5video,lineheight,widget,widgetselection,clipboard,lineutils';
|
||||
config.extraPlugins = 'html5video,lineheight,widget,widgetselection,clipboard,lineutils,emoji';
|
||||
config.line_height = "0;1em;1.1em;1.2em;1.3em;1.4em;1.5em;1.6em;1.7em;1.8em;1.9em;2em;2.5em;3em;3.5em;4em;5em";
|
||||
config.toolbar_Common = [
|
||||
{ name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source', '-', 'NewPage', 'Preview', 'Print', '-', 'Templates'] },
|
||||
@@ -23,7 +23,7 @@ CKEDITOR.editorConfig = function( config ) {
|
||||
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
|
||||
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] },
|
||||
|
||||
{ name: 'insert', items: ['Image', 'Flash', 'html5video' , 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'Iframe',] },
|
||||
{ name: 'insert', items: ['Image', 'Flash', 'html5video', 'Table', 'HorizontalRule', 'Smiley','emoji', 'SpecialChar', 'Iframe',] },
|
||||
'/',
|
||||
{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize', 'lineheight'] },
|
||||
{ name: 'colors', items: ['TextColor', 'BGColor'] },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
||||
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
||||
*/
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user