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

登录修改

parent f8ff82d9
......@@ -121,5 +121,10 @@ namespace Mall.Common
/// SecretKey
/// </summary>
public string SecretKey { get; set; }
/// <summary>
/// 员工编号
/// </summary>
public int EmpId { get; set; }
}
}
......@@ -34,5 +34,15 @@ namespace Mall.Model.Extend.User
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
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>
......
......@@ -31,6 +31,29 @@ namespace Mall.Repository.User
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>
......
......@@ -73,7 +73,16 @@ namespace Mall.WebApi.Controllers.User
public ApiResult Login()
{
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)
{
return ApiResult.Failed("未找到此用户");
......@@ -117,11 +126,11 @@ namespace Mall.WebApi.Controllers.User
IsEffective = model.IsEffective,
AccountValidate = model.AccountValidate,
CreateMiniPrograme = model.CreateMiniPrograme,
//MallName = model.MallName,
AccountStatus = model.AccountStatus,
Token = token,
SecretKey = "",
MallBaseId = 0,
EmpId = model.EmpId,
};
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