Commit 98ea760f authored by liudong1993's avatar liudong1993

分销商

parent 6b8088f3
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.User
{
/// <summary>
/// 分销商等级升级条件枚举
/// </summary>
public enum DistrbutorGradeUpdateEnum
{
/// <summary>
/// 下线用户数
/// </summary>
[EnumField("下线用户数")]
XXYHS = 1,
/// <summary>
/// 累计佣金
/// </summary>
[EnumField("累计佣金")]
LJYJ = 2,
/// <summary>
/// 已提现佣金
/// </summary>
[EnumField("已提现佣金")]
YTXYJ = 3
}
}
......@@ -105,7 +105,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 分销商等级入口图片
/// </summary>
public string GradeEntranceimage { get; set; }
public string GradeEntranceImage { get; set; }
/// <summary>
/// 提现方式 枚举
/// </summary>
......
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 商户分销商等级表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_Grade
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 等级
/// </summary>
public int? Grade
{
get;
set;
}
/// <summary>
/// 等级名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 是否自动升级 1是 2否
/// </summary>
public int? IsAutoUpGrade
{
get;
set;
}
/// <summary>
/// 升级条件 枚举
/// </summary>
public DistrbutorGradeUpdateEnum? UpGradeCondition
{
get;
set;
}
/// <summary>
/// 下线数量
/// </summary>
public int? ReferralsNumber
{
get;
set;
}
/// <summary>
/// 累计佣金
/// </summary>
public decimal? TotalCommission
{
get;
set;
}
/// <summary>
/// 已提现佣金
/// </summary>
public decimal? CommissionWithdrawn
{
get;
set;
}
/// <summary>
/// 分销佣金类型 1百分比 2固定金额
/// </summary>
public int? DistributionCommissionType
{
get;
set;
}
/// <summary>
/// 一级佣金
/// </summary>
public decimal? OneCommission
{
get;
set;
}
/// <summary>
/// 二级佣金
/// </summary>
public decimal? TwoCommission
{
get;
set;
}
/// <summary>
/// 三级级佣金
/// </summary>
public decimal? ThreeCommission
{
get;
set;
}
/// <summary>
/// 是否启用 1是 2否
/// </summary>
public int? Enabled
{
get;
set;
}
/// <summary>
/// 等级说明
/// </summary>
public string GradeExplain
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 分销商表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_Info
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 姓名
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 总计佣金
/// </summary>
public decimal? TotalCommission
{
get;
set;
}
/// <summary>
/// 可提现佣金
/// </summary>
public decimal? CommissionWithdrawal
{
get;
set;
}
/// <summary>
/// 分销商等级id
/// </summary>
public int? GradeId
{
get;
set;
}
/// <summary>
/// 审核状态 1审核中 2通过 3拒绝
/// </summary>
public int? AuditStatus
{
get;
set;
}
/// <summary>
/// 审核时间
/// </summary>
public DateTime? AuditDate
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 分销商提现表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_Remit
{
/// <summary>
/// Id
/// </summary>
public int? Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 提现方式 枚举
/// </summary>
public int? WithdrawalWay
{
get;
set;
}
/// <summary>
/// 申请金额
/// </summary>
public decimal? AppliedMoney
{
get;
set;
}
/// <summary>
/// 手续费
/// </summary>
public decimal? Fee
{
get;
set;
}
/// <summary>
/// 打款金额
/// </summary>
public decimal? RemitMoney
{
get;
set;
}
/// <summary>
/// 审核状态 1申请中 2同意申请,待打款 3已打款 4拒绝
/// </summary>
public int? AuditStatus
{
get;
set;
}
/// <summary>
/// 审核时间
/// </summary>
public DateTime? AuditDate
{
get;
set;
}
/// <summary>
/// 打款时间
/// </summary>
public DateTime? RemitDate
{
get;
set;
}
/// <summary>
/// 审核备注
/// </summary>
public string AuditRemark
{
get;
set;
}
/// <summary>
/// 打款备注
/// </summary>
public string RemitRemark
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 账户名称
/// </summary>
public string AccountName
{
get;
set;
}
/// <summary>
/// 账户号码
/// </summary>
public string AccountNumber
{
get;
set;
}
}
}
......@@ -147,6 +147,10 @@ namespace Mall.Model.Entity.User
set;
}
/// <summary>
/// 是否是分销商 1是 2否
/// </summary>
public int IsDistributor { get; set; }
/// <summary>
/// 联系方式
/// </summary>
public string ContactWay
......
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 商户分销商等级表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_Grade_Extend : RB_Distributor_Grade
{
/// <summary>
/// 等级ids
/// </summary>
public string GradeIds { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Common.Enum.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 分销商表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_Info_Extend : RB_Distributor_Info
{
/// <summary>
/// 来自于自主申请 1是
/// </summary>
public int? IsFormSelfApplication { get; set; }
/// <summary>
/// 用户来源
/// </summary>
public UserSourceEnum? Source { get; set; }
/// <summary>
/// 昵称
/// </summary>
public string NickName { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Photo { get; set; }
/// <summary>
/// 手机
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 等级名称
/// </summary>
public string GradeName { get; set; }
/// <summary>
/// 上级id
/// </summary>
public int? SuperiorId { get; set; }
/// <summary>
/// 上级名称
/// </summary>
public string SuperiorName { get; set; }
/// <summary>
/// 一级分销数量
/// </summary>
public int? OneNum { get; set; }
/// <summary>
/// 二级分销数量
/// </summary>
public int? TwoNum { get; set; }
/// <summary>
/// 三级分销数量
/// </summary>
public int? ThreeNum { get; set; }
/// <summary>
/// 用户ids
/// </summary>
public string UserIds { get; set; }
}
}
......@@ -22,5 +22,15 @@ namespace Mall.Model.Extend.User
/// 导出枚举ids
/// </summary>
public List<int> ExcelEnumIds { get; set; }
/// <summary>
/// 用户ids
/// </summary>
public string UserIds { get; set; }
/// <summary>
/// 下线数量
/// </summary>
public int? ReferralsNum { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Common;
using Mall.Common.Plugin;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.User;
using Mall.Repository.Product;
using Mall.Model.Extend.Product;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
namespace Mall.Module.User
{
/// <summary>
/// 商户用户公共处理层
/// </summary>
public class UserCommonModule
{
/// <summary>
/// 分销基础配置
/// </summary>
private readonly RB_Distributor_BasicsRepository distributor_BasicsRepository = new RB_Distributor_BasicsRepository();
/// <summary>
/// 分销自定义设置
/// </summary>
private readonly RB_Distributor_CustomRepository distributor_CustomRepository = new RB_Distributor_CustomRepository();
/// <summary>
/// 初始化分销基础配置
/// </summary>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public bool InitializeDistributorBasicsInfo(int TenantId,int MallBaseId)
{
var OModel = distributor_BasicsRepository.GetList(new RB_Distributor_Basics_Extend() { TenantId = TenantId, MallBaseId = MallBaseId }).FirstOrDefault();
if (OModel == null)
{
string GradeEntranceImage = new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("InitializeImages")["GradeEntranceImage"];
return distributor_BasicsRepository.Insert(new RB_Distributor_Basics()
{
Id = 0,
ApplicationProtocol = "",
ApplyFor = Common.Enum.User.DistributorApplyForEnum.TX,
BackgroundImage = 0,
CreateDate = DateTime.Now,
DailyWithdrawalLimit = -1,
DistributorCommissionType = 1,
DistributorCondition = Common.Enum.User.DistributorConditionEnum.WTJ,
DistributorTier = 1,
GradeEntrance = 1,
GradeEntranceImage = GradeEntranceImage,
IndexImage = 0,
InPurchasing = 1,
MallBaseId = MallBaseId,
MinimumWithdrawalLimit = 50,
OneCommission = 0,
ReferralsCondition = Common.Enum.User.DistrbutorReferralsEnum.SCDJ,
TenantId = TenantId,
ThreeCommission = 0,
TwoCommission = 0,
UpdateDate = DateTime.Now,
UserNotes = "",
WithdrawFee = 0,
WithdrawWay = Common.Enum.User.DistrbutorWithdrawWayEnum.ZDDK
}) > 0;
}
else {
return true;
}
}
/// <summary>
/// 初始化分销自定义
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool InitializeDistributorCustomInfo(int TenantId, int MallBaseId)
{
var OModel = distributor_CustomRepository.GetList(new RB_Distributor_Custom_Extend() { TenantId = TenantId, MallBaseId = MallBaseId }).FirstOrDefault();
if (OModel != null)
{
return distributor_CustomRepository.Insert(new RB_Distributor_Custom()
{
Id = 0,
ApplicationAgreement = "分销申请协议",
HeadImage = 1,
BottomImage = 2,
ButtonColor = "#FF4544",
ButtonFilletPX = 40,
ButtonText = "申请成为分销商",
ButtonTextColor = "#FFFFFF",
DistributionApplication = "分销申请",
DistributionCommissionName = "分销佣金",
DistributionCommissionImage = 3,
DistributionOrderName = "分销订单",
DistributionOrderImage = 4,
WithdrawDetialsName = "提现明细",
WithdrawDetialsImage = 5,
MyTeamName = "我的团队",
MyTeamImage = 6,
PromoteQRCodeName = "推广二维码",
PromoteQRCodeImage = 7,
ReferrerName = "推荐人",
CommissionForWithdrawalName = "可提现佣金",
WithdrawDepositName = "提现",
CommissionWithdrawnName = "已提现佣金",
OutstandingCommissionName = "未结算佣金",
DistributorName = "分销商",
CommissionTobePaidName = "待打款佣金",
UserNotesName = "用户须知",
IWantToWithdrawName = "我要提现",
WithdrawalAmountName = "提现金额",
WithdrawalWayName = "提现方式",
OneDistributionName = "一级分销名称",
TwoDistributionName = "二级分销名称",
ThreeDistributionName = "三级分销名称",
CreateDate = DateTime.Now,
MallBaseId = MallBaseId,
TenantId = TenantId,
UpdateDate = DateTime.Now
}) > 0;
}
else {
return true;
}
}
}
}
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 分销商等级仓储层
/// </summary>
public class RB_Distributor_GradeRepository : RepositoryBase<RB_Distributor_Grade>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_Grade_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Distributor_Grade_Extend dmodel)
{
string where = $@" 1=1 and {nameof(RB_Distributor_Grade.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and {nameof(RB_Distributor_Grade.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
where += $@" and {nameof(RB_Distributor_Grade.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0) {
where += $@" and {nameof(RB_Distributor_Grade.Id)}={dmodel.Id}";
}
if (dmodel.Grade > 0) {
where += $@" and {nameof(RB_Distributor_Grade.Grade)}={dmodel.Grade}";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and {nameof(RB_Distributor_Grade.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.Enabled > 0) {
where += $@" and {nameof(RB_Distributor_Grade.Enabled)}={dmodel.Enabled}";
}
string sql = $@"select * from RB_Distributor_Grade where {where} order by Id desc";
return GetPage<RB_Distributor_Grade_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Distributor_Grade_Extend> GetList(RB_Distributor_Grade_Extend dmodel)
{
string where = $@" 1=1 and {nameof(RB_Distributor_Grade.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Distributor_Grade.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Distributor_Grade.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Distributor_Grade.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.GradeIds))
{
where += $@" and {nameof(RB_Distributor_Grade.Id)} in({dmodel.GradeIds})";
}
if (dmodel.Grade > 0)
{
where += $@" and {nameof(RB_Distributor_Grade.Grade)}={dmodel.Grade}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Distributor_Grade.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.Enabled > 0)
{
where += $@" and {nameof(RB_Distributor_Grade.Enabled)}={dmodel.Enabled}";
}
string sql = $@"select * from RB_Distributor_Grade where {where} order by Id desc";
return Get<RB_Distributor_Grade_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 分销商等级仓储层
/// </summary>
public class RB_Distributor_InfoRepository : RepositoryBase<RB_Distributor_Info>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
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) {
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.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.Source > 0) {
where += $@" and u.{nameof(RB_Member_User.Source)}={dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.NickName))
{
where += $@" and u.{nameof(RB_Member_User.Name)} like '%{dmodel.NickName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Mobile))
{
where += $@" and u.{nameof(RB_Member_User.Moblie)} like '%{dmodel.Mobile}%'";
}
string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile from RB_Distributor_Info di
inner join rb_member_user u on di.UserId=u.Id
where {where} order by di.CreateDate desc";
return GetPage<RB_Distributor_Info_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Distributor_Info_Extend> GetList(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 (!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}%'";
}
string sql = $@"select di.* from RB_Distributor_Info di where {where} order by di.CreateDate desc";
return Get<RB_Distributor_Info_Extend>(sql).ToList();
}
}
}
......@@ -68,7 +68,7 @@ namespace Mall.Repository.User
if (!string.IsNullOrEmpty(dmodel.GradeIds)) {
where += $@" and e.{nameof(RB_Member_Equity.GradeId)} in({dmodel.GradeIds})";
}
string sql = $@"select e.*,mi.Name as ImagePath from RB_Member_Equity e
string sql = $@"select e.*,mi.Path as ImagePath from RB_Member_Equity e
left join rb_material_info mi on e.Image=mi.Id
where {where} order by e.Id desc";
return Get<RB_Member_Equity_Extend>(sql).ToList();
......
......@@ -97,10 +97,115 @@ select * from RB_Member_User where {where} order by CreateDate desc
{
where += $@" and {nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds)) {
where += $@" and {nameof(RB_Member_User.Id)} in({dmodel.UserIds})";
}
string sql = $@"
select * from RB_Member_User where {where} order by CreateDate desc
";
return Get<RB_Member_User_Extend>(sql).ToList();
}
/// <summary>
/// 获取下拉列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetMemberUserDropDownList(int pageIndex, int pageSize, out long count, RB_Member_User_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Member_User.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Member_User.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.AliasName))
{
where += $@" and {nameof(RB_Member_User.AliasName)} like '%{dmodel.AliasName}%'";
}
if (dmodel.Source > 0)
{
where += $@" and {nameof(RB_Member_User.Source)} ={(int)dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.Moblie))
{
where += $@" and {nameof(RB_Member_User.Moblie)} like '%{dmodel.Moblie}%'";
}
if (dmodel.MemberGrade > 0)
{
where += $@" and {nameof(RB_Member_User.MemberGrade)}={dmodel.MemberGrade}";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and {nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
if (dmodel.IsDistributor > 0)
{
where += $@" and {nameof(RB_Member_User.IsDistributor)}={dmodel.IsDistributor}";
}
string sql = $@"select Id,Name,AliasName from RB_Member_User where {where} order by CreateDate desc";
return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 需更新该等级下的用户等级
/// </summary>
/// <param name="GradeId"></param>
/// <param name="DefaultGId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
public bool UpdateMemberGrade(int GradeId, int DefaultGId, int tenantId, int mallBaseId)
{
string sql = $@" update RB_Member_User set MemberGrade={DefaultGId} where MemberGrade={GradeId} and TenantId={tenantId} and MallBaseId={mallBaseId}";
return Execute(sql) > 0;
}
/// <summary>
/// 获取下线分销商数量
/// </summary>
/// <param name="uids"></param>
/// <param name="tier"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetDistributorReferralsNum(string uids, int tier, int tenantId, int mallBaseId)
{
if (tier == 1)
{
string sql = $@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
WHERE u.IsDistributor=1 and u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId in ({uids}) GROUP BY u.SuperiorId";
return Get<RB_Member_User_Extend>(sql).ToList();
}
else if (tier == 2)
{
string sql = $@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
WHERE u.IsDistributor=1 and u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId in ({uids}) GROUP BY u.SuperiorId";
return Get<RB_Member_User_Extend>(sql).ToList();
}
else if (tier == 3) {
string sql = $@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
INNER JOIN rb_member_user u2 on u1.Id=u2.SuperiorId
WHERE u.IsDistributor=1 and u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId in ({uids}) GROUP BY u.SuperiorId";
return Get<RB_Member_User_Extend>(sql).ToList();
}
return new List<RB_Member_User_Extend>();
}
}
}
......@@ -27,5 +27,8 @@
"RedisPwd": "123456"
},
"VirtualDirectory": "WebFile",
"FileService": "2"
"FileService": "2",
"InitializeImages": {
"GradeEntranceImage": "1234566778"
}
}
\ No newline at end of file
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