Commit 6bac38c9 authored by 吴春's avatar 吴春

提交代码

parent 48ab28ce
......@@ -127,20 +127,20 @@ namespace Mall.Common
/// </summary>
public int EmpId { get; set; }
//public string erptoken { get; set; }
///// <summary>
///// erp用户id
///// </summary>
//public int ERPEmpId { get; set; }
///// <summary>
///// erp公司id
///// </summary>
//public int ERPBranchId { get; set; }
///// <summary>
///// erp集团id
///// </summary>
//public int ERPGroupId { get; set; }
public string erptoken { get; set; }
/// <summary>
/// erp用户id
/// </summary>
public int ERPEmpId { get; set; }
/// <summary>
/// erp公司id
/// </summary>
public int ERPBranchId { get; set; }
/// <summary>
/// erp集团id
/// </summary>
public int ERPGroupId { 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_FXCommission
{
/// <summary>
/// Id
/// </summary>
public int ID
{
get;
set;
}
/// <summary>
/// 等级ID
/// </summary>
public int FXGradeId
{
get;
set;
}
/// <summary>
/// 返佣等级ID
/// </summary>
public int CommissionGradeId
{
get;
set;
}
/// <summary>
/// 等级类型,-直接,2-间接
/// </summary>
public int GradeType
{
get;
set;
}
/// <summary>
/// 返佣金额
/// </summary>
public decimal? CommissionPrice
{
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.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 粉象返佣等级扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Distributor_FXCommission_Extend : RB_Distributor_FXCommission
{
/// <summary>
/// GradeName
/// </summary>
public string GradeName
{
get;
set;
}
}
}
......@@ -17,5 +17,11 @@ namespace Mall.Model.Extend.User
/// ids
/// </summary>
public string GradeIds { get; set; }
/// <summary>
/// 返佣佣金
/// </summary>
public List<RB_Distributor_FXCommission_Extend> FXCommissionList { get; set; }
}
}
......@@ -2291,7 +2291,7 @@ namespace Mall.Module.Product
var categoryList = clist.Where(x => x.GoodsId == item.GoodsId).ToList();
item.InventoryNum = gmodel.InventoryNum ?? 0;
item.CostMoney = gmodel.CostPrice ?? 0;
item.CostMoney = gmodel.CostPrice ?? 0;//(gmodel.IsCustomSpecification==2)?(gmodel.CostPrice ?? 0):(speciPList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationSort == item.SpecificationSort).FirstOrDefault().CostMoney);
item.ProductCode = gmodel.GoodsNumbers;
item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList();
int GoodsWeight = gmodel.GoodsWeight ?? 0;//商品重量
......
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mall.Repository.User
{
public class RB_Distributor_FXCommissionRepository : RepositoryBase<RB_Distributor_FXCommission>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_Distributor_FXCommission); } }
/// <summary>
/// 卡券信息列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_FXCommission_Extend> GetCouponPageList(int pageIndex, int pageSize, out long rowCount, RB_Distributor_FXCommission_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Distributor_FXCommission_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.FXGradeId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.FXGradeId)}={query.FXGradeId}");
}
}
return GetPage<RB_Distributor_FXCommission_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 卡券信息列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Distributor_FXCommission_Extend> GetCouponList(RB_Distributor_FXCommission_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Distributor_FXCommission_Extend.Status)}=0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.FXGradeId > 0)
{
builder.Append($" AND {nameof(RB_Distributor_FXCommission_Extend.FXGradeId)}={query.FXGradeId}");
}
}
return Get<RB_Distributor_FXCommission_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -77,7 +77,7 @@ namespace Mall.WebApi.Controllers.User
private ProductModule productModule = new ProductModule();
//private Module.Property.AuthorizeModule authorizeModule = new Module.Property.AuthorizeModule();
private Module.Property.AuthorizeModule authorizeModule = new Module.Property.AuthorizeModule();
#region 商户信息
[AllowAnonymous]
......@@ -115,63 +115,63 @@ namespace Mall.WebApi.Controllers.User
#region add by:W 2020-07-06 erp授权信息
//var erpUserInfo = new Mall.Model.Entity.Property.RB_Employee();
//string erptoken = "";
//if (model.EmpId > 0)
//{
// //判断当前登录人是否有erp账号信息
// var authorizeModel = authorizeModule.GetAuthorizeList(new Model.Extend.Property.RB_ERP_Authorize_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, MallUserId = model.EmpId, Type = 1 }).FirstOrDefault();
// if (authorizeModel != null && authorizeModel.Status == 2)
// {
// //先查询是否存在是否是登陆手机号登陆
// erpUserInfo = authorizeModule.GetByLoginMobileAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
// if (erpUserInfo == null)
// {
// //再查询是否存在是否是账号登陆
// erpUserInfo = authorizeModule.GetNewByAccountAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
// }
// if (erpUserInfo != null && !string.IsNullOrWhiteSpace(erpUserInfo.EmLoginMobile) && erpUserInfo.IsLeave == 0)
// {
// TokenUserInfo erpUserInfoToken = new TokenUserInfo { uid = erpUserInfo.EmployeeId.ToString(), requestFrom = Common.Enum.ApiRequestFromEnum.ERP };
// #region JWT
// IDateTimeProvider erpprovider = new UtcDateTimeProvider();
// var erpnow = erpprovider.GetNow().AddMinutes(-1);
// var erpunixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
// var erpsecondsSinceEpoch = Math.Round((erpnow - erpunixEpoch).TotalSeconds);
// var erppayload = new Dictionary<string, object>
// {
// {"iat",erpsecondsSinceEpoch },
// {"exp",erpsecondsSinceEpoch+Config.JwtExpirTime},
// {"userInfo",erpUserInfoToken }
// };
// IJwtAlgorithm erpalgorithm = new HMACSHA256Algorithm();
// IJsonSerializer erpserializer = new JsonNetSerializer();
// IBase64UrlEncoder erpurlEncoder = new JwtBase64UrlEncoder();
// IJwtEncoder erpencoder = new JwtEncoder(erpalgorithm, erpserializer, erpurlEncoder);
// string erpsecret = Config.JwtSecretKey;
// erptoken = erpencoder.Encode(erppayload, erpsecret);
// #endregion
// //ERPUserInfo erpObj = new ERPUserInfo
// //{
// // Domain = authorizeModel.DomainName,
// // emName = erpUserInfo.EmName,
// // EmployeeId = erpUserInfo.EmployeeId,
// // RB_Group_id = erpUserInfo.RB_Group_id,
// // RB_Branch_id = erpUserInfo.RB_Branch_id,
// // RB_Post_Id = erpUserInfo.RB_Post_Id,
// // RB_Department_Id = erpUserInfo.RB_Department_Id,
// // token = erptoken,
// // SecretKey = erpUserInfo.SecretKey,
// // //ImAccount = imAccount?.AccID ?? model.EmLoginMobile, //model.EmLoginMobile,
// // //ImToken = IMService.DefaultPassword(),
// //};
// //UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.ERP_Login_Info_+ erpUserInfo.EmployeeId, erpObj, Config.JwtExpirTime);
// }
// }
//}
var erpUserInfo = new Mall.Model.Entity.Property.RB_Employee();
string erptoken = "";
if (model.EmpId > 0)
{
//判断当前登录人是否有erp账号信息
var authorizeModel = authorizeModule.GetAuthorizeList(new Model.Extend.Property.RB_ERP_Authorize_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, MallUserId = model.EmpId, Type = 1 }).FirstOrDefault();
if (authorizeModel != null && authorizeModel.Status == 2)
{
//先查询是否存在是否是登陆手机号登陆
erpUserInfo = authorizeModule.GetByLoginMobileAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
if (erpUserInfo == null)
{
//再查询是否存在是否是账号登陆
erpUserInfo = authorizeModule.GetNewByAccountAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
}
if (erpUserInfo != null && !string.IsNullOrWhiteSpace(erpUserInfo.EmLoginMobile) && erpUserInfo.IsLeave == 0)
{
TokenUserInfo erpUserInfoToken = new TokenUserInfo { uid = erpUserInfo.EmployeeId.ToString(), requestFrom = Common.Enum.ApiRequestFromEnum.ERP };
#region JWT
IDateTimeProvider erpprovider = new UtcDateTimeProvider();
var erpnow = erpprovider.GetNow().AddMinutes(-1);
var erpunixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var erpsecondsSinceEpoch = Math.Round((erpnow - erpunixEpoch).TotalSeconds);
var erppayload = new Dictionary<string, object>
{
{"iat",erpsecondsSinceEpoch },
{"exp",erpsecondsSinceEpoch+Config.JwtExpirTime},
{"userInfo",erpUserInfoToken }
};
IJwtAlgorithm erpalgorithm = new HMACSHA256Algorithm();
IJsonSerializer erpserializer = new JsonNetSerializer();
IBase64UrlEncoder erpurlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder erpencoder = new JwtEncoder(erpalgorithm, erpserializer, erpurlEncoder);
string erpsecret = Config.JwtSecretKey;
erptoken = erpencoder.Encode(erppayload, erpsecret);
#endregion
//ERPUserInfo erpObj = new ERPUserInfo
//{
// Domain = authorizeModel.DomainName,
// emName = erpUserInfo.EmName,
// EmployeeId = erpUserInfo.EmployeeId,
// RB_Group_id = erpUserInfo.RB_Group_id,
// RB_Branch_id = erpUserInfo.RB_Branch_id,
// RB_Post_Id = erpUserInfo.RB_Post_Id,
// RB_Department_Id = erpUserInfo.RB_Department_Id,
// token = erptoken,
// SecretKey = erpUserInfo.SecretKey,
// //ImAccount = imAccount?.AccID ?? model.EmLoginMobile, //model.EmLoginMobile,
// //ImToken = IMService.DefaultPassword(),
//};
//UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.ERP_Login_Info_+ erpUserInfo.EmployeeId, erpObj, Config.JwtExpirTime);
}
}
}
#endregion
......@@ -210,10 +210,10 @@ namespace Mall.WebApi.Controllers.User
SecretKey = "",
MallBaseId = 0,
EmpId = model.EmpId,
//erptoken = erptoken,
//ERPEmpId = erpUserInfo.EmployeeId,
//ERPBranchId = erpUserInfo.RB_Branch_id,
//ERPGroupId = erpUserInfo.RB_Group_id
erptoken = erptoken,
ERPEmpId = erpUserInfo.EmployeeId,
ERPBranchId = erpUserInfo.RB_Branch_id,
ERPGroupId = erpUserInfo.RB_Group_id
};
UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.Mall_Login_Info + model.TenantId, obj, Config.JwtExpirTime);
return ApiResult.Success("", obj);
......
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