user
This commit is contained in:
parent
de51e13976
commit
c6551e5eab
@ -162,12 +162,29 @@ namespace YD_WeChatApplet.Services
|
||||
|
||||
private async Task<UserModelDataDto> GetParentUser(LoginInfo paramDto)
|
||||
{
|
||||
//var parentUser = await _smartSportsContext.Student
|
||||
// .FirstOrDefaultAsync(x => x.StudentName == paramDto.Key && x.StudentNo == paramDto.Password && x.StudentStatus == 1);
|
||||
|
||||
var parentUser = await _smartSportsContext.Student
|
||||
.FirstOrDefaultAsync(x => x.StudentName == paramDto.Key && x.StudentNo == paramDto.Password && x.StudentStatus == 1);
|
||||
.Join(_smartSportsContext.School, t => t.SchoolCode, s => s.SchoolCode, (t, s) => new
|
||||
{
|
||||
t.Id,
|
||||
t.ParentPhoneNo,
|
||||
t.StudentNo,
|
||||
t.StudentName,
|
||||
t.HomeAddress,
|
||||
t.SchoolCode,
|
||||
t.Sex,
|
||||
t.Photo,
|
||||
t.StudentStatus,
|
||||
s.SchoolType
|
||||
}).FirstOrDefaultAsync(x => x.StudentName == paramDto.Key && x.StudentNo == paramDto.Password && x.StudentStatus == 1);
|
||||
|
||||
if (parentUser == null)
|
||||
return null;
|
||||
|
||||
if (parentUser.SchoolType == 1)
|
||||
{
|
||||
return new UserModelDataDto
|
||||
{
|
||||
PhoneNo = parentUser.ParentPhoneNo,
|
||||
@ -183,6 +200,24 @@ namespace YD_WeChatApplet.Services
|
||||
RelevanceId = Guid.NewGuid()
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new UserModelDataDto
|
||||
{
|
||||
PhoneNo = parentUser.ParentPhoneNo,
|
||||
UserPwd = parentUser.StudentNo,
|
||||
UserName = parentUser.StudentName,
|
||||
UserTrueName = parentUser.StudentName,
|
||||
Gender = parentUser.Sex,
|
||||
HeadImageUrl = parentUser.Photo,
|
||||
Address = parentUser.HomeAddress,
|
||||
SchoolCode = parentUser.SchoolCode,
|
||||
RoleName = "家长",
|
||||
RoleId = 5,
|
||||
RelevanceId = Guid.NewGuid()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private User CreateUserModel(UserModelDataDto userData)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user