Commit d3732b86 authored by 吴春's avatar 吴春

提交代码

parent 2d131a62
......@@ -21,6 +21,16 @@ namespace Mall.Common.API
/// </summary>
public string message { get; set; }
/// <summary>
/// 优惠券领取状态码
/// </summary>
public int couponResultCode { get; set; }
/// <summary>
///优惠券领取 提示信息
/// </summary>
public string couponMessage { get; set; }
/// <summary>
/// 返回数据
/// </summary>
......@@ -49,6 +59,30 @@ namespace Mall.Common.API
return new ApiResult { resultCode = (int)ResultCode.Fail, message = message ?? "操作失败!", data = data };
}
/// <summary>
/// 优惠券领取请求成功
/// </summary>
/// <param name="message">提示信息</param>
/// <param name="data">返回数据</param>
/// <returns></returns>
public static ApiResult CouponSuccess(ResultCode couponResultCode = ResultCode.Success, string message = null, string couponMessage = null, object data = null)
{
return new ApiResult() { resultCode = (int)ResultCode.Success, message = message ?? "操作成功!", couponResultCode = (int)couponResultCode, couponMessage = couponMessage ?? "优惠券领取成功!", data = data };
}
/// <summary>
/// 优惠券领取请求失败
/// </summary>
/// <param name="message">提示信息</param>
/// <param name="data">返回数据</param>
/// <returns></returns>
public static ApiResult CouponFailed(ResultCode couponResultCode = ResultCode.Success, string message = null, string couponMessage = null, object data = null)
{
return new ApiResult { resultCode = (int)ResultCode.Fail, message = message ?? "操作失败!", couponResultCode = (int)couponResultCode, couponMessage = couponMessage ?? "优惠券领取成功!", data = data };
}
/// <summary>
/// 服务器返回提示信息,询问用户是否确认操作(事例:已经存在此领队/导游的档期数据,是否继续保存数据?)
/// </summary>
......
......@@ -77,5 +77,22 @@ namespace Mall.Model.Extend.Product
/// 商品分类包邮规则
/// </summary>
public RB_FreeShipping_Extend FreeShippingModel { get; set; }
/// <summary>
/// 单品满件包邮
/// </summary>
public int? FullNumPinkage
{
get;
set;
}
/// <summary>
/// 单品满额包邮
/// </summary>
public decimal? FullMoneyPinkage
{
get;
set;
}
}
}
......@@ -885,14 +885,14 @@ namespace Mall.Module.MarketingCenter
/// <param name="userId"></param>
/// <param name="getType">1-分享,2-购买并付款,3-新人领券</param>
/// <returns></returns>
public bool AutoCoupon(RB_DiscountCoupon_Extend model)
public RB_DiscountCoupon_Extend AutoCoupon(RB_DiscountCoupon_Extend model)
{
RB_DiscountCoupon_Extend resultModel = new RB_DiscountCoupon_Extend();
//先查找会员是否存在
var memberUserModel = member_UserRepository.GetEntity(model.UserId);
if (memberUserModel == null)
{
return false;
return resultModel;
}
//根据发放类型获取对应的优惠券信息
var couponList = discountCouponRepository.GetSelfmotionCouponList(model);
......@@ -916,7 +916,7 @@ namespace Mall.Module.MarketingCenter
MallBaseId = item.MallBaseId,
Status = 0,
CreateDate = System.DateTime.Now,
UserId = item.UserId,
UserId = model.UserId,
Description = item.TriggerType == 1 ? "分享自动发放优惠券" : (item.TriggerType == 2 ? "购买并付款自动发放优惠券" : "新人领劵自动发放优惠券"),
Remarks = item.TriggerType == 1 ? "分享" : (item.TriggerType == 2 ? "购买并付款" : "新人领劵"),
UseState = 0,
......@@ -975,18 +975,18 @@ namespace Mall.Module.MarketingCenter
discountCouponRepository.Update(cols1, wheres1, trans);
}
memberCouponRepository.DBSession.Commit();
return true;
return item;
}
catch (Exception ex)
{
LogHelper.Write(ex, "AutoCoupon");
memberCouponRepository.DBSession.Rollback("AutoCoupon");
return false;
return resultModel;
}
}
}
}
return false;
return resultModel;
}
#endregion
......
......@@ -329,7 +329,7 @@ namespace Mall.Module.Product
}
}
if (freeShippingList != null && freeShippingList.Any())
if (freeShippingList != null && freeShippingList.Any() && ((item.FullNumPinkage ?? 0) == 0) && ((item.FullMoneyPinkage ?? 0) == 0))
{
var nowcategory = categoryList.Where(x => x.GoodsId == item.GoodsId).Select(x => x.CategoryId);
......
......@@ -248,7 +248,7 @@ namespace Mall.Module.Product
List<RB_Goods_Order_Extend> orderlist = goods_OrderRepository.GetGoodsOrderNum(goodsIds: goodsIds2);
//2020-08-06 Add by:W 查询商品分类获取分类包邮规则
string allGoodsIds = string.Join(",", list.Select(x => x.Id));
string allGoodsIds = string.Join(",", list.Where(x => ((x.FullMoneyPinkage ?? 0) == 0) && ((x.FullNumPinkage ?? 0) == 0)).Select(x => x.Id));
var goodsCategoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = allGoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
string categoryIds = string.Join(",", goodsCategoryList.Select(x => x.CategoryId).Distinct());
List<RB_FreeShipping_Extend> freeShippingList = new List<RB_FreeShipping_Extend>();
......@@ -281,7 +281,7 @@ namespace Mall.Module.Product
item.SalesNum += (orderlist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0);
//2020-08-06 Add by:W 查询商品分类获取分类包邮规则
if (freeShippingList != null && freeShippingList.Any())
if (freeShippingList != null && freeShippingList.Any() && ((item.FullMoneyPinkage ?? 0) == 0) && ((item.FullNumPinkage ?? 0) == 0))
{
var nowcategory = goodsCategoryList.Where(x => x.GoodsId == item.Id).Select(x => x.CategoryId);
......@@ -1096,7 +1096,7 @@ namespace Mall.Module.Product
{
string categoryIds = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = model.MallBaseId, TenantId = model.TenantId, CategoryIds = categoryIds });
if (freeShippingList != null && freeShippingList.Any())
if (freeShippingList != null && freeShippingList.Any() && ((model.FullNumPinkage ?? 0) == 0) && ((model.FullMoneyPinkage ?? 0) == 0))
{
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)
......
......@@ -45,7 +45,7 @@ namespace Mall.Repository.Product
}
string sql = $@"select sc.*,g.Name as GoodsName,g.GoodsStatus,g.CarouselImage,g.SellingPrice as Price,g.IsCustomSpecification,g.DefaultSpecificationName,
g.EnjoyMember,g.SeparateSetMember,g.InventoryNum from RB_Goods_ShoppingCart sc
g.EnjoyMember,g.SeparateSetMember,g.InventoryNum,g.FullNumPinkage,g.FullMoneyPinkage from RB_Goods_ShoppingCart sc
inner join RB_Goods g on sc.GoodsId=g.Id
where {where} order by g.GoodsStatus asc,sc.CreateDate desc";
return GetPage<RB_Goods_ShoppingCart_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
......
......@@ -93,7 +93,14 @@ namespace Mall.Repository.User
{
where += $@" and {nameof(RB_Distributor_Bill.BillState)}={dmodel.BillState}";
}
if (dmodel.SelectBillState > 0)
{
where += $@" and {nameof(RB_Distributor_Bill.BillState)}={dmodel.SelectBillState}";
}
else if (dmodel.SelectBillState == -1)
{
where += $@" and {nameof(RB_Distributor_Bill.BillState)} in(1,2)";
}
string sql = $@"select * from RB_Distributor_Bill where {where} order by Id desc";
return Get<RB_Distributor_Bill_Extend>(sql).ToList();
}
......
......@@ -1608,6 +1608,7 @@ namespace Mall.WebApi.Controllers.MallBase
Name = y.OrderIntroduction?.Name ?? "",
Commission = y.OrderIntroduction?.Commission ?? 0,
CommissionState = y.OrderIntroduction?.CommissionState ?? 1,
Remark = y.OrderIntroduction?.Remark ,
}
}),
x.Consignee,
......
......@@ -65,6 +65,9 @@ namespace Mall.WebApi.Controllers.User
{
return ApiResult.ParamIsNull("请传递唯一码");
}
Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend couponResult = new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend();
//验证是否新用户
if (!userModule.ValidateUserOpenId(demodel.OpenId, demodel.Source, requestParm.TenantId, requestParm.MallBaseId))
{
......@@ -120,11 +123,8 @@ namespace Mall.WebApi.Controllers.User
{
//自动发放新人优惠券 2020-08-04 Add By:W
bool couponResult = couponModule.AutoCoupon(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 3 });
if (!couponResult)
{
LogHelper.WriteInfo("新人优惠券领取失败,用户id"+ UserId);
}
couponResult = couponModule.AutoCoupon(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 3 });
#region 粉象返佣 自动注册分销商 普通会员等级
if ((basicsModel?.IsEnableFXGrade ?? 2) == 1)
......@@ -177,9 +177,19 @@ namespace Mall.WebApi.Controllers.User
Token = token
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + UserId, appletUserInfo, Config.JwtExpirTime);
return ApiResult.Success("", appletUserInfo);
if (couponResult != null && couponResult.ID > 0)
{
return ApiResult.CouponSuccess(ResultCode.Success,"",couponResult.Name, appletUserInfo);
}
else {
return ApiResult.CouponFailed(ResultCode.Fail, "", "", appletUserInfo);
}
}
return ApiResult.Failed("注册失败,请联系管理员");
return ApiResult.CouponFailed(ResultCode.Fail, "", "");
// return ApiResult.Failed("注册失败,请联系管理员");
}
else
{
......@@ -187,7 +197,8 @@ namespace Mall.WebApi.Controllers.User
var umodel = userModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, Source = demodel.Source, OpenId = demodel.OpenId });
if (umodel == null)
{
return ApiResult.Failed("未能查询到用户信息");
return ApiResult.CouponFailed(ResultCode.Fail, "", "");
// return ApiResult.Failed("未能查询到用户信息");
}
TokenUserInfo userInfo = new TokenUserInfo { uid = umodel.Id.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
......@@ -225,7 +236,8 @@ namespace Mall.WebApi.Controllers.User
Token = token
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + umodel.Id, appletUserInfo, Config.JwtExpirTime);
return ApiResult.Success("", appletUserInfo);
return ApiResult.CouponFailed(ResultCode.Fail, "", "", appletUserInfo);
//return ApiResult.Success("", appletUserInfo);
}
}
......
......@@ -1117,15 +1117,14 @@ namespace Mall.WebApi.Controllers.User
query.TenantId = userInfo.TenantId;
query.MallBaseId = userInfo.MallBaseId;
query.UserId = userInfo.UserId;
query.TriggerType = 1;
bool result = couponModule.AutoCoupon(query);
if (result)
RB_DiscountCoupon_Extend resultModel = couponModule.AutoCoupon(query);
if (resultModel != null && resultModel.ID > 0)
{
return ApiResult.Success("优惠券领取成功");
return ApiResult.CouponSuccess(ResultCode.Success,"优惠券领取成功", resultModel.Name);
}
else
{
return ApiResult.Failed("优惠券领取失败");
return ApiResult.CouponFailed(ResultCode.Fail,"优惠券领取失败", "优惠券领取失败");
}
}
......@@ -1367,7 +1366,7 @@ namespace Mall.WebApi.Controllers.User
var req = RequestParm;
var userInfo = AppletUserInfo;
var orderIntroduction = userModule.GetOrderIntroductionList(new RB_Goods_OrderIntroduction_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId });
var DistributorBillList = userModule.GetDistributorBillList(new RB_Distributor_Bill_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId, BillState = 2 });
var DistributorBillList = userModule.GetDistributorBillList(new RB_Distributor_Bill_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId, SelectBillState = -1 });
var SupplierList = supplierModule.GetList(new RB_Supplier_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, Introducer = userInfo.UserId });//我的供应商
int SupplierCount = 0;
List<RB_Goods_Extend> GoodsList = new List<RB_Goods_Extend>();
......@@ -1403,7 +1402,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.ID,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);
}
......@@ -1435,12 +1434,12 @@ namespace Mall.WebApi.Controllers.User
var SpecificationValueList = productModule.GetSpecificationValueList(new RB_Goods_SpecificationValue_Extend() { GoodsIds = goodsIds, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
foreach (var item in list)
{
#region 组装价格
List<object> priceList = new List<object>();
if (item.IsCustomSpecification == 1)
{
item.SpecificationPriceList = SpecificationPriceList.Where(x=>x.GoodsId==item.Id).ToList();
item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
item.SpecificationList = SpecificationList.Where(x => x.GoodsId == item.Id).ToList();
if (item.SpecificationList.Any())
{
......@@ -1490,7 +1489,7 @@ namespace Mall.WebApi.Controllers.User
attr_name = svmodel.Name
});
}
priceList.Add(new
{
id = itemSpecificationPrice.Id,
......@@ -1500,7 +1499,7 @@ namespace Mall.WebApi.Controllers.User
price = itemSpecificationPrice.SellingPrice,
no = itemSpecificationPrice.GoodsNumbers,
weight = itemSpecificationPrice.GoodsWeight,
costPrice= itemSpecificationPrice.CostMoney,
costPrice = itemSpecificationPrice.CostMoney,
pic_url,
is_delete = itemSpecificationPrice.Status,
attr_list
......
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