Commit 238cdb17 authored by liudong1993's avatar liudong1993
parents b8e4fecd 894fe17b
......@@ -88,5 +88,12 @@ namespace Mall.Model.Extend.User
public string OpenId { get; set; }
/// <summary>
/// 查询过期的vip购买记录 0-不查询,1-查询
/// </summary>
public int IsSelectOverTime { get; set; }
}
}
......@@ -27,5 +27,8 @@ namespace Mall.Model.Extend.User
/// 返佣列表
/// </summary>
public List<RB_VipBuy_Commission_Extend> CommissionList { get; set; }
}
}
......@@ -66,7 +66,7 @@ namespace Mall.Module.User
/// </summary>
private readonly RB_Distributor_FXCommissionRepository distributor_FXCommissionRepository = new RB_Distributor_FXCommissionRepository();
/// <summary>
/// 粉象发脓等级
/// 粉象返佣等级
/// </summary>
private readonly RB_Distributor_FXGradeRepository distributor_FXGradeRepository = new RB_Distributor_FXGradeRepository();
......
......@@ -24,26 +24,32 @@ namespace Mall.Repository.User
public List<RB_Distributor_Info_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Distributor_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_Distributor_Info.Status)}=0";
if (dmodel.TenantId > 0) {
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0) {
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (dmodel.GradeId >= 0) {
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_Distributor_Info.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.Source > 0) {
if (dmodel.Source > 0)
{
where += $@" and u.{nameof(RB_Member_User.Source)}={(int)dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.NickName))
......@@ -54,7 +60,8 @@ namespace Mall.Repository.User
{
where += $@" and di.{nameof(RB_Distributor_Info.Mobile)} like '%{dmodel.Mobile}%'";
}
if (dmodel.SuperiorId > 0) {
if (dmodel.SuperiorId > 0)
{
where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
......@@ -88,7 +95,8 @@ where {where} order by di.CreateDate desc";
{
where += $@" and di.{nameof(RB_Distributor_Info.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds)) {
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and di.{nameof(RB_Distributor_Info.UserId)} in({dmodel.UserIds})";
}
if (dmodel.GradeId >= 0)
......@@ -239,5 +247,52 @@ inner join rb_member_user u on di.UserId=u.Id
where {where} order by di.CreateDate desc";
return Get<RB_Distributor_Info_Extend>(sql).ToList();
}
/// <summary>
/// 获取过期的vip列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Distributor_Info_Extend> GetOverTimeVipList(RB_Distributor_Info_Extend dmodel)
{
string where = $@" 1=1 and di.{nameof(RB_Distributor_Info.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.UserId)}={dmodel.UserId}";
}
if (dmodel.AuditStatus > 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.AuditStatus)}={(int)dmodel.AuditStatus}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and di.{nameof(RB_Distributor_Info.UserId)} in({dmodel.UserIds})";
}
if (dmodel.GradeId >= 0)
{
where += $@" and di.{nameof(RB_Distributor_Info.GradeId)}={dmodel.GradeId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and di.{nameof(RB_Distributor_Info.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.IsSelectOverTime > 0)
{
where += $@" and DATE_FORMAT( di.{nameof(RB_Distributor_Info.VipExpiryDate)},'%y-%m-%d')=DATE_FORMAT( {DateTime.Now.AddDays(-1)},'%y-%m-%d')";
}
string sql = $@"select di.* from RB_Distributor_Info di where {where} order by di.CreateDate desc";
return Get<RB_Distributor_Info_Extend>(sql).ToList();
}
}
}
......@@ -47,6 +47,7 @@ namespace Mall.Repository.User
{
builder.Append($" AND a.{nameof(RB_Vip_Buy_Extend.PayState)}={query.PayState}");
}
}
return GetPage<RB_Vip_Buy_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
......
......@@ -1912,7 +1912,7 @@ namespace Mall.WebApi.Controllers
one_share = new { name = distributorCustom?.OneDistributionName, defaultStr = "一级分销名称" },
second_share = new { name = distributorCustom?.TwoDistributionName, defaultStr = "二级分销名称" },
three_share = new { name = distributorCustom?.ThreeDistributionName, defaultStr = "三级分销名称" },
isshowvipbuypic = new { name = distributorCustom?.IsShowVIPBuyPic, defaultStr = "0" },
isshowvipbuypic = distributorCustom?.IsShowVIPBuyPic,
vipbuyico = distributorCustom?.VipBuyICO,
vipbuyurl = distributorCustom?.VipBuyUrl,
},
......
......@@ -1118,7 +1118,10 @@ namespace Mall.WebApi.Controllers.User
model.OneDistributionName,
model.TwoDistributionName,
model.ThreeDistributionName,
UpdateDate = model.UpdateDate.HasValue ? model.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
UpdateDate = model.UpdateDate.HasValue ? model.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
model.VipBuyICO,
model.VipBuyUrl,
model.IsShowVIPBuyPic
});
}
......
......@@ -6,6 +6,7 @@ using Mall.Common.Enum.User;
using Mall.Common.Plugin;
using Mall.Model.Entity.Finance;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.User;
using Mall.Model.Extend.Finance;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
......@@ -104,6 +105,12 @@ namespace Mall.WindowsService.Module
private static RB_Vip_BuyRepository vip_BuyRepository = new RB_Vip_BuyRepository();
/// <summary>
/// vip购买仓储层
/// </summary>
private static readonly RB_Vip_BuyRepository vipBuyRepository = new RB_Vip_BuyRepository();
#region 收入
/// <summary>
......@@ -1531,5 +1538,63 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
#endregion
#region 分享商VIP过期
/// <summary>
/// 分享商VIP过期
/// </summary>
/// <returns></returns>
public static bool DistributorVipModule()
{
var flag = false;
try
{
var financeConfigurineList = distributor_InfoRepository.GetOverTimeVipList(new RB_Distributor_Info_Extend { IsSelectOverTime = 1, AuditStatus = DistributorAuditStatusEnum.Audited });
var mallList = financeConfigurineList.GroupBy(x => new { x.TenantId, x.MallBaseId });
foreach (var item in mallList)
{
var fxGradeModel = distributor_FXGradeRepository.GetList(new RB_Distributor_FXGrade_Extend { TenantId = item.Key.TenantId, MallBaseId = item.Key.MallBaseId, IsGuest = 1 }).FirstOrDefault();
var list = financeConfigurineList.Where(x => x.MallBaseId == item.Key.MallBaseId & x.TenantId == item.Key.TenantId & x.FXGradeId != fxGradeModel.Id);
if (list != null && list.Any())
{
foreach (var itemDistributor in list)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
keyValues.Add(nameof(RB_Distributor_Info.FXGradeId), fxGradeModel.Id);
keyValues.Add(nameof(RB_Goods_Order_Extend.CancelTime), DateTime.Now);
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.OrderId),
FiledValue=itemDistributor.Id,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.TenantId),
FiledValue=itemDistributor.TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.MallBaseId),
FiledValue=itemDistributor.MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
flag = goods_OrderRepository.Update(keyValues, wheres);
}
}
}
}
catch (Exception ex)
{
Helper.LogHelper.Write(ex.Message);
}
return flag;
}
#endregion
}
}
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