diff --git a/CoreCms.Net.Configuration/GlobalEnumVars.cs b/CoreCms.Net.Configuration/GlobalEnumVars.cs
index 99e656ea..fa1c5e53 100644
--- a/CoreCms.Net.Configuration/GlobalEnumVars.cs
+++ b/CoreCms.Net.Configuration/GlobalEnumVars.cs
@@ -2457,6 +2457,11 @@ namespace CoreCms.Net.Configuration
///
[Description("无需审核")]
NoReview = 3,
+ ///
+ /// 注册自动开通
+ ///
+ [Description("注册自动开通")]
+ RegOpen = 4,
}
#endregion
diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
index 2beebdf1..fdca3c14 100644
--- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs
+++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
@@ -151,7 +151,7 @@ namespace CoreCms.Net.Configuration
///
public const string DistributionLevel = "distributionLevel";
///
- /// 成为分销商条件:1无条件(需要审核),2申请(需要审核),3无条件
+ /// 成为分销商条件:1无条件(需要审核),2申请(需要审核),3无条件,4注册账号自动开通
///
public const string DistributionType = "distributionType";
///
diff --git a/CoreCms.Net.Services/User/CoreCmsUserServices.cs b/CoreCms.Net.Services/User/CoreCmsUserServices.cs
index 2c0d4e6a..acbc4693 100644
--- a/CoreCms.Net.Services/User/CoreCmsUserServices.cs
+++ b/CoreCms.Net.Services/User/CoreCmsUserServices.cs
@@ -56,7 +56,8 @@ public class CoreCmsUserServices : BaseServices, ICoreCmsUserServic
private readonly PermissionRequirement _permissionRequirement;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
-
+ private readonly ICoreCmsDistributionGradeRepository _distributionGradeRepository;
+ private readonly ICoreCmsDistributionRepository _distributionRepository;
public CoreCmsUserServices(IUnitOfWork unitOfWork
, ICoreCmsUserRepository dal
@@ -66,7 +67,7 @@ public class CoreCmsUserServices : BaseServices, ICoreCmsUserServic
ICoreCmsUserWeChatInfoServices userWeChatInfoServices, ICoreCmsUserGradeServices userGradeServices,
PermissionRequirement permissionRequirement, IHttpContextAccessor httpContextAccessor,
ICoreCmsUserLogServices userLogServices, IServiceProvider serviceProvider,
- ICoreCmsBillPaymentsServices billPaymentsServices)
+ ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsDistributionGradeRepository distributionGradeRepository, ICoreCmsDistributionRepository distributionRepository)
{
_dal = dal;
BaseDal = dal;
@@ -82,6 +83,8 @@ public class CoreCmsUserServices : BaseServices, ICoreCmsUserServic
_userLogServices = userLogServices;
_serviceProvider = serviceProvider;
_billPaymentsServices = billPaymentsServices;
+ _distributionGradeRepository = distributionGradeRepository;
+ _distributionRepository = distributionRepository;
}
@@ -692,6 +695,27 @@ public class CoreCmsUserServices : BaseServices, ICoreCmsUserServic
if (inviterUserIntegral > 0)
await _userPointLogServices.SetPoint(userInfo.parentId, inviterUserIntegral,
(int)GlobalEnumVars.UserPointSourceTypes.PointTypeInviterUser, "发展用户:" + userId + "赠送积分");
+
+ //是否默认注册分销商
+ var distributionType = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.DistributionType).ObjectToInt(); //是否默认注册分销商
+ if (distributionType == (int)GlobalEnumVars.DistributionConditionType.RegOpen)
+ {
+ var iData = new CoreCmsDistribution();
+ iData.userId = userId;
+
+ var disGradeModel = await _distributionGradeRepository.QueryByClauseAsync(p => p.isDefault == true);
+ iData.gradeId = disGradeModel?.id ?? 0;
+
+ iData.mobile = entity.mobile;
+ iData.name = userInfo.nickName;
+ iData.weixin = "";
+ iData.qq = "";
+ iData.verifyStatus = (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes;
+ iData.isDelete = false;
+ iData.createTime = DateTime.Now;
+
+ await _distributionRepository.InsertAsync(iData);
+ }
}
userInfo = await _dal.QueryByIdAsync(userId);
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/distribution/setting/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/distribution/setting/index.html
index 4740f766..83eb4831 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/distribution/setting/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/distribution/setting/index.html
@@ -70,9 +70,10 @@
@@ -105,7 +106,7 @@
-
+