新增猎头类型用户

development
温天培 12 months ago
parent 3ce6580eaa
commit 48dd3de120

@ -7,14 +7,10 @@ namespace GDZZ.Application.Entity
/// <summary> /// <summary>
/// 微信端基础用户 /// 微信端基础用户
/// </summary> /// </summary>
[SugarTable("baseuser")] [SugarTable("mini_baseuser")]
[Description("微信端基础用户")] [Description("微信端基础用户")]
public class BaseUser : DEntityBase public class BaseUser : DEntityBase
{ {
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary> /// <summary>
/// 用户类型 /// 用户类型
/// </summary> /// </summary>
@ -46,7 +42,7 @@ namespace GDZZ.Application.Entity
/// <summary> /// <summary>
/// 公司ID /// 公司ID
/// </summary> /// </summary>
public long? CompanyID { get; set; } public long CompanyID { get; set; }
/// <summary> /// <summary>
/// 描述 /// 描述
/// </summary> /// </summary>

@ -24,6 +24,10 @@ namespace GDZZ.Application
[Description("招聘者")] [Description("招聘者")]
ADVERTISE = 2, ADVERTISE = 2,
/// <summary>
/// 猎头
/// </summary>
[Description("猎头")]
HEADHUNTERS = 3
} }
} }

@ -44,11 +44,6 @@
微信端基础用户 微信端基础用户
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.Entity.BaseUser.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.BaseUser.Type"> <member name="P:GDZZ.Application.Entity.BaseUser.Type">
<summary> <summary>
用户类型 用户类型
@ -959,6 +954,11 @@
招聘者 招聘者
</summary> </summary>
</member> </member>
<member name="F:GDZZ.Application.UserEnum.HEADHUNTERS">
<summary>
猎头
</summary>
</member>
<member name="T:GDZZ.Application.Help.CacheService"> <member name="T:GDZZ.Application.Help.CacheService">
<summary> <summary>
系统缓存服务 系统缓存服务

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

Loading…
Cancel
Save