Commit e0ff19cc authored by liudong1993's avatar liudong1993
parents 78988958 08bb5eae
......@@ -161,7 +161,7 @@ namespace Mall.Common
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
private static string ReadConfigKey(string key)
public static string ReadConfigKey(string key)
{
try
{
......
......@@ -223,5 +223,10 @@ namespace Mall.Model.Entity.Product
/// 赠送粉象等级期限(月)
/// </summary>
public int? PresentFXMonth { get; set; }
/// <summary>
/// 分类包邮规则备注
/// </summary>
public string FreeShippingRemarks { get; set; }
}
}
using VT.FW.DB;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品订单明细表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderDetailFreeShipping
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 订单商品id
/// </summary>
public int? OrderDetailId
{
get;
set;
}
/// <summary>
/// 单品满件包邮
/// </summary>
public int? FullNumPinkage
{
get;
set;
}
/// <summary>
/// 单品满额包邮
/// </summary>
public decimal? FullMoneyPinkage
{
get;
set;
}
/// <summary>
/// 包邮规则名称
/// </summary>
public string Name { get; set; }
public int Status { get; set; }
/// <summary>
/// 包邮规则对应的分类
/// </summary>
public int? Category { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
}
}
......@@ -333,18 +333,18 @@ namespace Mall.Module.Product
{
var nowcategory = categoryList.Where(x => x.GoodsId == item.GoodsId).Select(x => x.CategoryId);
var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
item.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
......@@ -690,7 +690,8 @@ namespace Mall.Module.Product
x.Number,
x.Final_Price,
x.IsComment,
x.IsApplyForAfterSale
x.IsApplyForAfterSale,
x.FreeShippingRemarks
}),
model.IsApplyForCancel,
model.RejectRemark,
......@@ -8021,7 +8022,8 @@ namespace Mall.Module.Product
x.Number,
x.Original_Price,
x.Final_Price,
x.IsBindExpress
x.IsBindExpress,
x.FreeShippingRemarks
})
});
}
......
......@@ -1059,18 +1059,18 @@ namespace Mall.Module.Product
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = model.MallBaseId, TenantId = model.TenantId, CategoryIds = categoryIds });
if (freeShippingList != null && freeShippingList.Any())
{
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x=>x.ID).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).ThenByDescending(x => x.ID).FirstOrDefault();
}
model.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
......
using Mall.Model.Entity.Product;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.Product
{
public class RB_Goods_OrderDetailFreeShippingRepository : BaseRepository<RB_Goods_OrderDetailFreeShipping>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Goods_OrderDetailFreeShipping); } }
/// <summary>
/// 物料规则列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Goods_OrderDetailFreeShipping> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Goods_OrderDetailFreeShipping query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Goods_OrderDetailFreeShipping.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.MallBaseId)}={query.MallBaseId}");
}
if (query.OrderDetailId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.OrderDetailId)}={query.OrderDetailId}");
}
}
return GetPage<RB_Goods_OrderDetailFreeShipping>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 物流规则列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Goods_OrderDetailFreeShipping> GetLogisticsRulesList(RB_Goods_OrderDetailFreeShipping query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Goods_OrderDetailFreeShipping.Status)}=0 ");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.MallBaseId)}={query.MallBaseId}");
}
if (query.OrderDetailId > 0)
{
builder.Append($" AND {nameof(RB_Goods_OrderDetailFreeShipping.OrderDetailId)}={query.OrderDetailId}");
}
}
return Get<RB_Goods_OrderDetailFreeShipping>(builder.ToString()).ToList();
}
}
}
......@@ -8,7 +8,6 @@
<PackageReference Include="Aliyun.Net.SDK.Core" Version="1.0.3" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RabbitMQ.Client" Version="6.0.0" />
<PackageReference Include="Tencent.QCloud.Cos.Sdk" Version="5.4.10" />
</ItemGroup>
......
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Dysmsapi.Model.V20170525;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Mall.ThirdCore.Commom;
using System;
using System.Threading;
using Mall.ThirdCore.Message;
namespace Mall.ThirdCore.Mq
{
/// <summary>
/// 消息队列配置文件
/// </summary>
public class RabbitConfig
{
/// <summary>
/// 主机名:ip地址
/// </summary>
public string HostName { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 队列名称
/// </summary>
public string QueenName { get; set; }
}
}
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.ThirdCore.Mq
{
/// <summary>
/// 消息队列帮助类
/// </summary>
public class RabbitMQService
{
/// <summary>
/// 获取连接
/// </summary>
/// <param name="rabbitConfig">连接配置实体</param>
/// <returns></returns>
public static ConnectionFactory GetConnectionFactory(RabbitConfig rabbitConfig)
{
ConnectionFactory factory = new ConnectionFactory
{
HostName = rabbitConfig.HostName,
//默认端口
Port = rabbitConfig.Port,
UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password
};
return factory;
}
/// <summary>
/// 发送信息
/// </summary>
/// <param name="rabbitConfig"></param>
/// <param name="message"></param>
public static void SendMessage(RabbitConfig rabbitConfig, string message)
{
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
{
using (IModel channel = conn.CreateModel())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(message);
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Mall.WebApi.Controllers.CAP
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class TestController : BaseController
{
private readonly DotNetCore.CAP.ICapPublisher _capBus;
public TestController(DotNetCore.CAP.ICapPublisher capPublisher)
{
this._capBus = capPublisher;
}
[HttpPost]
[AllowAnonymous]
public ApiResult Get()
{
ApiResult apiResult = new ApiResult()
{
message = "操作成功",
resultCode = 1,
data = DateTime.Now
};
_capBus.Publish("show.time", Common.Plugin.JsonHelper.Serialize(apiResult));
return apiResult;
}
[NonAction]
[AllowAnonymous]
[DotNetCore.CAP.CapSubscribe("show.time")]
public void CheckReceiveMessage(string result)
{
string str = "";
Console.WriteLine(result);
}
}
}
\ No newline at end of file
......@@ -996,7 +996,8 @@ namespace Mall.WebApi.Controllers.MallBase
x.FullMoneyPinkage,
x.FullNumPinkage,
x.CategoryList,
x.IsEnable
x.IsEnable,
x.Name
});
return ApiResult.Success("", pagelist);
}
......
......@@ -236,7 +236,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.ProductCode,
y.Final_Price,
y.Number,
y.IsComment
y.IsComment,
y.FreeShippingRemarks
}),
x.OrderStatus,
OrderStatusName = x.OrderStatus.GetEnumName(),
......
......@@ -93,7 +93,8 @@ namespace Mall.WebApi.Controllers.MallBase
y.ProductCode,
y.Final_Price,
y.Number,
y.IsBindExpress
y.IsBindExpress,
y.FreeShippingRemarks
}),
x.Consignee,
x.Mobile,
......
......@@ -1403,7 +1403,7 @@ namespace Mall.WebApi.Controllers.User
var SupplierList = supplierModule.GetList(new RB_Supplier_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, Introducer = userInfo.UserId });//我的供应商
var obj = SupplierList.Select(x => new { x.Name, x.Mobile, SupplierCommissionList = x.SupplierCommissionList.Select(y => new { y.CommissionRate, y.CommissionType }) });
var obj = SupplierList.Select(x => new { x.ID,x.Name, x.Mobile, SupplierCommissionList = x.SupplierCommissionList.Select(y => new { y.CommissionRate, y.CommissionType }) });
return ApiResult.Success("", obj);
}
......
......@@ -9,6 +9,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP" Version="3.0.0" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.0.0" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.0.0" />
<PackageReference Include="JWT" Version="5.3.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
......
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading.Tasks;
using DotNetCore.CAP.Messages;
using Mall.ThirdCore.Message;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Builder;
......@@ -56,12 +57,35 @@ namespace Mall.WebApi
"http://yx.oytour.com",
"http://mall.oytour.com",
"http://testmall.oytour.com",
"http://yx.oytour.com",
};
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
services.AddCap(x =>
{
x.UseMySql(config =>
{
config.ConnectionString = "server=192.168.2.214;user id=reborn;password=Reborn@2018;database=cap;CharSet=utf8; Convert Zero Datetime=true;";
});
x.UseRabbitMQ(cfg =>
{
cfg.HostName = "47.96.25.130";
cfg.VirtualHost = "/";
cfg.Port = Convert.ToInt32(5672);
cfg.UserName = "guest";
cfg.Password = "viitto2019";
});
//失败后的重试次数,默认50次;在FailedRetryInterval默认60秒的情况下,即默认重试50*60秒(50分钟)之后放弃失败重试
x.FailedRetryCount = 10;
//失败后的重拾间隔,默认60秒
x.FailedRetryInterval = 10;
//设置成功信息的删除时间默认24*3600秒
x.SucceedMessageExpiredAfter = 3600;
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime appLifetime)
{
......@@ -78,12 +102,12 @@ namespace Mall.WebApi
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
System.WebHttpContext.HttpContext.Configure(app.ApplicationServices.GetRequiredService<Microsoft.AspNetCore.Http.IHttpContextAccessor>());
//启动信息发送
Task.Run(() => MessageCore.Init());
......
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