Commit 821dd112 authored by 黄奎's avatar 黄奎

代码优化

parent 386643f5
......@@ -20,15 +20,15 @@ namespace Mall.Module.MarketingCenter
{
public class CouponModule
{
private RB_CouponRepository couponRepository = new RB_CouponRepository();
private RB_DiscountCouponRepository discountCouponRepository = new RB_DiscountCouponRepository();
private RB_DiscountCoupon_ProductRepository productRepository = new RB_DiscountCoupon_ProductRepository();
private readonly RB_CouponRepository couponRepository = new RB_CouponRepository();
private readonly RB_DiscountCouponRepository discountCouponRepository = new RB_DiscountCouponRepository();
private readonly RB_DiscountCoupon_ProductRepository productRepository = new RB_DiscountCoupon_ProductRepository();
private Repository.User.RB_Member_CouponRepository memberCouponRepository = new Repository.User.RB_Member_CouponRepository();
private RB_Coupon_SelfMotionMemberRepository selfMotionMemberRepository = new RB_Coupon_SelfMotionMemberRepository();
private readonly RB_Member_CouponRepository memberCouponRepository = new Repository.User.RB_Member_CouponRepository();
private readonly RB_Coupon_SelfMotionMemberRepository selfMotionMemberRepository = new RB_Coupon_SelfMotionMemberRepository();
private RB_Coupon_SelfMotionRepository selfMotionRepository = new RB_Coupon_SelfMotionRepository();
private readonly RB_Coupon_SelfMotionRepository selfMotionRepository = new RB_Coupon_SelfMotionRepository();
/// <summary>
/// 会员信息
......@@ -262,8 +262,8 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool DelDiscountCoupon(int id, int uid, int mallBaseId)
{
bool flag = false;
var trans = discountCouponRepository.DbTransaction;
bool flag;
try
{
Dictionary<string, object> cols1 = new Dictionary<string, object>()
......@@ -338,8 +338,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool DelMemberCoupon(int id, int uid, int mallBaseId)
{
bool flag = false;
bool flag;
try
{
Dictionary<string, object> cols1 = new Dictionary<string, object>()
......@@ -431,20 +430,14 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool GrantCoupon(List<RB_Member_DiscountCoupon_Extend> list, RB_DiscountCoupon_Extend model)
{
bool flag = false;
var trans = memberCouponRepository.DbTransaction;
bool flag;
try
{
//foreach (var item in list)
//{
flag = memberCouponRepository.InsertBatch(list, trans);
// }
if (model != null && flag)
{
Dictionary<string, object> cols1;
if (model.TotalNum != -1)
{
cols1 = new Dictionary<string, object>()
......@@ -665,8 +658,8 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool DelDiscountSelfMotion(int id, int uid, int mallBaseId)
{
bool flag = false;
var trans = selfMotionRepository.DbTransaction;
bool flag;
try
{
Dictionary<string, object> cols1 = new Dictionary<string, object>()
......
......@@ -12,9 +12,10 @@ namespace Mall.Module.MarketingCenter
{
public class IntegralModule
{
private RB_Integral_SettingsRepository settingsRepository = new RB_Integral_SettingsRepository();
private readonly RB_Integral_SettingsRepository settingsRepository = new RB_Integral_SettingsRepository();
private readonly RB_Member_IntegralRepository recordRepository = new RB_Member_IntegralRepository();
private RB_Member_IntegralRepository recordRepository = new RB_Member_IntegralRepository();
#region 积分设置
/// <summary>
......@@ -46,8 +47,6 @@ namespace Mall.Module.MarketingCenter
}
#endregion
#region 积分记录
/// <summary>
......
......@@ -103,7 +103,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetMiniprogramPageTemplModule(RB_Miniprogram_Page_Templ_Extend extModel)
{
bool flag = false;
bool flag;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -147,12 +147,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetMiniprogramPageTemplIsUseModule(object Id, int IsUse)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Miniprogram_Page_Templ_Extend.IsUse),IsUse }
};
flag = pageRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Page_Templ_Extend.Id), Id));
bool flag = pageRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Page_Templ_Extend.Id), Id));
return flag;
}
......@@ -165,8 +164,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetMiniprogramPageTemplIsHomeModule(object Id, int IsHome,int MallBaseId)
{
bool flag = false;
flag = pageRepository.UpdateIsHomeRepository(MallBaseId);
bool flag = pageRepository.UpdateIsHomeRepository(MallBaseId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Miniprogram_Page_Templ_Extend.IsHome),IsHome }
......@@ -183,12 +181,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveMiniprogramPageTemplModule(object Id, int Status)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Miniprogram_Page_Templ_Extend.Status),Status }
};
flag = pageRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Page_Templ_Extend.Id), Id));
bool flag = pageRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Page_Templ_Extend.Id), Id));
return flag;
}
......@@ -199,8 +196,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveMiniprogramPageTemplDetailsModule(object Id)
{
bool flag = false;
flag = detailsRepository.Delete(Id)>0;
bool flag = detailsRepository.Delete(Id) > 0;
return flag;
}
}
......
......@@ -77,7 +77,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetMiniprogramTemplateModule(RB_Miniprogram_Template_Extend extModel)
{
bool flag = false;
bool flag;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -389,12 +389,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveMiniprogramTemplateModule(object Id, int Status)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Miniprogram_Template_Extend.Status),Status }
};
flag = miniprogram_TemplateRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Template_Extend.Id), Id));
bool flag = miniprogram_TemplateRepository.Update(fileds, new WhereHelper(nameof(RB_Miniprogram_Template_Extend.Id), Id));
return flag;
}
}
......
......@@ -170,7 +170,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareCategoryModule(RB_Share_Category_Extend extModel)
{
bool flag = false;
bool flag;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -199,12 +199,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveShareCategoryModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Category_Extend.Status),(int) DateStateEnum.Delete},
};
flag = share_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Category_Extend.Id), Id));
bool flag = share_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Category_Extend.Id), Id));
return flag;
}
......@@ -237,8 +236,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareFriendModule(RB_Share_Friend_Extend extModel)
{
bool flag = false;
flag = share_FriendRepository.SetShareFrendRepository(extModel);
bool flag = share_FriendRepository.SetShareFrendRepository(extModel);
return flag;
}
......@@ -272,12 +270,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveShareFriendModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.Status),(int) DateStateEnum.Delete},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
bool flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
......@@ -289,12 +286,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareFriendIsTopModule(object Id, int IsTop)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.IsTop),IsTop},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
bool flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
......@@ -306,12 +302,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareFriendIsUseModule(object Id, int IsUse)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.IsUse),IsUse},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
bool flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
......@@ -323,12 +318,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareFriendSortNumModule(object Id, int SortNum)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.SortNum),SortNum},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
bool flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
......@@ -340,12 +334,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetShareFriendMaterialInfoModule(object Id, string MaterialInfo)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Share_Friend_Extend.MaterialInfo),MaterialInfo},
};
flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
bool flag = share_FriendRepository.Update(fileds, new WhereHelper(nameof(RB_Share_Friend_Extend.Id), Id));
return flag;
}
......
......@@ -13,7 +13,7 @@ namespace Mall.Module.MarketingCenter
{
public class StatisticsModule
{
private RB_Goods_OrderRepository orderRepository = new RB_Goods_OrderRepository();
private readonly RB_Goods_OrderRepository orderRepository = new RB_Goods_OrderRepository();
/// <summary>
/// 返佣
/// </summary>
......@@ -294,12 +294,14 @@ namespace Mall.Module.MarketingCenter
{
for (int i = 1; i < 24; i++)
{
OrderLine modelOrderLine = new OrderLine();
modelOrderLine.OrderPay = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Count();
modelOrderLine.PayMoney = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.Income ?? 0);
modelOrderLine.PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).GroupBy(x => x.UserId).Count();
modelOrderLine.BuyNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.GoodsTotalNum);
modelOrderLine.DateStr = (i > 9) ? ("0" + i) : i.ToString();
OrderLine modelOrderLine = new OrderLine
{
OrderPay = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Count(),
PayMoney = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.Income ?? 0),
PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).GroupBy(x => x.UserId).Count(),
BuyNum = List.Where(x => x.CreateDate.Value.ToString("dd") == ((i > 9) ? ("0" + i) : i.ToString())).Sum(x => x.GoodsTotalNum),
DateStr = (i > 9) ? ("0" + i) : i.ToString()
};
model.OrderLineList.Add(modelOrderLine);
}
}
......@@ -307,12 +309,14 @@ namespace Mall.Module.MarketingCenter
{
for (int i = 0; i < 7; i++)
{
OrderLine modelOrderLine = new OrderLine();
modelOrderLine.OrderPay = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Count();
modelOrderLine.PayMoney = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.Income ?? 0);
modelOrderLine.PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).GroupBy(x => x.UserId).Count();
modelOrderLine.BuyNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.GoodsTotalNum);
modelOrderLine.DateStr = System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd");
OrderLine modelOrderLine = new OrderLine
{
OrderPay = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Count(),
PayMoney = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.Income ?? 0),
PayMemerNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).GroupBy(x => x.UserId).Count(),
BuyNum = List.Where(x => x.CreateDate.Value.ToString("yyyy-MM-dd") == System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")).Sum(x => x.GoodsTotalNum),
DateStr = System.DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")
};
model.OrderLineList.Add(modelOrderLine);
}
}
......
......@@ -55,7 +55,7 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool SetTemplateMarketModule(RB_Template_Market_Extend extModel)
{
bool flag = false;
bool flag;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -96,12 +96,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool RemoveTemplateMarketModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.Status),1 },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
bool flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
......@@ -113,12 +112,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool UpdateTemplateMarketIsShowModule(object Id,int IsShow)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.IsShow),IsShow },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
bool flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
......@@ -130,12 +128,11 @@ namespace Mall.Module.MarketingCenter
/// <returns></returns>
public bool UpdateTemplateMarketIsUseModule(object Id, int IsUse)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Template_Market_Extend.IsUse),IsUse },
};
flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
bool flag = template_MarketRepository.Update(fileds, new WhereHelper(nameof(RB_Template_Market_Extend.Id), Id));
return flag;
}
......
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