Commit c0e7a328 authored by liudong1993's avatar liudong1993

订单取消定时器

parent 998561c8
......@@ -1607,8 +1607,10 @@ namespace Mall.Module.Product
}
price_member_max = Math.Round(price_member_max, 2, MidpointRounding.AwayFromZero);
price_member_min = Math.Round(price_member_min, 2, MidpointRounding.AwayFromZero);
price_min = Math.Round(price_min, 2, MidpointRounding.AwayFromZero);
price_max = Math.Round(price_max, 2, MidpointRounding.AwayFromZero);
//price_min = Math.Round(price_min, 2, MidpointRounding.AwayFromZero);
//price_max = Math.Round(price_max, 2, MidpointRounding.AwayFromZero);//先使用会员的
price_min = price_member_min;
price_max = price_member_max;
#endregion
#region 订单信息
......
......@@ -123,8 +123,14 @@ namespace Mall.Module.User
/// 财务单据规则
/// </summary>
private static RB_Finance_ConfigurineRepository financeConfigurineRepository = new RB_Finance_ConfigurineRepository();
private Repository.User.RB_Member_CouponRepository memberCouponRepository = new Repository.User.RB_Member_CouponRepository();
/// <summary>
/// 用户优惠券
/// </summary>
private RB_Member_CouponRepository memberCouponRepository = new RB_Member_CouponRepository();
/// <summary>
/// 分销海报仓储层对象
/// </summary>
private RB_MiniProgram_FenXiaoPosterRepository fenXiaoPosterRepository = new RB_MiniProgram_FenXiaoPosterRepository();
#region 基础配置
......@@ -4143,6 +4149,20 @@ namespace Mall.Module.User
#endregion
#region 获取分销海报
/// <summary>
/// 根据查询条件获取分销海报实体
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public RB_MiniProgram_FenXiaoPoster_Extend GetFenXiaoPosterEntityModule(RB_MiniProgram_FenXiaoPoster_Extend query)
{
return fenXiaoPosterRepository.GetEntityExtRepository(query);
}
#endregion
#region 获取小程序码
/// <summary>
......
......@@ -19,6 +19,7 @@ namespace Mall.Repository.BaseSetUp
/// 表名称
/// </summary>
public string MinTableName { get { return nameof(RB_MiniProgram); } }
/// <summary>
/// 获取小程序列表
/// </summary>
......
......@@ -889,5 +889,21 @@ GROUP BY od.GoodsId,o.OrderId
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
#endregion
#region
/// <summary>
/// 获取超时取消的订单列表
/// </summary>
/// <param name="cancelTime"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime,int t,int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
#endregion
}
}
......@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.GoodsStatus = 1;//只查询销售中的
var list = productModule.GetAppletGoodsPageListForZY(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<object> RList = new List<object>();
int UserId = demodel.UserId ?? 0;
int UserId = parms.UserId;
RB_Member_User_Extend userModel = new RB_Member_User_Extend();
RB_Member_Grade_Extend memberGrade = new RB_Member_Grade_Extend();
if (UserId > 0)
......
......@@ -1027,6 +1027,24 @@ namespace Mall.WebApi.Controllers.User
#endregion
#region 获取分销海报
/// <summary>
/// 获取分销海报
/// </summary>
/// <returns></returns>
public ApiResult GetFenXiaoPoster()
{
var userInfo = AppletUserInfo;
var extModel = JsonConvert.DeserializeObject<RB_MiniProgram_FenXiaoPoster_Extend>(RequestParm.msg.ToString());
extModel.TenantId = userInfo.TenantId;
extModel.MallBaseId = userInfo.MallBaseId;
var result = userModule.GetFenXiaoPosterEntityModule(extModel);
return ApiResult.Success(data: result);
}
#endregion
#region 个人中心余额/积分/优惠券气泡
/// <summary>
/// 个人中心- 积分明细
......
......@@ -28,5 +28,20 @@ namespace Mall.WindowsService.Helper
Interlocked.Exchange(ref inTimer, 0);
}
}
/// <summary>
/// 自动取消订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AutoCancelOrder(object sender, System.Timers.ElapsedEventArgs e) {
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
LogHelper.Write("AutoCancelOrder=====Start");
Module.FinanceModule.AutoCancelOrder();
LogHelper.Write("AutoCancelOrder=====End");
Interlocked.Exchange(ref inTimer, 0);
}
}
}
}
......@@ -11,11 +11,6 @@
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
......
This diff is collapsed.
......@@ -12,6 +12,7 @@ namespace Mall.WindowsService
partial class WindowsService : ServiceBase
{
System.Timers.Timer timer1; //计时器
private System.Timers.Timer timer2; //订单取消计时器
public WindowsService()
{
......@@ -27,6 +28,17 @@ namespace Mall.WindowsService
timer1.Interval = 1000 * (60 * 60); //60分钟
timer1.Elapsed += new System.Timers.ElapsedEventHandler(helper.RevenueFinance);
timer1.Enabled = true;
#region 订单取消定时器
timer2 = new System.Timers.Timer
{
Interval = 1000 * (60 * 10) //10分钟处理一次
};
timer2.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoCancelOrder);
timer2.Enabled = true;
#endregion
}
protected override void OnStop()
......@@ -34,6 +46,7 @@ namespace Mall.WindowsService
// TODO: 在此处添加代码以执行停止服务所需的关闭操作。
Helper.LogHelper.Write("主服务停止运行......");
this.timer1.Enabled = false;
this.timer2.Enabled = false;
}
}
}
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