Commit c462abac authored by 吴春's avatar 吴春

提交代码

parent 4f370280
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.AppletWeChat
{
/// <summary>
/// 微信小程序基础配置
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_AppletWeChat
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
/// <summary>
/// 小程序AppId
/// </summary>
public string AppId { get; set; }
/// <summary>
/// 小程序appSecret
/// </summary>
public string AppSecret { get; set; }
/// <summary>
/// 微信支付商户号
/// </summary>
public string BusinessNO { get; set; }
/// <summary>
/// 微信支付Api密钥
/// </summary>
public string ApiSecret { get; set; }
/// <summary>
/// 微信支付apiclient_cert.pem
/// </summary>
public string ApiclientCert { get; set; }
/// <summary>
/// 微信支付apiclient_key.pem
/// </summary>
public string Apiclientkey { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.AppletWeChat
{
/// <summary>
/// 微信小程序消息通知模板
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_AppletWechat_MsgEmplate
{
public int ID { get; set; }
/// <summary>
/// 商户id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
/// <summary>
/// 下单成功提醒
/// </summary>
public string OrderSucceed { get; set; }
/// <summary>
/// 订单取消通知
/// </summary>
public string OrderCancel { get; set; }
/// <summary>
/// 订单发货通知
/// </summary>
public string OrderDeliver { get; set; }
/// <summary>
/// 退款通知
/// </summary>
public string OrderRefund { get; set; }
/// <summary>
/// 活动状态通知
/// </summary>
public string ActivityState { get; set; }
/// <summary>
/// 审核结果通知
/// </summary>
public string AuditResult { get; set; }
/// <summary>
/// 提现成功通知
/// </summary>
public string WithdrawSucceed { get; set; }
/// <summary>
/// 提现审核失败通知
/// </summary>
public string WithdrawFail { get; set; }
/// <summary>
/// 会员等级变更通知
/// </summary>
public string MemberLevel { get; set; }
}
}
......@@ -105,12 +105,12 @@ namespace Mall.Model.Entity.BaseSetUp
public string Account { get; set; }
/// <summary>
/// 是否打印商品,0-否,10
/// 是否打印商品,0-否,1是
/// </summary>
public int IsPrintGoods { get; set; }
/// <summary>
/// 是否订阅手短信,0-否,10
/// 是否订阅手短信,0-否,1是
/// </summary>
public int IsSubscribeSMS { get; set; }
......
......@@ -32,5 +32,45 @@ namespace Mall.Model.Extend.User
/// 下线数量
/// </summary>
public int? ReferralsNum { get; set; }
#region 数据统计-分销排行字段
/// <summary>
/// 累计佣金
/// </summary>
public decimal TotalCommission { get; set; }
/// <summary>
/// 已提现佣金
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 总佣金
/// </summary>
public decimal Commission { get; set; }
/// <summary>
/// 直接下级数据
/// </summary>
public int ChildrenNum { get; set; }
/// <summary>
/// 总下级数
/// </summary>
public int AllChildrenNum { get; set; }
/// <summary>
/// 订单数
/// </summary>
public int AllOrderNum { get; set; }
/// <summary>
/// 排序
/// </summary>
public string OrderBy { get; set; }
#endregion
}
}
using Mall.Model.Entity.AppletWeChat;
using Mall.Repository.AppletWeChat;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Module.AppletWeChat
{
public class AppletWeChatModule
{
private RB_AppletWeChatRepository appletWeChatRepository = new RB_AppletWeChatRepository();
private RB_AppletWechat_MsgEmplateRepository msgEmplateRepository = new RB_AppletWechat_MsgEmplateRepository();
#region 微信小程序基础配置
/// <summary>
/// 获取微信基础配置
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_AppletWeChat> GetAppletWeChatList(RB_AppletWeChat query)
{
return appletWeChatRepository.GetAppletWeChatList(query);
}
/// <summary>
/// 新增微信小程序配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool AddOrUpdateAppletWeChat(RB_AppletWeChat model)
{
if (model.ID == 0)
{
return appletWeChatRepository.Insert(model) > 0;
}
else
{
return appletWeChatRepository.Update(model);
}
}
#endregion
#region 微信小程序消息模板
/// <summary>
/// 获取微信小程序消息配置
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_AppletWechat_MsgEmplate> GetMsgEmplateList(RB_AppletWechat_MsgEmplate query)
{
return msgEmplateRepository.GetMsgEmplateList(query);
}
/// <summary>
/// 新增/修改微信小程序消息配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool AddOrUpdateMsgEmplate(RB_AppletWechat_MsgEmplate model)
{
if (model.ID == 0)
{
return msgEmplateRepository.Insert(model) > 0;
}
else
{
return msgEmplateRepository.Update(model);
}
}
#endregion
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
</ItemGroup>
</Project>
......@@ -499,9 +499,13 @@ namespace Mall.Module.BaseSetUp
public RB_Logistics_Rules_Extend GetPinkageModel(RB_Logistics_Rules_Extend query)
{
RB_Logistics_Rules_Extend model = logisticsRulesRepository.GetLogisticsRulesList(query).FirstOrDefault();
List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = query.TenantId, RulesType = query.RulesType, MallBaseId = query.MallBaseId, RulesPriceId = model.ID });
model.List = new List<RB_Logistics_RulesRegion_Extend>();
model.List = listLogisticsRulesRegion;
if (model!=null)
{
List<RB_Logistics_RulesRegion_Extend> listLogisticsRulesRegion = logisticsRulesRegionRepository.GetListRepository(new RB_Logistics_RulesRegion_Extend { TenantId = query.TenantId, RulesType = query.RulesType, MallBaseId = query.MallBaseId, RulesPriceId = model.ID });
model.List = new List<RB_Logistics_RulesRegion_Extend>();
model.List = listLogisticsRulesRegion;
}
return model;
}
......
......@@ -788,7 +788,8 @@ namespace Mall.Module.User
{
return false;
}
if (model.Enabled == 1 && demodel.Enabled == 2) {
if (model.Enabled == 1 && demodel.Enabled == 2)
{
//验证是否有分销商在使用该等级
if (ValidateDistributorGradeEnabled(model.Id))
{
......@@ -1508,5 +1509,31 @@ namespace Mall.Module.User
}
return flag ? "" : "操作失败";
}
#region 数据统计-分销排行
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetRankingListPage(int pageIndex, int pageSize, out long rowCount, RB_Member_User_Extend dmodel)
{
return member_UserRepository.GetRankingListPage(pageIndex, pageSize, out rowCount, dmodel);
}
/// <summary>
/// 获取全部分销商信息
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetRankingList(RB_Member_User_Extend dmodel)
{
return member_UserRepository.GetRankingList(dmodel);
}
#endregion
}
}
using Mall.Model.Entity.AppletWeChat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.AppletWeChat
{
/// <summary>
/// 微信小程序基础配置
/// </summary>
public class RB_AppletWeChatRepository : RepositoryBase<RB_AppletWeChat>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_AppletWeChat); } }
/// <summary>
/// 获取微信基础配置
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_AppletWeChat> GetAppletWeChatList(RB_AppletWeChat query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE 1=1 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_AppletWeChat.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_AppletWeChat.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_AppletWeChat.MallBaseId)}={query.MallBaseId}");
}
}
return Get<RB_AppletWeChat>(builder.ToString()).ToList();
}
}
}
using Mall.Model.Entity.AppletWeChat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.AppletWeChat
{
/// <summary>
/// 微信小程序消息模板仓储层
/// </summary>
public class RB_AppletWechat_MsgEmplateRepository : RepositoryBase<RB_AppletWechat_MsgEmplate>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_AppletWechat_MsgEmplate); } }
/// <summary>
/// 获取微信小程序消息模板
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_AppletWechat_MsgEmplate> GetMsgEmplateList(RB_AppletWechat_MsgEmplate query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE 1=1 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_AppletWechat_MsgEmplate.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_AppletWechat_MsgEmplate.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_AppletWechat_MsgEmplate.MallBaseId)}={query.MallBaseId}");
}
}
return Get<RB_AppletWechat_MsgEmplate>(builder.ToString()).ToList();
}
}
}
......@@ -23,6 +23,11 @@ namespace Mall.Repository.BaseSetUp
/// </summary>
public string DestinationTableName { get { return nameof(RB_Destination); } }
// <summary>
/// 表名称
/// </summary>
public string ExpressTableName { get { return nameof(RB_Logistics_Express); } }
/// <summary>
///电子面单列表
/// </summary>
......@@ -34,10 +39,12 @@ namespace Mall.Repository.BaseSetUp
public List<RB_ElectronicSheet_Extend> GetElectronicSheetPage(int pageIndex, int pageSize, out long rowCount, RB_ElectronicSheet_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName FROM {TableName} as a
builder.Append(@$" SELECT a.*,b.`Name` as ProvinceName,c.`Name` as CityName,d.`Name` as DistrictName,e.`Name` as ExpressName FROM {TableName} as a
LEFT JOIN {DestinationTableName} as b on a.ProvinceId = b.ID
LEFT JOIN {DestinationTableName} as c on a.CityId = c.ID
LEFT JOIN {DestinationTableName} as d on a.DistrictId = d.ID WHERE a.{nameof(RB_ElectronicSheet_Extend.Status)}=0");
LEFT JOIN {DestinationTableName} as d on a.DistrictId = d.ID
LEFT JOIN {ExpressTableName} as e on a.ExpressId=e.id
WHERE a.{nameof(RB_ElectronicSheet_Extend.Status)}=0");
if (query != null)
{
// where += $@" and {nameof(RB_Customer_InfoCreate.CustomerId)}={dmodel.CustomerId}";
......
......@@ -241,5 +241,139 @@ WHERE u.TenantId={tenantId} and u.MallBaseId={mallBaseId} and u.SuperiorId ={use
}
return new List<RB_Member_User_Extend>();
}
#region 数据统计-分销排行
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetRankingListPage(int pageIndex, int pageSize, out long rowCount, 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 (string.IsNullOrWhiteSpace(dmodel.OrderBy))
{
dmodel.OrderBy = " Id asc";
}
string sql = $@" select * from ( SELECT a.Id,a.Source,a.`Name`,a.AliasName,a.Photo, b.TotalCommission,b.Price,c.Commission,d.ChildrenNum,
(SELECT COUNT(*) from rb_member_user where FIND_IN_SET( Id ,(SELECT GetMemberChildrenList(a.Id)))) as AllChildrenNum ,
(SELECT COUNT(*) from rb_goods_order where OrderStatus!=7 and FIND_IN_SET( UserId ,(SELECT GetMemberChildrenList(a.Id)))) as OrderNum
from rb_member_user as a
LEFT JOIN (SELECT UserId,MAX(TotalCommission) as TotalCommission,SUM(IFNULL(TotalCommission,0)-IFNULL(CommissionWithdrawal,0)) as Price from rb_distributor_info GROUP BY UserId) as b on a.Id=b.UserId
LEFT JOIN
(SELECT goc.UserId,SUM(Commission) as Commission from rb_goods_ordercommission as goc
LEFT JOIN rb_goods_order go on goc.OrderId=go.OrderId where go.OrderStatus!=7 GROUP BY goc.UserId) as c on a.Id=c.UserId
LEFT JOIN (SELECT SuperiorId,COUNT(SuperiorId) as ChildrenNum from rb_member_user GROUP BY SuperiorId) as d on d.SuperiorId=a.Id) as t order by {dmodel.OrderBy} ";
return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetRankingList( 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 (string.IsNullOrWhiteSpace(dmodel.OrderBy))
{
dmodel.OrderBy = " Id asc";
}
string sql = $@" select * from ( SELECT a.Id,a.Source,a.`Name`,a.AliasName,a.Photo, b.TotalCommission,b.Price,c.Commission,d.ChildrenNum,
(SELECT COUNT(*) from rb_member_user where FIND_IN_SET( Id ,(SELECT GetMemberChildrenList(a.Id)))) as AllChildrenNum ,
(SELECT COUNT(*) from rb_goods_order where OrderStatus!=7 and FIND_IN_SET( UserId ,(SELECT GetMemberChildrenList(a.Id)))) as AllOrderNum
from rb_member_user as a
LEFT JOIN (SELECT UserId,MAX(TotalCommission) as TotalCommission,SUM(IFNULL(TotalCommission,0)-IFNULL(CommissionWithdrawal,0)) as Price from rb_distributor_info GROUP BY UserId) as b on a.Id=b.UserId
LEFT JOIN
(SELECT goc.UserId,SUM(Commission) as Commission from rb_goods_ordercommission as goc
LEFT JOIN rb_goods_order go on goc.OrderId=go.OrderId where go.OrderStatus!=7 GROUP BY goc.UserId) as c on a.Id=c.UserId
LEFT JOIN (SELECT SuperiorId,COUNT(SuperiorId) as ChildrenNum from rb_member_user GROUP BY SuperiorId) as d on d.SuperiorId=a.Id) as t order by {dmodel.OrderBy} ";
return Get<RB_Member_User_Extend>(sql).ToList();
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Module.AppletWeChat;
using Mall.Model.Entity.AppletWeChat;
namespace Mall.WebApi.Controllers.AppletWeChat
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletWeChatController : BaseController
{
private AppletWeChatModule appletWeChatModule = new AppletWeChatModule();
#region 微信小程序基础配置
/// <summary>
/// 新增/修改微信小程序基础配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult AddOrUpdateAppletWeChat()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_AppletWeChat>(RequestParm.msg.ToString());
query.MallBaseId = parms.MallBaseId;
if (query == null)
{
return ApiResult.Failed("请传入操作的小程序配置");
}
else
{
if (string.IsNullOrWhiteSpace(query.AppId))
{
return ApiResult.Failed("请输入小程序AppId");
}
if (string.IsNullOrWhiteSpace(query.AppSecret))
{
return ApiResult.Failed("请输入小程序appSecret");
}
if (string.IsNullOrWhiteSpace(query.BusinessNO))
{
return ApiResult.Failed("请输入微信支付商户号");
}
if (string.IsNullOrWhiteSpace(query.ApiSecret))
{
return ApiResult.Failed("请输入微信支付Api密钥");
}
query.TenantId = UserInfo.TenantId;
bool result = appletWeChatModule.AddOrUpdateAppletWeChat(query);
if (result)
{
return ApiResult.Success("基础信息保存成功");
}
else
{
return ApiResult.Failed("基础信息保存失败");
}
}
}
/// <summary>
/// 获取微信小程序基础信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletWeChatInfo()
{
var parms = RequestParm;
var query = new RB_AppletWeChat();
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var model = appletWeChatModule.GetAppletWeChatList(query).FirstOrDefault();
if (model == null)
{
model = new RB_AppletWeChat();
}
return ApiResult.Success("获取成功", model);
}
#endregion
#region 微信小程序消息模板
/// <summary>
/// 新增/修改微信小程序消息模板
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult AddOrUpdateMsgEmplate()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_AppletWechat_MsgEmplate>(RequestParm.msg.ToString());
query.MallBaseId = parms.MallBaseId;
if (query == null)
{
return ApiResult.Failed("请传入消息通知信息");
}
else
{
query.TenantId = UserInfo.TenantId;
bool result = appletWeChatModule.AddOrUpdateMsgEmplate(query);
if (result)
{
return ApiResult.Success("消息通知配置保存成功");
}
else
{
return ApiResult.Failed("消息通知配置保存失败");
}
}
}
/// <summary>
/// 获取微信小程序消息模板信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMsgEmplateInfo()
{
var parms = RequestParm;
var query = new RB_AppletWechat_MsgEmplate();
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var model = appletWeChatModule.GetMsgEmplateList(query).FirstOrDefault();
if (model == null)
{
model = new RB_AppletWechat_MsgEmplate();
}
return ApiResult.Success("获取成功", model);
}
#endregion
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace Mall.WebApi.Controllers.MallBase
private Module.User.TenantModule TenantModule = new Module.User.TenantModule();
#region 基础设置
[HttpPost]
public ApiResult AddOrUpdateMallBase()
{
var parms = RequestParm;
......@@ -42,32 +43,32 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed("请输入商城名称");
}
query.TenantId = UserInfo.TenantId;
if (query.ID == 0)//新增
{
var TenantModel = TenantModule.GetTenantModule(query.TenantId);
if (TenantModel == null)
{
return ApiResult.Failed("请确保商户信息正确");
}
if (TenantModel.AccountStatus != 2)
{
return ApiResult.Failed("商户状态审核不通过");
}
if (TenantModel.IsEffective == 0 && TenantModel.AccountValidate.HasValue && TenantModel.AccountValidate.Value < System.DateTime.Now)
{
return ApiResult.Failed("商户账号已过期");
}
//判断当前商户下面有多少小程序
if (TenantModel.CreateMiniPrograme.HasValue)
{
var oldList = mallBaseModule.GetListRepository(query);
if (oldList.Count() >= TenantModel.CreateMiniPrograme.Value)
{
return ApiResult.Failed("商户可建小程序数:" + TenantModel.CreateMiniPrograme.Value);
}
}
}
//if (query.ID == 0)//新增
//{
// var TenantModel = TenantModule.GetTenantModule(query.TenantId);
// if (TenantModel == null)
// {
// return ApiResult.Failed("请确保商户信息正确");
// }
// if (TenantModel.AccountStatus != 2)
// {
// return ApiResult.Failed("商户状态审核不通过");
// }
// if (TenantModel.IsEffective == 0 && TenantModel.AccountValidate.HasValue && TenantModel.AccountValidate.Value < System.DateTime.Now)
// {
// return ApiResult.Failed("商户账号已过期");
// }
// //判断当前商户下面有多少小程序
// if (TenantModel.CreateMiniPrograme.HasValue)
// {
// var oldList = mallBaseModule.GetListRepository(query);
// if (oldList.Count() >= TenantModel.CreateMiniPrograme.Value)
// {
// return ApiResult.Failed("商户可建小程序数:" + TenantModel.CreateMiniPrograme.Value);
// }
// }
//}
bool result = mallBaseModule.AddOrUpdateMallBase(query);
if (result)
{
......@@ -82,6 +83,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
[HttpPost]
public ApiResult GetMallBaseInfo()
{
var parms = RequestParm;
......@@ -106,6 +108,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// 根据商户号获取物流信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetLogistics()
{
var parms = RequestParm;
......@@ -124,6 +127,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// 保存物流信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult AddOrUpdateLogistics()
{
var parms = RequestParm;
......@@ -242,6 +246,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// 保存物流信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult AddOrUpdateLogisticsRules()
{
var parms = RequestParm;
......@@ -289,6 +294,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
[HttpPost]
public ApiResult DelRules()
{
var parms = RequestParm;
......@@ -655,7 +661,7 @@ namespace Mall.WebApi.Controllers.MallBase
var query = new RB_Logistics_Rules_Extend();
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.OpenMinPrice;
query.RulesType = Common.Enum.MallBase.RulesTypeEnum.AreaBuy;
var model = mallBaseModule.GetPinkageModel(query);
return ApiResult.Success("获取成功", model);
}
......@@ -678,13 +684,13 @@ namespace Mall.WebApi.Controllers.MallBase
}
else
{
if (query.IsOpenAllRegionPrice == 0)
{
if (query.List == null || !query.List.Any())
{
return ApiResult.Failed("请选择地区");
}
}
//if (query.IsOpenAllRegionPrice ==1)
//{
// if (query.List == null || !query.List.Any())
// {
// return ApiResult.Failed("请选择地区");
// }
//}
if (query.ID == 0)
{
......@@ -743,6 +749,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
x.ID,
x.Name,
x.Account,
x.Mobile,
Address = x.ProvinceName + x.CityName + x.DistrictName + x.Address,
x.IsDefault,
......
......@@ -1263,12 +1263,15 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("请传递等级id");
}
var model = userModule.GetDistributorGradeInfo(GradeId);
if (model == null) {
if (model == null)
{
return ApiResult.ParamIsNull("信息不存在,核实后再试");
}
if (model.Enabled == 1) {
if (model.Enabled == 1)
{
//验证是否有分销商在使用该等级
if (userModule.ValidateDistributorGradeEnabled(GradeId)) {
if (userModule.ValidateDistributorGradeEnabled(GradeId))
{
return ApiResult.ParamIsNull("该等级由分销商正在使用,无法停用");
}
}
......@@ -1378,12 +1381,14 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDistributorInfoReferralsList() {
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) {
if ((demodel.UserId ?? 0) <= 0)
{
return ApiResult.ParamIsNull();
}
......@@ -1391,7 +1396,7 @@ namespace Mall.WebApi.Controllers.MallBase
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,
......@@ -1884,5 +1889,102 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 数据统计-分销排行
[HttpPost]
public ApiResult GetRankingListPage()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Member_User_Extend demodel = JsonConvert.DeserializeObject<RB_Member_User_Extend>(parms.msg.ToString());
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = userModule.GetRankingListPage(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.AliasName,
x.Photo,
x.Price,
x.Source,
x.ChildrenNum,
x.AllChildrenNum,
x.AllOrderNum,
x.Commission,
x.TotalCommission
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 导出分销排行
/// </summary>
[HttpPost]
public FileContentResult GetRankingListToExcel()
{
var parms = RequestParm;
RB_Member_User_Extend demodel = JsonConvert.DeserializeObject<RB_Member_User_Extend>(parms.msg.ToString());
string ExcelName = "分销排行" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
List<ExcelDataSource> slist = new List<ExcelDataSource>();
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "ID") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "分销商") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "直接下级数量") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "总下级数量") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "分销商订单数") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "总佣金") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "累计佣金") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "已提现佣金") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
},
};
slist.Add(header);
try
{
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = userModule.GetRankingList(demodel);
#region 组装数据
int Num = 0;
foreach (var item in list)
{
Num++;
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value:Num.ToString()){ },
}
};
datarow.ExcelRows.Add(new ExcelColumn(value: item.Id.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.AliasName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.ChildrenNum.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.AllChildrenNum.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.AllOrderNum.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.Commission.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.TotalCommission.ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.Price.ToString()) { });
slist.Add(datarow);
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("GetFileFromWebApi_requestData: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
#endregion
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Module.AppletWeChat\Mall.Module.AppletWeChat.csproj" />
<ProjectReference Include="..\Mall.Module.BaseSetUp\Mall.Module.BaseSetUp.csproj" />
<ProjectReference Include="..\Mall.Module.MarketingCenter\Mall.Module.MarketingCenter.csproj" />
<ProjectReference Include="..\Mall.Module.Product\Mall.Module.Product.csproj" />
......
......@@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mall.Module.BaseSetUp", "Ma
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mall.Module.Product", "Mall.Module.Product\Mall.Module.Product.csproj", "{D0386A52-CAFD-40B3-A515-9A9241189FBA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mall.Module.MarketingCenter", "Mall.Module.MarketingCenter\Mall.Module.MarketingCenter.csproj", "{339DE5B1-FA62-4B3D-80D4-0C50398D2848}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mall.Module.MarketingCenter", "Mall.Module.MarketingCenter\Mall.Module.MarketingCenter.csproj", "{339DE5B1-FA62-4B3D-80D4-0C50398D2848}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mall.Module.AppletWeChat", "Mall.Module.AppletWeChat\Mall.Module.AppletWeChat.csproj", "{FAC1610E-069C-4E3D-8B65-EFF375F15342}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -95,6 +97,10 @@ Global
{339DE5B1-FA62-4B3D-80D4-0C50398D2848}.Debug|Any CPU.Build.0 = Debug|Any CPU
{339DE5B1-FA62-4B3D-80D4-0C50398D2848}.Release|Any CPU.ActiveCfg = Release|Any CPU
{339DE5B1-FA62-4B3D-80D4-0C50398D2848}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC1610E-069C-4E3D-8B65-EFF375F15342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC1610E-069C-4E3D-8B65-EFF375F15342}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC1610E-069C-4E3D-8B65-EFF375F15342}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC1610E-069C-4E3D-8B65-EFF375F15342}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -112,6 +118,7 @@ Global
{9C400D7F-2BE2-40E7-B179-498097AA00AB} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
{D0386A52-CAFD-40B3-A515-9A9241189FBA} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
{339DE5B1-FA62-4B3D-80D4-0C50398D2848} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
{FAC1610E-069C-4E3D-8B65-EFF375F15342} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {450F460D-A6AE-4FE3-948A-34E5FB8DBD7C}
......
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