Commit 88ec1211 authored by 黄奎's avatar 黄奎

登录修改

parent f8ff82d9
...@@ -121,5 +121,10 @@ namespace Mall.Common ...@@ -121,5 +121,10 @@ namespace Mall.Common
/// SecretKey /// SecretKey
/// </summary> /// </summary>
public string SecretKey { get; set; } public string SecretKey { get; set; }
/// <summary>
/// 员工编号
/// </summary>
public int EmpId { get; set; }
} }
} }
...@@ -34,5 +34,15 @@ namespace Mall.Model.Extend.User ...@@ -34,5 +34,15 @@ namespace Mall.Model.Extend.User
return str; return str;
} }
} }
/// <summary>
/// 小程序Id【用于登录验证】
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 当前登录员工编号
/// </summary>
public int EmpId { get; set; }
} }
} }
...@@ -27,6 +27,16 @@ namespace Mall.Module.User ...@@ -27,6 +27,16 @@ namespace Mall.Module.User
return tenantRepository.GetListRepository(query); return tenantRepository.GetListRepository(query);
} }
/// <summary>
/// 根据小程序获取商户信息
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_Tenant_Extend GetTenantByMallModule(RB_Tenant_Extend query)
{
return tenantRepository.GetTenantByMallRepository(query);
}
/// <summary> /// <summary>
/// 获取商户分页列表 /// 获取商户分页列表
/// </summary> /// </summary>
......
...@@ -31,6 +31,29 @@ namespace Mall.Repository.User ...@@ -31,6 +31,29 @@ namespace Mall.Repository.User
return Get<RB_Tenant_Extend>(builder.ToString()).ToList(); return Get<RB_Tenant_Extend>(builder.ToString()).ToList();
} }
/// <summary>
/// 根据小程序获取商户信息
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_Tenant_Extend GetTenantByMallRepository(RB_Tenant_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.TenantId,B.EmpAccount AS Account,A.Name,A.MobilePhone,A.WeChatNum,A.IsEffective,A.AccountValidate,A.CreateMiniPrograme
,A.AccountStatus,B.EmpPwd AS Password,B.EmpId
FROM RB_Tenant AS A LEFT JOIN rb_employee AS B ON A.TenantId=B.TenantId
WHERE 1=1 ");
if (query != null)
{
if (query.Account != null && !string.IsNullOrEmpty(query.Account.Trim()))
{
builder.AppendFormat(" AND B.EmpAccount='{0}' ", query.Account.Trim());
}
}
return Get<RB_Tenant_Extend>(builder.ToString()).FirstOrDefault();
}
/// <summary> /// <summary>
/// 获取商户分页列表 /// 获取商户分页列表
/// </summary> /// </summary>
......
...@@ -73,7 +73,16 @@ namespace Mall.WebApi.Controllers.User ...@@ -73,7 +73,16 @@ namespace Mall.WebApi.Controllers.User
public ApiResult Login() public ApiResult Login()
{ {
var query = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString()); var query = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
var model = TenantModule.GetTenantListModule(query).FirstOrDefault(); var model = new RB_Tenant_Extend();
if (query.MallBaseId > 0)
{
model = TenantModule.GetTenantByMallModule(query);
}
else
{
model = TenantModule.GetTenantListModule(query).FirstOrDefault();
}
if (model == null) if (model == null)
{ {
return ApiResult.Failed("未找到此用户"); return ApiResult.Failed("未找到此用户");
...@@ -117,11 +126,11 @@ namespace Mall.WebApi.Controllers.User ...@@ -117,11 +126,11 @@ namespace Mall.WebApi.Controllers.User
IsEffective = model.IsEffective, IsEffective = model.IsEffective,
AccountValidate = model.AccountValidate, AccountValidate = model.AccountValidate,
CreateMiniPrograme = model.CreateMiniPrograme, CreateMiniPrograme = model.CreateMiniPrograme,
//MallName = model.MallName,
AccountStatus = model.AccountStatus, AccountStatus = model.AccountStatus,
Token = token, Token = token,
SecretKey = "", SecretKey = "",
MallBaseId = 0, MallBaseId = 0,
EmpId = model.EmpId,
}; };
UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.Mall_Login_Info + model.TenantId, obj, Config.JwtExpirTime); UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.Mall_Login_Info + model.TenantId, obj, Config.JwtExpirTime);
return ApiResult.Success("", obj); 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