Commit 61ed4acc authored by liudong1993's avatar liudong1993
parents 163b0873 2986961a
......@@ -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>
......
......@@ -28,14 +28,15 @@ namespace Mall.Common
/// </summary>
public class Config
{
private static readonly byte[] _webapikey = { 0xF1, 0x12, 0xA3, 0xD1, 0xBA, 0x54, 0x2A, 0x88 };
private static readonly byte[] _webapiiv = { 0x04, 0xAE, 0x57, 0x83, 0x56, 0x28, 0x66, 0xA7 };
/// <summary>
/// 配置文件注入
/// </summary>
public readonly static IConfiguration Configuration;
static Config()
{
Configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true)
......@@ -49,6 +50,7 @@ namespace Mall.Common
{
get { return _webapikey; }
}
/// <summary>
/// WebService接口加密IV
/// </summary>
......@@ -57,6 +59,49 @@ namespace Mall.Common
get { return _webapiiv; }
}
/// <summary>
/// 获取连接字符串
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetConnectionString(string key)
{
try
{
return Configuration.GetConnectionString(key);
}
catch
{
return "";
}
}
/// <summary>
/// 读取配置文件key的值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string ReadConfigKey(string key, string subKey = "")
{
string valueStr = "";
try
{
if (!string.IsNullOrWhiteSpace(subKey))
{
valueStr = Configuration.GetSection(key)[subKey].ToString();
}
else
{
valueStr = Configuration.GetSection(key).Value;
}
}
catch
{
}
return valueStr;
}
/// <summary>
/// 超级管理员id
/// </summary>
......@@ -65,7 +110,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("AdminId").Value;
return ReadConfigKey("AdminId");
}
}
......@@ -112,7 +157,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("JwtSecretKey").Value;
return ReadConfigKey("JwtSecretKey");
}
}
......@@ -123,9 +168,11 @@ namespace Mall.Common
{
get
{
return Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("JwtExpirTime").Value);
Int32.TryParse(ReadConfigKey("JwtExpirTime"), out int JwtExpirTime);
return JwtExpirTime;
}
}
/// <summary>
/// 接口请求过期时间,单位为秒
/// </summary>
......@@ -133,56 +180,11 @@ namespace Mall.Common
{
get
{
return Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ApiExpirTime").Value);
Int32.TryParse(ReadConfigKey("ApiExpirTime"), out int ApiExpirTime);
return ApiExpirTime;
}
}
/// <summary>
/// 获取连接字符串
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetConnectionString(string key)
{
try
{
return Configuration.GetConnectionString(key);
}
catch
{
return "";
}
}
/// <summary>
/// 读取配置文件key的值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string ReadConfigKey(string key,string subKey="")
{
string valueStr = "";
try
{
if (!string.IsNullOrWhiteSpace(subKey))
{
valueStr = Configuration.GetSection(key)[subKey].ToString();
}
else
{
valueStr = Configuration.GetSection(key).Value;
}
}
catch
{
}
return valueStr;
}
/// <summary>
/// 阿里云oss域名
/// </summary>
......@@ -221,7 +223,6 @@ namespace Mall.Common
}
}
/// <summary>
/// 获取文件相对路径
/// </summary>
......@@ -241,28 +242,16 @@ namespace Mall.Common
{
return path;
}
}
else
{
return path;
}
}
public static string FileService
{
get
{
return ReadConfigKey("FileService");
}
}
/// <summary>
/// 上传站点地址
/// </summary>
public static string UploadSiteUrl
{
get
......@@ -279,7 +268,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ViewFileSiteUrl").Value;
return ReadConfigKey("ViewFileSiteUrl");
}
}
......@@ -299,27 +288,36 @@ namespace Mall.Common
}
}
/// <summary>
/// 获取虚拟目录
/// </summary>
public static string VirtualDirectory
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("VirtualDirectory").Value;
return ReadConfigKey("VirtualDirectory");
}
}
/// <summary>
/// Mongo连接地址
/// </summary>
public static string Mongo
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("Mongo").Value;
return ReadConfigKey("Mongo");
}
}
/// <summary>
/// 获取MongoDBName
/// </summary>
public static string MongoDBName
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("MongoDBName").Value;
return ReadConfigKey("MongoDBName");
}
}
......@@ -330,7 +328,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ProjectUrl").Value;
return ReadConfigKey("ProjectUrl");
}
}
......@@ -341,9 +339,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("DeveloperKitsPort").Value;
return ReadConfigKey("DeveloperKitsPort");
}
}
/// <summary>
/// 小程序生成二维码跳转地址
/// </summary>
......@@ -351,7 +350,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("FirstPage").Value;
return ReadConfigKey("FirstPage");
}
}
......@@ -363,7 +362,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ByteDanceSendTemplate").Value;
return ReadConfigKey("ByteDanceSendTemplate");
}
}
......@@ -374,9 +373,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("sTenpayNotify").Value;
return ReadConfigKey("sTenpayNotify");
}
}
/// <summary>
/// 微信充值支付成功接口处理地址
/// </summary>
......@@ -384,7 +384,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("sTenpayRechargeNotify").Value;
return ReadConfigKey("sTenpayRechargeNotify");
}
}
......@@ -395,9 +395,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("sTenpayMemberBuyNotify").Value;
return ReadConfigKey("sTenpayMemberBuyNotify");
}
}
/// <summary>
/// VIP购买会员微信购买支付成功接口处理地址
/// </summary>
......@@ -405,11 +406,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("sTenpayVipBuyNotify").Value;
return ReadConfigKey("sTenpayVipBuyNotify");
}
}
/// <summary>
/// 网络主管的id,用于新建供应商账户的时候的创建人
......@@ -418,9 +418,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("NetworkDirector").Value;
return ReadConfigKey("NetworkDirector");
}
}
/// <summary>
/// 收款创建人的id,用于新建供应商账户的时候的创建人
/// </summary>
......@@ -428,7 +429,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IncomeDirector").Value;
return ReadConfigKey("IncomeDirector");
}
}
......@@ -439,7 +440,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IncomeBranchId").Value;
return ReadConfigKey("IncomeBranchId");
}
}
......@@ -450,9 +451,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IncomeDepartment").Value;
return ReadConfigKey("IncomeDepartment");
}
}
/// <summary>
/// 付款创建人的id,用于新建供应商账户的时候的创建人
/// </summary>
......@@ -460,7 +462,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ExpendDirector").Value;
return ReadConfigKey("ExpendDirector");
}
}
......@@ -471,7 +473,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ExpendBranchId").Value;
return ReadConfigKey("ExpendBranchId");
}
}
......@@ -483,7 +485,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ExpendDepartment").Value;
return ReadConfigKey("ExpendDepartment");
}
}
......@@ -494,7 +496,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("RebornDMC").Value;
return ReadConfigKey("RebornDMC");
}
}
......@@ -505,11 +507,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("RB_Branch_Id").Value;
return ReadConfigKey("RB_Branch_Id");
}
}
/// <summary>
/// 生成收入财务单据
/// </summary>
......@@ -517,9 +518,10 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IncomeFinanceApi").Value;
return ReadConfigKey("IncomeFinanceApi");
}
}
/// <summary>
/// 财务单据请求参数Key
/// </summary>
......@@ -527,7 +529,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("FinanceKey").Value;
return ReadConfigKey("FinanceKey");
}
}
......@@ -538,7 +540,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("PaymentFinanceApi").Value;
return ReadConfigKey("PaymentFinanceApi");
}
}
......@@ -549,7 +551,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("SettlementRate").Value;
return ReadConfigKey("SettlementRate");
}
}
......@@ -560,7 +562,7 @@ namespace Mall.Common
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("PropertyDB").Value;
return ReadConfigKey("PropertyDB");
}
}
}
......
......@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Commom.Plugin
namespace Mall.Common.Plugin
{
/// <summary>
/// 公共帮助类
......
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 拼团配置表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_GroupBuyConfig
{
/// <summary>
/// 拼团配置主键编号
/// </summary>
public int GroupByConfigId { get; set; }
/// <summary>
/// 是否开启分销(1-开启)
/// </summary>
public int Is_Share { get; set; }
/// <summary>
/// 是否开启区域允许购买(1-开启)
/// </summary>
public int Is_Territorial_Limitation { get; set; }
/// <summary>
/// 支付方式[online_pay-线上支付,huodao-货到付款,balance-余额支付]
/// </summary>
public string Payment_Type { get; set; }
/// <summary>
/// 发货方式[express-快递配送,offline-到店自提,city-同城配送]
/// </summary>
public string Send_Type { get; set; }
/// <summary>
/// 优惠券(1-开启)
/// </summary>
public int Is_Coupon { get; set; }
/// <summary>
/// 超级会员卡(1-开启)
/// </summary>
public int SVIP_Status { get; set; }
/// <summary>
/// 会员价[1-开启]
/// </summary>
public int Is_Member_Price { get; set; }
/// <summary>
/// 积分[1-开启]
/// </summary>
public int Is_Integral { get; set; }
/// <summary>
/// 活动规则
/// </summary>
public string RuleText { get; set; }
/// <summary>
/// 商品海报
/// </summary>
public string Goods_Poster { get; set; }
/// <summary>
/// 广告
/// </summary>
public string Advertisement { get; set; }
/// <summary>
/// 拼团广告状态(1-开启)
/// </summary>
public int Is_Advertisement { get; set; }
/// <summary>
/// 小程序Id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 商户Id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 微信拼团成功通知
/// </summary>
public string WeChat_pintuan_success_notice { get; set; }
/// <summary>
/// 微信拼团失败通知
/// </summary>
public string WeChat_pintuan_fail_notice { get; set; }
}
}
......@@ -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;
}
}
}
using Mall.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 拼团配置扩展实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_GroupBuyConfig_Extend : RB_GroupBuyConfig
{
}
}
\ No newline at end of file
......@@ -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
......
......@@ -333,7 +333,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)
......
using Mall.Model.Extend.User;
using Mall.Repository.User;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Module.User
{
/// <summary>
/// 拼团配置处理类
/// </summary>
public class GroupBuyConfigModule
{
/// <summary>
/// 拼团配置仓储层对象
/// </summary>
private readonly RB_GroupBuyConfigRepository groupBuyConfigRepository = new RB_GroupBuyConfigRepository();
/// <summary>
/// 添加修改拼团配置
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetGroupBuyConfigModule(RB_GroupBuyConfig_Extend extModel)
{
bool flag = false;
var oldEntity = GetGroupBuyConfigModule(extModel);
extModel.GroupByConfigId = oldEntity?.GroupByConfigId ?? 0;
if (extModel.GroupByConfigId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_GroupBuyConfig_Extend.Is_Share),extModel.Is_Share },
{nameof(RB_GroupBuyConfig_Extend.Is_Territorial_Limitation),extModel.Is_Territorial_Limitation },
{nameof(RB_GroupBuyConfig_Extend.Payment_Type),extModel.Payment_Type },
{nameof(RB_GroupBuyConfig_Extend.Send_Type),extModel.Send_Type },
{nameof(RB_GroupBuyConfig_Extend.Is_Coupon),extModel.Is_Coupon },
{nameof(RB_GroupBuyConfig_Extend.SVIP_Status),extModel.SVIP_Status },
{nameof(RB_GroupBuyConfig_Extend.Is_Member_Price),extModel.Is_Member_Price },
{nameof(RB_GroupBuyConfig_Extend.Is_Integral),extModel.Is_Integral },
{nameof(RB_GroupBuyConfig_Extend.RuleText),extModel.RuleText },
{nameof(RB_GroupBuyConfig_Extend.Goods_Poster),extModel.Goods_Poster },
{nameof(RB_GroupBuyConfig_Extend.Advertisement),extModel.Advertisement },
{nameof(RB_GroupBuyConfig_Extend.Is_Advertisement),extModel.Is_Advertisement },
};
flag = groupBuyConfigRepository.Update(fileds, new WhereHelper(nameof(RB_GroupBuyConfig_Extend.GroupByConfigId), extModel.GroupByConfigId));
}
else
{
var newId = groupBuyConfigRepository.Insert(extModel);
extModel.GroupByConfigId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 新增修改消息模板
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetGroupBuyConfigMessageModule(RB_GroupBuyConfig_Extend extModel)
{
bool flag = false;
var oldEntity = GetGroupBuyConfigModule(extModel);
extModel.GroupByConfigId = oldEntity?.GroupByConfigId ?? 0;
if (extModel.GroupByConfigId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_GroupBuyConfig_Extend.WeChat_pintuan_success_notice),extModel.WeChat_pintuan_success_notice },
{nameof(RB_GroupBuyConfig_Extend.WeChat_pintuan_fail_notice),extModel.WeChat_pintuan_fail_notice },
};
flag = groupBuyConfigRepository.Update(fileds, new WhereHelper(nameof(RB_GroupBuyConfig_Extend.GroupByConfigId), extModel.GroupByConfigId));
}
else
{
var newId = groupBuyConfigRepository.Insert(extModel);
extModel.GroupByConfigId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取拼团配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_GroupBuyConfig_Extend GetGroupBuyConfigModule(RB_GroupBuyConfig_Extend query)
{
return groupBuyConfigRepository.GetGroupBuyConfigRepository(query);
}
}
}
......@@ -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();
}
......
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 拼团配置仓储层对象
/// </summary>
public class RB_GroupBuyConfigRepository : BaseRepository<RB_GroupBuyConfig>
{
/// <summary>
/// 获取拼团配置实体
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public RB_GroupBuyConfig_Extend GetGroupBuyConfigRepository(RB_GroupBuyConfig_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_groupbuyconfig
WHERE 1=1
");
if (query != null)
{
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_GroupBuyConfig_Extend.MallBaseId), query.MallBaseId);
}
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_GroupBuyConfig_Extend.TenantId), query.TenantId);
}
if (query.GroupByConfigId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_GroupBuyConfig_Extend.GroupByConfigId), query.GroupByConfigId);
}
}
return Get<RB_GroupBuyConfig_Extend>(builder.ToString()).FirstOrDefault();
}
}
}
......@@ -22,6 +22,7 @@ namespace Mall.WebApi.Controllers.CAP
public TestController(DotNetCore.CAP.ICapPublisher capPublisher)
{
this._capBus = capPublisher;
}
[HttpPost]
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.User;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Mall.WebApi.Controllers.Product
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class GroupBuyController : BaseController
{
/// <summary>
/// 拼团配置处理类对象
/// </summary>
private readonly GroupBuyConfigModule groupBuyConfigModule = new GroupBuyConfigModule();
/// <summary>
/// 添加修改拼团配置
/// </summary>
/// <returns></returns>
public ApiResult SetGroupBuyConfig()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_GroupBuyConfig_Extend>(RequestParm.msg.ToString());
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
var flag = groupBuyConfigModule.SetGroupBuyConfigModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 添加修改拼团消息配置
/// </summary>
/// <returns></returns>
public ApiResult SetGroupBuyConfigMessage()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_GroupBuyConfig_Extend>(RequestParm.msg.ToString());
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
var flag = groupBuyConfigModule.SetGroupBuyConfigMessageModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取拼团配置实体
/// </summary>
/// <returns></returns>
public ApiResult GetGroupBuyConfigModule()
{
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_GroupBuyConfig_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var extModel = groupBuyConfigModule.GetGroupBuyConfigModule(query);
return ApiResult.Success(data: extModel);
}
}
}
\ No newline at end of file
......@@ -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
......
......@@ -13,6 +13,7 @@
<PackageReference Include="DotNetCore.CAP.MongoDB" Version="2.6.0" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="2.6.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" />
</ItemGroup>
......
......@@ -62,7 +62,7 @@ namespace Mall.WebApi
services.AddCap(x =>
{
x.UseMongoDB(Common.Config.ReadConfigKey("Mongo"));
x.UseMongoDB(Common.Config.Mongo);
x.UseRabbitMQ(cfg =>
{
cfg.HostName = Common.Config.ReadConfigKey("RabbitMqConfig", "HostName");
......
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