|
|
|
@ -23,6 +23,7 @@ using TencentCloud.Common;
|
|
|
|
|
using Polly;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Diagnostics.Eventing.Reader;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
namespace GDZZ.Application.Service.Auth
|
|
|
|
|
{
|
|
|
|
@ -109,6 +110,7 @@ namespace GDZZ.Application.Service.Auth
|
|
|
|
|
//解析电话
|
|
|
|
|
var phoneInfo = MiniProgramUtil.AESDecrypt(phoneModel.EncryptedDataStr, tokenModel.SessionKey, phoneModel.Iv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询系统用户
|
|
|
|
|
var sysUser = this._sysUserRep.AsQueryable()
|
|
|
|
|
.Filter("TenantId", true)
|
|
|
|
@ -145,9 +147,6 @@ namespace GDZZ.Application.Service.Auth
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//区分不同类型账号
|
|
|
|
|
if (phoneModel.LogInType ==(int)UserEnum.JOB)
|
|
|
|
|
{
|
|
|
|
|
if (wxUser.IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
wxUser = await this.Baseuser.InsertReturnEntityAsync(new BaseUser()
|
|
|
|
@ -159,33 +158,32 @@ namespace GDZZ.Application.Service.Auth
|
|
|
|
|
AvatarUrl = "https://gdzongzhi.com/assets/img/logo.png",
|
|
|
|
|
Status = (int)CommonStatus.ENABLE,
|
|
|
|
|
OpenID = tokenModel.OpenId,
|
|
|
|
|
TenantId = 392820661919813,
|
|
|
|
|
Type = (int)UserEnum.JOB,
|
|
|
|
|
UserName = phoneInfo.PhoneNumber,
|
|
|
|
|
UserName = phoneModel.Phone.ToString(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
//区分账号类型
|
|
|
|
|
switch (phoneModel.LogInType)
|
|
|
|
|
{
|
|
|
|
|
case (int)UserEnum.JOB:
|
|
|
|
|
wxUser.Type = (int)UserEnum.JOB;
|
|
|
|
|
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//如果是企业账号,应该是绑定了企业租户信息
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
break;
|
|
|
|
|
case (int)UserEnum.HEADHUNTERS:
|
|
|
|
|
wxUser.Type = (int)UserEnum.HEADHUNTERS;
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
break;
|
|
|
|
|
case (int)UserEnum.ADVERTISE:
|
|
|
|
|
wxUser.Type = (int)UserEnum.ADVERTISE;
|
|
|
|
|
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
|
|
|
|
|
//企业用户情况下,允许后续补充公司信息
|
|
|
|
|
//if (wxUser.IsEmpty()|| wxUser.CompanyID.IsNullOrZero())
|
|
|
|
|
// throw Oops.Oh(ErrorCode.xg1002);
|
|
|
|
|
|
|
|
|
|
////获取公司信息
|
|
|
|
|
//company = await this.CompanyRep.SingleAsync(x=>x.Id == wxUser.CompanyID);
|
|
|
|
|
//authUserOut.companyDto = company.Adapt<CompanyDto>();
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
//获取公司信息
|
|
|
|
|
company = await this.CompanyRep.FirstOrDefaultAsync(x => x.Id == wxUser.CompanyID);
|
|
|
|
|
authUserOut.companyDto = company.Adapt<CompanyDto>();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (wxUser.IsEmpty() || sysUser.IsEmpty())
|
|
|
|
|
throw Oops.Oh(ErrorCode.xg1002);
|
|
|
|
|
//判断是否存在邀请
|
|
|
|
@ -325,10 +323,6 @@ namespace GDZZ.Application.Service.Auth
|
|
|
|
|
.Filter("TenantId", true)
|
|
|
|
|
.Where(x => x.OpenID == tokenModel.OpenId).SingleAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//区分不同类型账号
|
|
|
|
|
if (phoneModel.LogInType == (int)UserEnum.JOB)
|
|
|
|
|
{
|
|
|
|
|
if (wxUser.IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
wxUser = await this.Baseuser.InsertReturnEntityAsync(new BaseUser()
|
|
|
|
@ -340,32 +334,33 @@ namespace GDZZ.Application.Service.Auth
|
|
|
|
|
AvatarUrl = "https://gdzongzhi.com/assets/img/logo.png",
|
|
|
|
|
Status = (int)CommonStatus.ENABLE,
|
|
|
|
|
OpenID = tokenModel.OpenId,
|
|
|
|
|
TenantId = 392820661919813,
|
|
|
|
|
Type = (int)UserEnum.JOB,
|
|
|
|
|
UserName = phoneModel.Phone.ToString(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
//区分账号类型
|
|
|
|
|
switch (phoneModel.LogInType)
|
|
|
|
|
{
|
|
|
|
|
case (int)UserEnum.JOB :
|
|
|
|
|
wxUser.Type = (int)UserEnum.JOB;
|
|
|
|
|
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//如果是企业账号,应该是绑定了企业租户信息
|
|
|
|
|
if (wxUser.IsEmpty() || wxUser.CompanyID.IsNullOrZero())
|
|
|
|
|
throw Oops.Oh(ErrorCode.xg1002);
|
|
|
|
|
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
break;
|
|
|
|
|
case (int)UserEnum.HEADHUNTERS:
|
|
|
|
|
wxUser.Type = (int)UserEnum.HEADHUNTERS;
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
break;
|
|
|
|
|
case (int)UserEnum.ADVERTISE:
|
|
|
|
|
wxUser.Type = (int)UserEnum.ADVERTISE;
|
|
|
|
|
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.Baseuser.UpdateAsync(wxUser);
|
|
|
|
|
//获取公司信息
|
|
|
|
|
company = await this.CompanyRep.SingleAsync(x => x.Id == wxUser.CompanyID);
|
|
|
|
|
company = await this.CompanyRep.FirstOrDefaultAsync(x => x.Id == wxUser.CompanyID);
|
|
|
|
|
authUserOut.companyDto = company.Adapt<CompanyDto>();
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (wxUser.IsEmpty() || sysUser.IsEmpty())
|
|
|
|
|
throw Oops.Oh(ErrorCode.xg1002);
|
|
|
|
|
|
|
|
|
|