Commit 4637cf86 authored by liudong1993's avatar liudong1993
parents 455d0861 e6274c6f
...@@ -596,7 +596,7 @@ namespace Mall.Model.Extend.MarketingCenter ...@@ -596,7 +596,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// <summary> /// <summary>
/// 图片导航链接 /// 图片导航链接
/// </summary> /// </summary>
public rubikLinkItem link { get; set; } public List<rubikLinkItem> link { get; set; }
/// <summary> /// <summary>
/// 宽度 /// 宽度
...@@ -705,7 +705,7 @@ namespace Mall.Model.Extend.MarketingCenter ...@@ -705,7 +705,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// <summary> /// <summary>
/// 热区链接 /// 热区链接
/// </summary> /// </summary>
public rubikLinkItem link { get; set; } public List<rubikLinkItem> link { get; set; }
/// <summary> /// <summary>
/// 打开方式 /// 打开方式
......
...@@ -13,6 +13,25 @@ namespace Mall.Model.Entity.MarketingCenter ...@@ -13,6 +13,25 @@ namespace Mall.Model.Entity.MarketingCenter
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Template_Market_Extend : Model.Entity.MarketingCenter.RB_Template_Market public class RB_Template_Market_Extend : Model.Entity.MarketingCenter.RB_Template_Market
{ {
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateDateStr
{
get
{
string str = "";
if (this.CreateDate != null)
{
str = Convert.ToDateTime(this.CreateDate).ToString("yyyy-MM-dd HH:mm:ss");
}
return str;
}
}
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
} }
} }
\ No newline at end of file
using Mall.Model.Entity.MarketingCenter; using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Extend.MarketingCenter;
using Mall.Repository; using Mall.Repository;
using Mall.Repository.MarketingCenter; using Mall.Repository.MarketingCenter;
using System; using System;
...@@ -17,6 +18,11 @@ namespace Mall.Module.MarketingCenter ...@@ -17,6 +18,11 @@ namespace Mall.Module.MarketingCenter
/// </summary> /// </summary>
private readonly RB_Template_MarketRepository template_MarketRepository = new RB_Template_MarketRepository(); private readonly RB_Template_MarketRepository template_MarketRepository = new RB_Template_MarketRepository();
/// <summary>
/// 小程序模板
/// </summary>
private readonly RB_Miniprogram_TemplateRepository miniprogram_TemplateRepository = new RB_Miniprogram_TemplateRepository();
/// <summary> /// <summary>
/// 模板市场分页列表 /// 模板市场分页列表
/// </summary> /// </summary>
...@@ -131,5 +137,29 @@ namespace Mall.Module.MarketingCenter ...@@ -131,5 +137,29 @@ namespace Mall.Module.MarketingCenter
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id)); flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag; return flag;
} }
/// <summary>
/// 加载模板
/// </summary>
/// <param name="Id">模板市场编号</param>
/// <param name="extModel">返回的模板实体</param>
/// <returns></returns>
public bool LoadTemplateMarketIsUseModule(object Id, RB_Miniprogram_Template_Extend extModel)
{
var marketModel = GetTemplateMarketModule(Id);
if (marketModel != null && marketModel.Id > 0)
{
extModel.TemplateName = marketModel.Name;
List<ComponentItem> items = new List<ComponentItem>();
if (marketModel.TemplateData != null && !string.IsNullOrWhiteSpace(marketModel.TemplateData))
{
items= Common.Plugin.JsonHelper.DeserializeObject<List<ComponentItem>>(marketModel.TemplateData.Replace("\r\n","").Trim());
}
extModel.TemplateData = Common.Plugin.JsonHelper.Serialize(items);
}
var newId = miniprogram_TemplateRepository.Insert(extModel);
extModel.Id = newId;
return newId > 0;
}
} }
} }
...@@ -30,6 +30,14 @@ namespace Mall.Repository.MarketingCenter ...@@ -30,6 +30,14 @@ namespace Mall.Repository.MarketingCenter
{ {
builder.Append($" AND {nameof(RB_Template_Market_Extend.Name)} like '%{query.Name.Trim()}%'"); builder.Append($" AND {nameof(RB_Template_Market_Extend.Name)} like '%{query.Name.Trim()}%'");
} }
if (query.IsShow >= 0)
{
builder.AppendFormat(" AND {0}={1}", nameof(RB_Template_Market_Extend.IsShow),query.IsShow);
}
if (query.IsUse >= 0)
{
builder.AppendFormat(" AND {0}={1}", nameof(RB_Template_Market_Extend.IsUse), query.IsUse);
}
} }
return GetPage<RB_Template_Market_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList(); return GetPage<RB_Template_Market_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
} }
......
...@@ -12,6 +12,7 @@ using System.Collections.Generic; ...@@ -12,6 +12,7 @@ using System.Collections.Generic;
using Mall.Model.Extend.MarketingCenter; using Mall.Model.Extend.MarketingCenter;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Mall.Model.Entity.MarketingCenter; using Mall.Model.Entity.MarketingCenter;
using Mall.CacheManager.User;
namespace Mall.WebApi.Controllers.MarketingCenter namespace Mall.WebApi.Controllers.MarketingCenter
{ {
...@@ -249,6 +250,16 @@ namespace Mall.WebApi.Controllers.MarketingCenter ...@@ -249,6 +250,16 @@ namespace Mall.WebApi.Controllers.MarketingCenter
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Template_Market_Extend>(parms.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Template_Market_Extend>(parms.msg.ToString());
var list = templateMarketModule.GetTemplateMarketPageListModule(pagelist.pageIndex, pagelist.pageSize, out long count, query); var list = templateMarketModule.GetTemplateMarketPageListModule(pagelist.pageIndex, pagelist.pageSize, out long count, query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.Account ?? "";
}
}
}
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list; pagelist.pageData = list;
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
...@@ -299,7 +310,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter ...@@ -299,7 +310,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
/// 删除模板市场 /// 删除模板市场
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ApiResult RemoveTemplateMarketModule() public ApiResult RemoveTemplateMarket()
{ {
JObject parms = JObject.Parse(RequestParm.msg.ToString()); JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0); var Id = parms.GetInt("Id", 0);
...@@ -332,6 +343,29 @@ namespace Mall.WebApi.Controllers.MarketingCenter ...@@ -332,6 +343,29 @@ namespace Mall.WebApi.Controllers.MarketingCenter
var flag = templateMarketModule.UpdateTemplateMarketIsUseModule(Id, IsUse); var flag = templateMarketModule.UpdateTemplateMarketIsUseModule(Id, IsUse);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 加载模板
/// </summary>
/// <returns></returns>
public ApiResult LoadTemplateMarket()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
Int32.TryParse(RequestParm.uid, out int Uid);
var extModel = new RB_Miniprogram_Template_Extend()
{
Id = 0,
ComponentDataList = new List<ComponentItem>(),
CreateBy = Uid,
TenantId = RequestParm.TenantId,
MallBaseId = RequestParm.MallBaseId,
CreateDate = DateTime.Now,
Status = 0
};
var flag = templateMarketModule.LoadTemplateMarketIsUseModule(Id, extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
#endregion #endregion
} }
} }
\ 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