Commit 3163f6eb authored by liudong1993's avatar liudong1993

商品其他功能

parent ffefac88
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品快速购买表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_QuickBuy
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 分类id
/// </summary>
public int? CategoryId
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? Sort
{
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.Product
{
/// <summary>
/// 商品推荐设置表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Recommend
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 商品详情页面推荐状态 1开启 2禁止
/// </summary>
public int? DetailRecommendStatus
{
get;
set;
}
/// <summary>
/// 推荐数量
/// </summary>
public int? DetailRecommendNum
{
get;
set;
}
/// <summary>
/// 订单完成后推荐状态 1开启 2禁止
/// </summary>
public int? OrderCompleteStatus
{
get;
set;
}
/// <summary>
/// 是否自定义 1是 2否
/// </summary>
public int? IsOrderRecommend
{
get;
set;
}
/// <summary>
/// 自定义商品ids 逗号分隔
/// </summary>
public string OrderProductIds
{
get;
set;
}
/// <summary>
/// 评论后推荐商品状态 1开启 2禁止
/// </summary>
public int? CommentRecommentStatus
{
get;
set;
}
/// <summary>
/// 评论后自定义推荐商品 1是 2否
/// </summary>
public int? IsCommentRecommend
{
get;
set;
}
/// <summary>
/// 评论后推荐商品ids 逗号分隔
/// </summary>
public string CommentProductIds
{
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.Product
{
/// <summary>
/// 商品服务表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Service
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 服务名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? Sort
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 是否默认 1是 2否
/// </summary>
public int? IsDefault
{
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.Product
{
/// <summary>
/// 商品规格表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Specification
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 规格名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 规格内容 json格式
/// </summary>
public string Content
{
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 System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品快速购买表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_QuickBuy_Extend : RB_Product_QuickBuy
{
/// <summary>
/// 图标
/// </summary>
public string IconPath { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public string CategoryName { get; set; }
/// <summary>
/// 图标id
/// </summary>
public int? Icon { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品推荐设置表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Recommend_Extend : RB_Product_Recommend
{
/// <summary>
/// 订单完成后自定义推荐商品
/// </summary>
public List<RB_ProductRecommendModel> OrderProductList { get; set; }
/// <summary>
/// 评论后自定义推荐商品
/// </summary>
public List<RB_ProductRecommendModel> CommentProductList { get; set; }
}
/// <summary>
/// 商品选择
/// </summary>
public class RB_ProductRecommendModel {
/// <summary>
/// 商品id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 商品图片
/// </summary>
public string Image { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品服务表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Service_Extend : RB_Product_Service
{
/// <summary>
/// 更新类型
/// </summary>
public int? UpdateType { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品规格表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Product_Specification_Extend : RB_Product_Specification
{
/// <summary>
/// 规格值列表
/// </summary>
public List<string> SpecList { get; set; }
}
}
......@@ -73,5 +73,9 @@ namespace Mall.Model.Extend.User
/// 下载枚举ids
/// </summary>
public List<int> ExcelEnumIds { get; set; }
/// <summary>
/// 第几级
/// </summary>
public int? ReferralsType { get; set; }
}
}
This diff is collapsed.
......@@ -32,6 +32,10 @@ namespace Mall.Module.User
/// 分类样式
/// </summary>
private readonly RB_Product_CategoryStyleRepository product_CategoryStyleRepository = new RB_Product_CategoryStyleRepository();
/// <summary>
/// 推荐设置
/// </summary>
private readonly RB_Product_RecommendRepository product_RecommendRepository = new RB_Product_RecommendRepository();
/// <summary>
/// 初始化分销基础配置
......@@ -162,5 +166,37 @@ namespace Mall.Module.User
return true;
}
}
/// <summary>
/// 初始化商品推荐设置
/// </summary>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public bool InitializeProductRecommendInfo(int TenantId, int MallBaseId) {
var oModel = product_RecommendRepository.GetList(new RB_Product_Recommend_Extend() { TenantId = TenantId, MallBaseId = MallBaseId }).FirstOrDefault();
if (oModel == null)
{
return product_RecommendRepository.Insert(new Model.Entity.Product.RB_Product_Recommend()
{
Id = 0,
CommentProductIds = "",
CommentRecommentStatus = 1,
CreateDate = DateTime.Now,
DetailRecommendNum = 6,
DetailRecommendStatus = 1,
IsCommentRecommend = 2,
IsOrderRecommend = 2,
MallBaseId = MallBaseId,
OrderCompleteStatus = 1,
OrderProductIds = "",
TenantId = TenantId,
UpdateDate = DateTime.Now
}) > 0;
}
else {
return true;
}
}
}
}
......@@ -769,6 +769,13 @@ namespace Mall.Module.User
{
return false;
}
if (model.Enabled == 1 && demodel.Enabled == 2) {
//验证是否有分销商在使用该等级
if (ValidateDistributorGradeEnabled(model.Id))
{
return false;
}
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Distributor_Grade.CommissionWithdrawn),demodel.CommissionWithdrawn},
......@@ -808,6 +815,17 @@ namespace Mall.Module.User
}
}
/// <summary>
/// 获取分销等级下拉列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Distributor_Grade_Extend> GetDistributorGradeDropdownList(RB_Distributor_Grade_Extend demodel)
{
var list = distributor_GradeRepository.GetList(demodel);
return list;
}
/// <summary>
/// 删除
/// </summary>
......@@ -844,6 +862,54 @@ namespace Mall.Module.User
return distributor_GradeRepository.Update(keyValues, whereHelpers);
}
/// <summary>
/// 验证分销商等级使用
/// </summary>
/// <param name="gradeId"></param>
/// <returns></returns>
public bool ValidateDistributorGradeEnabled(int gradeId)
{
List<WhereHelper> whereHelpers = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Distributor_Info.GradeId),
FiledValue=gradeId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Distributor_Info.Status),
FiledValue=0,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Distributor_Info.AuditStatus),
FiledValue=2,
OperatorEnum=OperatorEnum.Equal
}
};
return distributor_InfoRepository.Exists(whereHelpers);
}
/// <summary>
/// 修改分销商等级启用
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetDistributorGradeEnabledStatus(RB_Distributor_Grade model)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Distributor_Grade.Enabled),model.Enabled==1?2:1},
{ nameof(RB_Distributor_Grade.UpdateDate),DateTime.Now}
};
List<WhereHelper> whereHelpers = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Distributor_Grade.Id),
FiledValue=model.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return distributor_GradeRepository.Update(keyValues, whereHelpers);
}
/// <summary>
/// 获取分销商等级信息
/// </summary>
......@@ -982,6 +1048,17 @@ namespace Mall.Module.User
return "";
}
/// <summary>
/// 获取下级用户列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetDistributorInfoReferralsPageList(RB_Distributor_Info_Extend demodel)
{
var list = member_UserRepository.GetDistributorReferralsPageList(demodel.UserId, demodel.ReferralsType, demodel.TenantId, demodel.MallBaseId);
return list;
}
/// <summary>
/// 分销商审核+修改等级
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品快速购买仓储层
/// </summary>
public class RB_Product_QuickBuyRepository : RepositoryBase<RB_Product_QuickBuy>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Product_QuickBuy_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Product_QuickBuy_Extend dmodel)
{
string where = $" 1=1 and qb.{nameof(RB_Product_QuickBuy_Extend.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0) {
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.Id)}={dmodel.Id}";
}
if (dmodel.CategoryId > 0) {
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.CategoryId)}={dmodel.CategoryId}";
}
if (!string.IsNullOrEmpty(dmodel.CategoryName)) {
where += $@" and c.{nameof(RB_Product_Category.Name)} like '%{dmodel.CategoryName}%'";
}
string sql = $@"select qb.*,c.Name as CategoryName,c.Icon from RB_Product_QuickBuy qb
inner join rb_product_category c on qb.CategoryId=c.Id
where {where} order by qb.Sort asc,Id desc";
return GetPage<RB_Product_QuickBuy_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Product_QuickBuy_Extend> GetAllList(RB_Product_QuickBuy_Extend dmodel)
{
string where = $" 1=1 and qb.{nameof(RB_Product_QuickBuy_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.Id)}={dmodel.Id}";
}
if (dmodel.CategoryId > 0)
{
where += $@" and qb.{nameof(RB_Product_QuickBuy_Extend.CategoryId)}={dmodel.CategoryId}";
}
if (!string.IsNullOrEmpty(dmodel.CategoryName))
{
where += $@" and c.{nameof(RB_Product_Category.Name)} like '%{dmodel.CategoryName}%'";
}
string sql = $@"select qb.*,c.Name as CategoryName,c.Icon from RB_Product_QuickBuy qb
inner join rb_product_category c on qb.CategoryId=c.Id
where {where} order by qb.Sort asc,Id desc";
return Get<RB_Product_QuickBuy_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Product_QuickBuy_Extend> GetList(RB_Product_QuickBuy_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Product_QuickBuy_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Product_QuickBuy_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Product_QuickBuy_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Product_QuickBuy_Extend.Id)}={dmodel.Id}";
}
if (dmodel.CategoryId > 0)
{
where += $@" and {nameof(RB_Product_QuickBuy_Extend.CategoryId)}={dmodel.CategoryId}";
}
if (!string.IsNullOrEmpty(dmodel.CategoryName))
{
where += $@" and {nameof(RB_Product_QuickBuy_Extend.CategoryName)} like '%{dmodel.CategoryName}%'";
}
string sql = $@"select * from RB_Product_QuickBuy where {where} order by Id desc";
return Get<RB_Product_QuickBuy_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品推荐设置仓储层
/// </summary>
public class RB_Product_RecommendRepository : RepositoryBase<RB_Product_Recommend>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Product_Recommend_Extend> GetList(RB_Product_Recommend_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Product_Recommend_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Product_Recommend_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Product_Recommend_Extend.Id)}={dmodel.Id}";
}
string sql = $@"select * from RB_Product_Recommend where {where} order by Id desc";
return Get<RB_Product_Recommend_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品服务仓储层
/// </summary>
public class RB_Product_ServiceRepository : RepositoryBase<RB_Product_Service>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Product_Service_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Product_Service_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Product_Service.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and {nameof(RB_Product_Service.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
where += $@" and {nameof(RB_Product_Service.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0) {
where += $@" and {nameof(RB_Product_Service.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and {nameof(RB_Product_Service.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.IsDefault > 0) {
where += $@" and {nameof(RB_Product_Service.IsDefault)}={dmodel.IsDefault}";
}
string sql = $@"select * from RB_Product_Service where {where} order by Sort asc,Id desc";
return GetPage<RB_Product_Service_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Product_Service_Extend> GetList(RB_Product_Service_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Product_Service.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Product_Service.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Product_Service.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Product_Service.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Product_Service.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.IsDefault > 0)
{
where += $@" and {nameof(RB_Product_Service.IsDefault)}={dmodel.IsDefault}";
}
string sql = $@"select * from RB_Product_Service where {where} order by Sort asc,Id desc";
return Get<RB_Product_Service_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品规格仓储层
/// </summary>
public class RB_Product_SpecificationRepository : RepositoryBase<RB_Product_Specification>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Product_Specification_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Product_Specification_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Product_Specification.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and {nameof(RB_Product_Specification.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
where += $@" and {nameof(RB_Product_Specification.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0) {
where += $@" and {nameof(RB_Product_Specification.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and {nameof(RB_Product_Specification.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content)) {
where += $@" and {nameof(RB_Product_Specification.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"select * from RB_Product_Specification where {where} order by Id desc";
return GetPage<RB_Product_Specification_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Product_Specification_Extend> GetList(RB_Product_Specification_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Product_Specification.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Product_Specification.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Product_Specification.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and {nameof(RB_Product_Specification.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Product_Specification.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content))
{
where += $@" and {nameof(RB_Product_Specification.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"select * from RB_Product_Specification where {where} order by Id desc";
return Get<RB_Product_Specification_Extend>(sql).ToList();
}
}
}
......@@ -188,21 +188,55 @@ select * from RB_Member_User where {where} order by CreateDate desc
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";
WHERE 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";
WHERE 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";
WHERE 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>();
}
/// <summary>
/// 获取下级用户列表
/// </summary>
/// <param name="userId"></param>
/// <param name="referralsType"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetDistributorReferralsPageList(int? userId, int? referralsType, int tenantId, int mallBaseId)
{
if (referralsType == 1)
{
string sql = $@"SELECT u.* FROM rb_member_user u
WHERE u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId ={userId} order by u.CreateDate asc";
return Get<RB_Member_User_Extend>(sql).ToList();
}
else if (referralsType == 2)
{
string sql = $@"SELECT u1.* FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
WHERE u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId ={userId} order by u1.CreateDate asc";
return Get<RB_Member_User_Extend>(sql).ToList();
}
else if (referralsType == 3)
{
string sql = $@"SELECT u2.* 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.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId ={userId} order by u2.CreateDate asc";
return Get<RB_Member_User_Extend>(sql).ToList();
}
return new List<RB_Member_User_Extend>();
......
......@@ -1090,6 +1090,28 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取分销等级下拉列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDistributorGradeDropdownList()
{
var parms = RequestParm;
RB_Distributor_Grade_Extend demodel = JsonConvert.DeserializeObject<RB_Distributor_Grade_Extend>(parms.msg.ToString());
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = userModule.GetDistributorGradeDropdownList(demodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.Name,
x.Grade
}));
}
/// <summary>
/// 获取分销层级
/// </summary>
......@@ -1220,6 +1242,42 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 新增修改分销商等级启用
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetDistributorGradeEnabledStatus()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int GradeId = parms.GetInt("GradeId", 0);
if (GradeId <= 0)
{
return ApiResult.ParamIsNull("请传递等级id");
}
var model = userModule.GetDistributorGradeInfo(GradeId);
if (model == null) {
return ApiResult.ParamIsNull("信息不存在,核实后再试");
}
if (model.Enabled == 1) {
//验证是否有分销商在使用该等级
if (userModule.ValidateDistributorGradeEnabled(GradeId)) {
return ApiResult.ParamIsNull("该等级由分销商正在使用,无法停用");
}
}
bool flag = userModule.SetDistributorGradeEnabledStatus(model);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 删除会员等级
/// </summary>
......@@ -1243,6 +1301,21 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 获取分销商升级条件枚举列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDistrbutorGradeUpdateEnumList()
{
var list = EnumHelper.GetEnumList(typeof(DistrbutorGradeUpdateEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
#endregion
#region 分销商申请管理
......@@ -1291,6 +1364,34 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取分销商下线
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDistributorInfoReferralsList() {
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Distributor_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Distributor_Info_Extend>(parms.msg.ToString());
if ((demodel.UserId ?? 0) <= 0) {
return ApiResult.ParamIsNull();
}
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = userModule.GetDistributorInfoReferralsPageList(demodel);
var model = userModule.GetMemberUserInfo(demodel.UserId ?? 0);
return ApiResult.Success("", list.Select(x => new
{
DistributorName = model.Name,
demodel.ReferralsType,
x.Name,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
}));
}
/// <summary>
/// 获取分销商审核状态枚举列表
/// </summary>
......
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