Commit ca37b02d authored by 黄奎's avatar 黄奎

新增实体

parent e7a50b46
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic
{
/// <summary>
/// 专题Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 标题
/// </summary>
public string Title
{
get;
set;
}
/// <summary>
/// 专题列表布局方式
/// </summary>
public int? FlexType
{
get;
set;
}
/// <summary>
/// 封面图
/// </summary>
public string CoverImg
{
get;
set;
}
/// <summary>
/// 摘要
/// </summary>
public string Abstract
{
get;
set;
}
/// <summary>
/// 自定义分享标题
/// </summary>
public string CustomTitle
{
get;
set;
}
/// <summary>
/// 自定义分享图片
/// </summary>
public string CustomImg
{
get;
set;
}
/// <summary>
/// 是否精选(1-是)
/// </summary>
public int? IsChoice
{
get;
set;
}
/// <summary>
/// 分类编号
/// </summary>
public int? TopicTypeId
{
get;
set;
}
/// <summary>
/// 阅读数量
/// </summary>
public int? ReadNum
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? SortNum
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 模板数据[JSON]格式
/// </summary>
public string TemplateData { get; set; }
}
}
......@@ -302,6 +302,98 @@ namespace Mall.Model.Extend.MarketingCenter
public string btnTextColor { get; set; }
}
/// <summary>
/// 专题插件
/// </summary>
public class topicItem
{
/// <summary>
/// 样式
/// </summary>
public string normal { get; set; }
public int count { get; set; }
public string logo_1 { get; set; }
public string logo_2 { get; set; }
public string icon { get; set; }
/// <summary>
/// 是否显示分类
/// </summary>
public bool cat_show { get; set; }
/// <summary>
/// 专题列表
/// </summary>
public List<topicDetailsItem> topic_list { get; set; }
/// <summary>
/// 专题分类列表
/// </summary>
public List<topicTypeItem> list { get; set; }
}
/// <summary>
/// 专题分类
/// </summary>
public class topicTypeItem
{
/// <summary>
/// 分类Id
/// </summary>
public int cat_id { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public int cat_name { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public int name { get; set; }
public int custom { get; set; }
public int number { get; set; }
public List<object> children { get; set; }
}
/// <summary>
/// 专题列表详情
/// </summary>
public class topicDetailsItem
{
/// <summary>
/// 专题标题
/// </summary>
public string title { get; set; }
/// <summary>
/// 专题封面图
/// </summary>
public string cover_pic { get; set; }
/// <summary>
/// 专题阅读数量
/// </summary>
public int read_count { get; set; }
/// <summary>
///
/// </summary>
public int layout { get; set; }
/// <summary>
///
/// </summary>
public int id { get; set; }
}
/// <summary>
/// 标题组件
/// </summary>
......
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using Mall.Model.Extend.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic_Extend : Model.Entity.User.RB_Topic
{
/// <summary>
/// 专题名称
/// </summary>
public string TopicName { get; set; }
/// <summary>
/// 专题列表布局方式
/// </summary>
public string FlexTypeStr
{
get
{
string str = "";
if (this.FlexType > 0)
{
switch (Convert.ToInt32(this.FlexType))
{
case 1: str = "小图模式"; break;
case 2: str = "大图模式"; break;
case 3: str = "多图模式"; break;
}
}
return str;
}
}
/// <summary>
/// 是否精选字符串
/// </summary>
public string IsChoiceStr
{
get
{
string str = "";
if (this.IsChoice >= 0)
{
switch (Convert.ToInt32(this.IsChoice))
{
case 0: str = "否"; break;
case 1: str = "是"; break;
}
}
return str;
}
}
/// <summary>
/// 前端组件
/// </summary>
public List<ComponentItem> ComponentDataList { get; set; }
}
}
......@@ -101,6 +101,9 @@ namespace Mall.Module.MarketingCenter
case "nav": item.data = JsonHelper.DeserializeObject<navItem>(item.data.ToString()); break;
case "banner": item.data = JsonHelper.DeserializeObject<bannerItem>(item.data.ToString()); break;
case "notice": item.data = JsonHelper.DeserializeObject<noticeItem>(item.data.ToString()); break;
//专题
case "topic": item.data = JsonHelper.DeserializeObject<topicItem>(item.data.ToString()); break;
case "link": item.data = JsonHelper.DeserializeObject<linkItem>(item.data.ToString()); break;
case "rubik": item.data = JsonHelper.DeserializeObject<rubikItem>(item.data.ToString()); break;
case "video": item.data = JsonHelper.DeserializeObject<videoItem>(item.data.ToString()); break;
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Plugin;
using Mall.Model.Entity.User;
using Mall.Model.Extend.MarketingCenter;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.User;
......@@ -33,6 +35,11 @@ namespace Mall.Module.User
/// </summary>
private RB_ArticleRepository articleRepository = new RB_ArticleRepository();
/// <summary>
/// 专题仓储层对象
/// </summary>
private RB_TopicRepository topicRepository = new RB_TopicRepository();
#region 专题分类
/// <summary>
......@@ -129,6 +136,109 @@ namespace Mall.Module.User
}
#endregion
#region 专题
/// <summary>
/// 专题分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicPageListModule(int pageIndex, int pageSize, out long rowCount, RB_Topic_Extend query)
{
return topicRepository.GetTopicPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicListModule(RB_Topic_Extend query)
{
return topicRepository.GetTopicListRepository(query);
}
/// <summary>
/// 新增修改专题
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTopicModule(RB_Topic_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Extend.Title),extModel.Title.Trim()},
{ nameof(RB_Topic_Extend.FlexType),extModel.FlexType},
{ nameof(RB_Topic_Extend.CoverImg),extModel.CoverImg},
{ nameof(RB_Topic_Extend.Abstract),extModel.Abstract},
{ nameof(RB_Topic_Extend.CustomTitle),extModel.CustomTitle},
{ nameof(RB_Topic_Extend.CustomImg),extModel.CustomImg},
{ nameof(RB_Topic_Extend.IsChoice),extModel.IsChoice},
{ nameof(RB_Topic_Extend.TopicTypeId),extModel.TopicTypeId},
{ nameof(RB_Topic_Extend.ReadNum),extModel.ReadNum},
{ nameof(RB_Topic_Extend.SortNum),extModel.SortNum},
};
flag = topicRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Extend.Id), extModel.Id));
}
else
{
var newId = topicRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取专题实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Topic_Extend GetTopicModule(object Id)
{
var extModel= topicRepository.GetEntity<RB_Topic_Extend>(Id);
if (extModel.TemplateData != null && !string.IsNullOrEmpty(extModel.TemplateData))
{
extModel.ComponentDataList = JsonHelper.DeserializeObject<List<ComponentItem>>(extModel.TemplateData);
if (extModel.ComponentDataList != null && extModel.ComponentDataList.Count > 0)
{
foreach (var item in extModel.ComponentDataList)
{
switch (item.Id)
{
case "rubik": item.data = JsonHelper.DeserializeObject<rubikItem>(item.data.ToString()); break;
case "video": item.data = JsonHelper.DeserializeObject<videoItem>(item.data.ToString()); break;
case "image-text": item.data = JsonHelper.DeserializeObject<imagetextItem>(item.data.ToString()); break;
}
}
}
}
return extModel;
}
/// <summary>
/// 删除专题
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveTopicModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Extend.Status),1},
};
flag = topicRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Extend.Id), Id));
return flag;
}
#endregion
#region 门店
/// <summary>
......
......@@ -146,7 +146,6 @@ namespace Mall.Module.User
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Employee_Extend.EmpAccount),extModel.EmpAccount.Trim()},
{ nameof(RB_Employee_Extend.EmpPwd),extModel.EmpPwd},
{ nameof(RB_Employee_Extend.EmpName),extModel.EmpName},
{ nameof(RB_Employee_Extend.RoleAuth),extModel.RoleAuth},
};
......@@ -161,6 +160,22 @@ namespace Mall.Module.User
return flag;
}
/// <summary>
/// 修改员工密码
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetEmployeePwdModule(RB_Employee_Extend extModel)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Employee_Extend.EmpPwd),extModel.EmpPwd},
};
flag = employeeRepository.Update(fileds, new WhereHelper(nameof(RB_Employee_Extend.EmpId), extModel.EmpId));
return flag;
}
/// <summary>
/// 获取员工实体
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 专题表仓储层
/// </summary>
public class RB_TopicRepository : RepositoryBase<RB_Topic>
{
/// <summary>
/// 专题分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Topic_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.TopicName FROM RB_Topic AS A LEFT JOIN rb_topic_type AS B ON A.TopicTypeId=B.Id
WHERE 1=1 AND A.Status=0
");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.Id), query.Id);
}
if (query.Title != null && !string.IsNullOrEmpty(query.Title.Trim()))
{
builder.AppendFormat(" AND A.{0} LIKE '%{1}%' ", nameof(RB_Topic_Extend.Title), query.Title.Trim());
}
if (query.TopicTypeId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.TopicTypeId), query.TopicTypeId);
}
builder.Append(" ORDER BY A.SortNum ");
return GetPage<RB_Topic_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicListRepository(RB_Topic_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Topic WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.Id), query.Id);
}
if (query.Title != null && !string.IsNullOrEmpty(query.Title.Trim()))
{
builder.AppendFormat(" AND {0} LIKE '%{1}%' ", nameof(RB_Topic_Extend.Title), query.Title.Trim());
}
builder.Append(" ORDER BY SortNum ");
return Get<RB_Topic_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -154,10 +154,23 @@ namespace Mall.WebApi.Controllers.User
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
extModel.EmpPwd = Common.DES.Encrypt(extModel.EmpPwd, Common.Config.WebApiKey, Common.Config.WebApiIV);
var flag = module.SetEmployeeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改密码
/// </summary>
/// <returns></returns>
public ApiResult SetEmployeePwd()
{
var extModel = JsonConvert.DeserializeObject<RB_Employee_Extend>(RequestParm.msg.ToString());
extModel.EmpPwd = Common.DES.Encrypt(extModel.EmpPwd, Common.Config.WebApiKey, Common.Config.WebApiIV);
var flag = module.SetEmployeePwdModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取员工实体
/// </summary>
......
......@@ -115,6 +115,81 @@ namespace Mall.WebApi.Controllers.User
#endregion
#region 专题
/// <summary>
/// 专题分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicPageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicList()
{
var query = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改专题
/// </summary>
/// <returns></returns>
public ApiResult SetTopic()
{
var extModel = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
if (extModel.ComponentDataList != null && extModel.ComponentDataList.Count > 0)
{
extModel.TemplateData = JsonConvert.SerializeObject(extModel.ComponentDataList);
}
var flag = contentModule.SetTopicModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取专题实体
/// </summary>
/// <returns></returns>
public ApiResult GetTopic()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetTopicModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除专题
/// </summary>
/// <returns></returns>
public ApiResult RemoveTopic()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveTopicModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 门店
/// <summary>
......
......@@ -10,5 +10,6 @@
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>mall.oytour.com</NameOfLastUsedPublishProfile>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment