新增猎头类型用户

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

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

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

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

@ -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,47 +147,43 @@ namespace GDZZ.Application.Service.Auth
});
}
//区分不同类型账号
if (phoneModel.LogInType ==(int)UserEnum.JOB)
if (wxUser.IsEmpty())
{
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;
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
}
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,
UserName = phoneModel.Phone.ToString(),
});
}
else
//区分账号类型
switch (phoneModel.LogInType)
{
//如果是企业账号,应该是绑定了企业租户信息
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>();
case (int)UserEnum.JOB:
wxUser.Type = (int)UserEnum.JOB;
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;
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,47 +323,44 @@ namespace GDZZ.Application.Service.Auth
.Filter("TenantId", true)
.Where(x => x.OpenID == tokenModel.OpenId).SingleAsync();
//区分不同类型账号
if (phoneModel.LogInType == (int)UserEnum.JOB)
if (wxUser.IsEmpty())
{
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 = phoneModel.Phone.ToString(),
});
}
else
{
wxUser.Type = (int)UserEnum.JOB;
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
}
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,
UserName = phoneModel.Phone.ToString(),
});
}
else
//区分账号类型
switch (phoneModel.LogInType)
{
//如果是企业账号,应该是绑定了企业租户信息
if (wxUser.IsEmpty() || wxUser.CompanyID.IsNullOrZero())
throw Oops.Oh(ErrorCode.xg1002);
wxUser.Type = (int)UserEnum.ADVERTISE;
var bsUser = await this.Baseuser.UpdateAsync(wxUser);
case (int)UserEnum.JOB :
wxUser.Type = (int)UserEnum.JOB;
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;
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())
throw Oops.Oh(ErrorCode.xg1002);

Loading…
Cancel
Save