development
温天培 1 year ago
parent 10da1957af
commit 6b16280d57

@ -0,0 +1,27 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 附件表
/// </summary>
[SugarTable("mini_annex")]
[Description("附件表")]
public class Annex : DEntityBase
{
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public string FileSize { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FileUrl { get; set; }
}
}

@ -11,14 +11,6 @@ namespace GDZZ.Application.Entity
[Description("小程序求职")] [Description("小程序求职")]
public class JobHunt : DEntityBase public class JobHunt : DEntityBase
{ {
/// <summary>
/// 职业名称
/// </summary>
public string Career { get; set; }
/// <summary>
/// 个人简介
/// </summary>
public string Info { get; set; }
/// <summary> /// <summary>
/// 期望工作地点 /// 期望工作地点
/// </summary> /// </summary>
@ -28,12 +20,28 @@ namespace GDZZ.Application.Entity
/// </summary> /// </summary>
public string Tags { get; set; } public string Tags { get; set; }
/// <summary> /// <summary>
/// 电话 /// 学历
/// </summary>
public string Record { get; set; }
/// <summary>
/// 经验
/// </summary>
public string Experience { get; set; }
/// <summary>
/// 薪资
/// </summary>
public string Salary { get; set; }
/// <summary>
/// 职位
/// </summary>
public string Position { get; set; }
/// <summary>
/// 预留手机
/// </summary> /// </summary>
public string phone { get; set; } public string Phone { get; set; }
/// <summary> /// <summary>
/// 头像 /// 年龄
/// </summary> /// </summary>
public string Logo { get; set; } public string AgeValue { get; set; }
} }
} }

@ -2,7 +2,7 @@
using SqlSugar; using SqlSugar;
using System.ComponentModel; using System.ComponentModel;
using GDZZ.Core.Entity; using GDZZ.Core.Entity;
using GDZZ.Application; using GDZZ.Application.Enum;
namespace GDZZ.Application.Entity namespace GDZZ.Application.Entity
{ {
@ -65,5 +65,9 @@ namespace GDZZ.Application.Entity
/// 状态 /// 状态
/// </summary> /// </summary>
public ResumeStatusEnum Status { get; set; } public ResumeStatusEnum Status { get; set; }
/// <summary>
/// 招聘类型
/// </summary>
public ResumeTypeEnum Types { get; set; }
} }
} }

@ -0,0 +1,27 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 职位表
/// </summary>
[SugarTable("mini_position")]
[Description("职位表")]
public class Position : DEntityBase
{
/// <summary>
/// 职位名称
/// </summary>
public string PositionName { get; set; }
/// <summary>
/// 职位等级
/// </summary>
public PositionEnum PositionLevel { get; set; }
/// <summary>
/// 父级
/// </summary>
public long ParentID { get; set; }
}
}

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application
{
/// <summary>
///
/// </summary>
public enum PositionEnum
{
/// <summary>
/// 顶级职业
/// </summary>
[Description("顶级职业")] JobList = 0,
/// <summary>
/// 父级职业
/// </summary>
[Description("父级职业")] Subitem = 1,
/// <summary>
/// 子级职业
/// </summary>
[Description("子级职业")] Grandson = 2,
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Enum
{
public enum ResumeTypeEnum
{
/// <summary>
/// 热招
/// </summary>
[Description("热招")] Hot = 0,
/// <summary>
/// 普招0
/// </summary>
[Description("普招")] Common = 1,
}
}

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application
{
/// <summary>
///
/// </summary>
public enum SalaryEnum
{
}
}

@ -44,6 +44,11 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public const string MINI_USERPHONECODE = "User_PhoneCode:"; public const string MINI_USERPHONECODE = "User_PhoneCode:";
/// <summary>
/// AccessToken
/// </summary>
public const string MINI_ACCESSTOKEN = "AccessToken:";
#endregion #endregion
} }
} }

File diff suppressed because it is too large Load Diff

@ -159,6 +159,20 @@ namespace GDZZ.Application.Help
return await _redisCache.GetAsync<string>(cacheKey); return await _redisCache.GetAsync<string>(cacheKey);
} }
public async Task<string> GetAccessTokenAsync()
{
string cacheKey = SystemConst.MINI_ACCESSTOKEN;
return await _redisCache.GetAsync<string>(cacheKey);
}
public async Task SetAccessTokenAsync(string AccessToken)
{
string cacheKey = SystemConst.MINI_ACCESSTOKEN;
await _redisCache.SetAsync(cacheKey, AccessToken, TimeSpan.FromHours(2));
}
#endregion #endregion
} }
} }

@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace GDZZ.Application.Help namespace GDZZ.Application.Help
{ {
/// <summary>
/// 缓存接口
/// </summary>
public interface ICacheService public interface ICacheService
{ {
#region 聊天接口 #region 聊天接口
@ -24,7 +27,6 @@ namespace GDZZ.Application.Help
#endregion #endregion
#region 用户信息 #region 用户信息
/// <summary> /// <summary>
@ -56,8 +58,21 @@ namespace GDZZ.Application.Help
/// <returns></returns> /// <returns></returns>
Task<string> GetVerifyCode(string Phone); Task<string> GetVerifyCode(string Phone);
/// <summary>
/// 获取AccessToken
/// </summary>
/// <returns></returns>
Task<string> GetAccessTokenAsync();
/// <summary>
/// 设置AccessToken
/// </summary>
/// <returns></returns>
Task SetAccessTokenAsync(string Access);
#endregion #endregion
} }
} }

@ -28,11 +28,11 @@ namespace GDZZ.Application.Help
{ {
_appId = conf["tencentCloudSms:appId"]; _appId = conf["tencentCloudSms:appId"];
if (string.IsNullOrEmpty(_appId)) if (string.IsNullOrEmpty(_appId))
throw new ArgumentException($"{nameof(_appId)} must have a value"); throw new ArgumentException($"{nameof(_appId)} must have a Value");
_appKey = conf["tencentCloudSms:appKey"]; _appKey = conf["tencentCloudSms:appKey"];
if (string.IsNullOrEmpty(_appKey)) if (string.IsNullOrEmpty(_appKey))
throw new ArgumentException($"{nameof(_appKey)} must have a value"); throw new ArgumentException($"{nameof(_appKey)} must have a Value");
_logger = loggerFactory.CreateLogger<TencentCloudSmsService>(); _logger = loggerFactory.CreateLogger<TencentCloudSmsService>();
} }

@ -1,9 +1,16 @@
using System; using Furion;
using GDZZ.Core.Entity;
using GDZZ.Core;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yitter.IdGenerator;
namespace GDZZ.Application.Help namespace GDZZ.Application.Help
{ {
@ -131,5 +138,58 @@ namespace GDZZ.Application.Help
|| ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))); || ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF)));
} }
/// <summary>
/// 上传文件
/// </summary>
/// <param name="file"></param>
/// <param name="pathType"></param>
/// <param name="fileLocation"></param>
/// <returns></returns>
public static async Task<LiveFileOutput> UploadFile(IFormFile file, string pathType, FileLocation fileLocation)
{
var fileSizeKb = (long)(file.Length / 1024.0); // 文件大小KB
var originalFilename = file.FileName; // 文件原始名称
var fileSuffix = Path.GetExtension(file.FileName).ToLower(); // 文件后缀
// 先存库获取Id
var id = YitIdHelper.NextId();
var newFile = new SysFile
{
Id = id,
FileLocation = (int)FileLocation.LOCAL,
FileBucket = FileLocation.LOCAL.ToString(),
FileObjectName = $"{YitIdHelper.NextId()}{fileSuffix}",
FileOriginName = originalFilename,
FileSuffix = fileSuffix.TrimStart('.'),
FileSizeKb = fileSizeKb.ToString(),
FilePath = pathType
};
newFile = await App.GetService<ISqlSugarClient>().Insertable(newFile).ExecuteReturnEntityAsync();
var finalName = newFile.FileObjectName; // 生成文件的最终名称
if (fileLocation == FileLocation.LOCAL) // 本地存储
{
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, pathType);
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
using (var stream = File.Create(Path.Combine(filePath, finalName)))
{
await file.CopyToAsync(stream);
}
}
else if (fileLocation == FileLocation.ALIYUN) // 阿里云OSS
{
var filePath = pathType + finalName;
OSSClientUtil.DeletefileCode(filePath);
var stream = file.OpenReadStream();
OSSClientUtil.PushMedia(stream, filePath);
}
newFile.FileObjectName = finalName;
return new LiveFileOutput() { Id = finalName, FileUrl = "/" + pathType + "/" + finalName }; // 返回文件唯一标识
}
} }
} }

@ -17,6 +17,17 @@ namespace GDZZ.Application.Mapper
config.ForType<LiveHistoryContacts, LiveHistoryLists>() config.ForType<LiveHistoryContacts, LiveHistoryLists>()
.Map(d => d.Id, s => s.CreatedUserId); .Map(d => d.Id, s => s.CreatedUserId);
config.ForType<Position, PositionOutput > ()
.Map(d => d.Value, s => s.Id)
.Map(d=>d.Label,s=>s.PositionName);
config.ForType<SysRegion, PositionOutput>()
.Map(d => d.Value, s => s.region_id)
.Map(d => d.Label, s => s.region_name);
} }
} }
} }

@ -0,0 +1,135 @@
using GDZZ.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using GDZZ.Application.Help;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using System;
namespace GDZZ.Application
{
/// <summary>
/// 附件管理服务
/// </summary>
[ApiDescriptionSettings("Application",Name = "Annex", Order = 1)]
public class AnnexService : IAnnexService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Annex> _rep;
private readonly UploadFileOptions _options;
public AnnexService(SqlSugarRepository<Annex> rep, IOptions<UploadFileOptions> options)
{
this._options = options.Value;
_rep = rep;
}
/// <summary>
/// 分页查询附件管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Annex/page")]
public async Task<dynamic> Page([FromQuery] AnnexInput input)
{
var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName == input.FileName)
.WhereIF(!string.IsNullOrWhiteSpace(input.FileSize), u => u.FileSize == input.FileSize)
.WhereIF(!string.IsNullOrWhiteSpace(input.FileUrl), u => u.FileUrl == input.FileUrl)
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加附件管理
/// </summary>
/// <param name="file"></param>
/// <param name="FileName"></param>
/// <returns></returns>
[HttpPost("/Mini/Annex/add")]
public async Task<Annex> Add(IFormFile file,string FileName)
{
var entity = await this._rep.AsQueryable().Where(x => x.CreatedUserId == UserManager.UserId).FirstAsync();
var fileInfo =await Utils.UploadFile(file, this._options.Default.path, FileLocation.LOCAL);
if (fileInfo == null)
throw new Exception("文件上传失败!");
entity.FileName = FileName;
entity.FileSize = file.Length.ToString();
entity.FileUrl = fileInfo.FileUrl;
//查询
if(entity != null )
{
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
else
{
await _rep.InsertAsync(entity);
}
return entity;
}
/// <summary>
/// 获取附件
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Mini/Annex/GetAnnex")]
public async Task<dynamic> GetAnnex()
{
return await _rep.Where(x=>x.CreatedUserId == UserManager.UserId).FirstAsync();
}
/// <summary>
/// 删除附件管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Annex/delete")]
public async Task Delete(DeleteAnnexInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
await _rep.DeleteAsync(entity);
}
/// <summary>
/// 更新附件管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Annex/edit")]
public async Task Update(UpdateAnnexInput input)
{
var entity = input.Adapt<Annex>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
}
/// <summary>
/// 获取附件管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Annex/detail")]
public async Task<Annex> Get([FromQuery] QueryeAnnexInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取附件管理列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Annex/list")]
public async Task<dynamic> List([FromQuery] AnnexInput input)
{
return await _rep.ToListAsync();
}
}
}

@ -0,0 +1,32 @@
using System;
using GDZZ.Core;
namespace GDZZ.Application
{
/// <summary>
/// 附件管理输出参数
/// </summary>
public class AnnexDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public string FileSize { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FileUrl { get; set; }
}
}

@ -0,0 +1,57 @@
using GDZZ.Core;
using System;
using System.ComponentModel.DataAnnotations;
namespace GDZZ.Application
{
/// <summary>
/// 附件管理输入参数
/// </summary>
public class AnnexInput : PageInputBase
{
/// <summary>
/// 文件名
/// </summary>
public virtual string FileName { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public virtual string FileSize { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public virtual string FileUrl { get; set; }
}
public class AddAnnexInput : AnnexInput
{
}
public class DeleteAnnexInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class UpdateAnnexInput : AnnexInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class QueryeAnnexInput : DeleteAnnexInput
{
}
}

@ -0,0 +1,31 @@
using System;
namespace GDZZ.Application
{
/// <summary>
/// 附件管理输出参数
/// </summary>
public class AnnexOutput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public string FileSize { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FileUrl { get; set; }
}
}

@ -0,0 +1,18 @@
using GDZZ.Core;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using Microsoft.AspNetCore.Http;
namespace GDZZ.Application
{
public interface IAnnexService
{
Task<Annex> Add(IFormFile file, string FileName);
Task Delete(DeleteAnnexInput input);
Task<Annex> Get([FromQuery] QueryeAnnexInput input);
Task<dynamic> List([FromQuery] AnnexInput input);
Task<dynamic> Page([FromQuery] AnnexInput input);
Task Update(UpdateAnnexInput input);
}
}

@ -34,11 +34,12 @@ namespace GDZZ.Application.Service.Auth
private readonly SqlSugarRepository<Company> CompanyRep; private readonly SqlSugarRepository<Company> CompanyRep;
private readonly SqlSugarRepository<MiniPayTake> payTakeRep; //支付仓储 private readonly SqlSugarRepository<MiniPayTake> payTakeRep; //支付仓储
private readonly SqlSugarRepository<SysConfig> _sysConfigRep; // 参数配置表仓储 private readonly SqlSugarRepository<SysConfig> _sysConfigRep; // 参数配置表仓储
private readonly ISysCacheService _sysCacheService; //缓存
#endregion #endregion
#region 服务 #region 服务
private readonly ICacheService cacheService; // private readonly ISysCacheService _sysCacheService; //缓存
private readonly ICacheService cacheService;
private readonly WechatOAuth _wechatOAuth; //微信权限服务 private readonly WechatOAuth _wechatOAuth; //微信权限服务
private readonly IHttpContextAccessor _httpContextAccessor; //http服务 private readonly IHttpContextAccessor _httpContextAccessor; //http服务
private readonly IEventPublisher _eventPublisher; //事件写入服务 private readonly IEventPublisher _eventPublisher; //事件写入服务
@ -71,7 +72,7 @@ namespace GDZZ.Application.Service.Auth
this._sysTenantRep = sysTenantRep; this._sysTenantRep = sysTenantRep;
this.Baseuser = Baseuser; this.Baseuser = Baseuser;
this._httpContextAccessor = httpContextAccessor; this._httpContextAccessor = httpContextAccessor;
this.cacheService= cacheService; this.cacheService = cacheService;
this.Self = Self; this.Self = Self;
this.payTakeRep = payTakeRep; this.payTakeRep = payTakeRep;
this._sysCacheService= sysCacheService; this._sysCacheService= sysCacheService;
@ -93,7 +94,7 @@ namespace GDZZ.Application.Service.Auth
Company company = new Company(); Company company = new Company();
//读取凭证 //读取凭证
var tokenModel = await this._wechatOAuth.GetAccessTokenAsync(phoneModel.code); var tokenModel = await this._wechatOAuth.GetCode2SessionAsync(phoneModel.code);
//解析电话 //解析电话
var phoneInfo = MiniProgramUtil.AESDecrypt(phoneModel.encryptedDataStr, tokenModel.SessionKey, phoneModel.iv); var phoneInfo = MiniProgramUtil.AESDecrypt(phoneModel.encryptedDataStr, tokenModel.SessionKey, phoneModel.iv);
@ -285,7 +286,7 @@ namespace GDZZ.Application.Service.Auth
//读取凭证 //读取凭证
var tokenModel = await this._wechatOAuth.GetAccessTokenAsync(phoneModel.code); var tokenModel = await this._wechatOAuth.GetCode2SessionAsync(phoneModel.code);
var wxUser = await this.Baseuser.AsQueryable() var wxUser = await this.Baseuser.AsQueryable()
.Filter("TenantId", true) .Filter("TenantId", true)
@ -331,7 +332,6 @@ namespace GDZZ.Application.Service.Auth
company = await this.CompanyRep.SingleAsync(x => x.Id == wxUser.CompanyID); company = await this.CompanyRep.SingleAsync(x => x.Id == wxUser.CompanyID);
authUserOut.companyDto = company.Adapt<CompanyDto>(); 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);
@ -439,7 +439,42 @@ namespace GDZZ.Application.Service.Auth
{ {
return await this.cacheService.GetUserInfoAsync(UserManager.UserId); return await this.cacheService.GetUserInfoAsync(UserManager.UserId);
} }
/// <summary>
/// 获取AccessToken
/// </summary>
/// <returns></returns>
[HttpGet("/Mini/GetAccessToken")]
public async Task<string> GetAccessTokenAsync()
{
var value = await cacheService.GetAccessTokenAsync();
if(value == null)
{
var token = this._wechatOAuth.GetTokenAsync();
await cacheService.SetAccessTokenAsync(token.Result.AccessToken);
value = token.Result.AccessToken;
}
return value;
}
/// <summary>
/// 获取二维分享码
/// </summary>
/// <returns></returns>
[HttpGet("/Mini/GetShareCode")]
public async Task<string> GetShareCode(string scene, string page)
{
var value = await cacheService.GetAccessTokenAsync();
if (value == null)
{
var token = this._wechatOAuth.GetTokenAsync();
await cacheService.SetAccessTokenAsync(token.Result.AccessToken);
value = token.Result.AccessToken;
}
var res = await this._wechatOAuth.GetShareCodeAsync(value,scene, page);
return Convert.ToBase64String(res);
}

@ -1,7 +1,7 @@
using System; using System;
using GDZZ.Core; using GDZZ.Core;
namespace Magic.Application namespace GDZZ.Application
{ {
/// <summary> /// <summary>
/// 求职列表输出参数 /// 求职列表输出参数

@ -2,58 +2,72 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Magic.Application namespace GDZZ.Application
{ {
/// <summary> /// <summary>
/// 求职列表输入参数 /// 求职列表输入参数
/// </summary> /// </summary>
public class JobHuntInput : PageInputBase public class JobHuntInput : PageInputBase
{ {
/// <summary> /// <summary>
/// 职业名称 /// 标志
/// </summary> /// </summary>
public virtual string Career { get; set; } public virtual string Tags { get; set; }
/// <summary> /// <summary>
/// 个人简介 /// 职业名称
/// </summary> /// </summary>
public virtual string Info { get; set; } public virtual string Position { get; set; }
/// <summary> /// <summary>
/// 期望工作地点 /// 期望工作地点
/// </summary> /// </summary>
public virtual string Address { get; set; } public virtual string Address { get; set; }
/// <summary> /// <summary>
/// 标志 /// 电话
/// </summary> /// </summary>
public virtual string Tags { get; set; } public virtual string Phone { get; set; }
/// <summary> /// <summary>
/// 电话 /// 学历
/// </summary>
public virtual string Record { get; set; }
/// <summary>
/// 经验
/// </summary> /// </summary>
public virtual string phone { get; set; } public virtual string Experience { get; set; }
/// <summary> /// <summary>
/// 头像 /// 薪资
/// </summary> /// </summary>
public virtual string Logo { get; set; } public virtual string Salary { get; set; }
/// <summary>
/// 年龄
/// </summary>
public virtual string AgeValue { get; set; }
} }
public class AddJobHuntInput : JobHuntInput public class AddJobHuntInput: JobHuntInput
{ {
/// <summary> /// <summary>
/// 职业名称 /// 标志
/// </summary> /// </summary>
[Required(ErrorMessage = "职业名称不能为空")] [Required(ErrorMessage = "标志不能为空")]
public override string Career { get; set; } public override string Tags { get; set; }
/// <summary> /// <summary>
/// 个人简介 /// 职业名称
/// </summary> /// </summary>
[Required(ErrorMessage = "个人简介不能为空")] [Required(ErrorMessage = "职业名称不能为空")]
public override string Info { get; set; } public override string Position { get; set; }
/// <summary> /// <summary>
/// 期望工作地点 /// 期望工作地点
@ -61,23 +75,35 @@ namespace Magic.Application
[Required(ErrorMessage = "期望工作地点不能为空")] [Required(ErrorMessage = "期望工作地点不能为空")]
public override string Address { get; set; } public override string Address { get; set; }
/// <summary>
/// 标志
/// </summary>
[Required(ErrorMessage = "标志不能为空")]
public override string Tags { get; set; }
/// <summary> /// <summary>
/// 电话 /// 电话
/// </summary> /// </summary>
[Required(ErrorMessage = "电话不能为空")] [Required(ErrorMessage = "电话不能为空")]
public override string phone { get; set; } public override string Phone { get; set; }
/// <summary>
/// 学历
/// </summary>
[Required(ErrorMessage = "学历不能为空")]
public override string Record { get; set; }
/// <summary>
/// 经验
/// </summary>
[Required(ErrorMessage = "经验不能为空")]
public override string Experience { get; set; }
/// <summary>
/// 薪资
/// </summary>
[Required(ErrorMessage = "薪资不能为空")]
public override string Salary { get; set; }
/// <summary> /// <summary>
/// 头像 /// 年龄
/// </summary> /// </summary>
[Required(ErrorMessage = "头像不能为空")] [Required(ErrorMessage = "年龄不能为空")]
public override string Logo { get; set; } public override string AgeValue { get; set; }
} }

@ -1,6 +1,6 @@
using System; using System;
namespace Magic.Application namespace GDZZ.Application
{ {
/// <summary> /// <summary>
/// 求职列表输出参数 /// 求职列表输出参数

@ -2,7 +2,9 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks; using System.Threading.Tasks;
using GDZZ.Application.Entity; using GDZZ.Application.Entity;
namespace Magic.Application using Microsoft.AspNetCore.Http;
namespace GDZZ.Application
{ {
public interface IJobHuntService public interface IJobHuntService
{ {
@ -10,7 +12,7 @@ namespace Magic.Application
Task Delete(DeleteJobHuntInput input); Task Delete(DeleteJobHuntInput input);
Task<JobHunt> Get([FromQuery] QueryeJobHuntInput input); Task<JobHunt> Get([FromQuery] QueryeJobHuntInput input);
Task<dynamic> List([FromQuery] JobHuntInput input); Task<dynamic> List([FromQuery] JobHuntInput input);
Task<dynamic> Page([FromQuery] JobHuntInput input); //Task<dynamic> Page([FromQuery] JobHuntInput input);
Task Update(UpdateJobHuntInput input); Task Update(UpdateJobHuntInput input);
} }
} }

@ -3,13 +3,11 @@ using Furion.DependencyInjection;
using Furion.DynamicApiController; using Furion.DynamicApiController;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using GDZZ.Application.Entity; using GDZZ.Application.Entity;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
namespace Magic.Application namespace GDZZ.Application
{ {
/// <summary> /// <summary>
/// 求职列表服务 /// 求职列表服务
@ -34,12 +32,7 @@ namespace Magic.Application
public async Task<dynamic> Page([FromQuery] JobHuntInput input) public async Task<dynamic> Page([FromQuery] JobHuntInput input)
{ {
var entities = await _rep.AsQueryable() var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.Career), u => u.Career == input.Career)
.WhereIF(!string.IsNullOrWhiteSpace(input.Info), u => u.Info == input.Info)
.WhereIF(!string.IsNullOrWhiteSpace(input.Address), u => u.Address == input.Address)
.WhereIF(!string.IsNullOrWhiteSpace(input.Tags), u => u.Tags == input.Tags) .WhereIF(!string.IsNullOrWhiteSpace(input.Tags), u => u.Tags == input.Tags)
.WhereIF(!string.IsNullOrWhiteSpace(input.phone), u => u.phone == input.phone)
.WhereIF(!string.IsNullOrWhiteSpace(input.Logo), u => u.Logo == input.Logo)
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult(); return entities.XnPagedResult();
} }
@ -50,6 +43,7 @@ namespace Magic.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("/JobHunt/add")] [HttpPost("/JobHunt/add")]
[AllowAnonymous]
public async Task Add(AddJobHuntInput input) public async Task Add(AddJobHuntInput input)
{ {
var entity = input.Adapt<JobHunt>(); var entity = input.Adapt<JobHunt>();
@ -62,6 +56,7 @@ namespace Magic.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("/JobHunt/delete")] [HttpPost("/JobHunt/delete")]
[AllowAnonymous]
public async Task Delete(DeleteJobHuntInput input) public async Task Delete(DeleteJobHuntInput input)
{ {
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
@ -74,6 +69,7 @@ namespace Magic.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("/JobHunt/edit")] [HttpPost("/JobHunt/edit")]
[AllowAnonymous]
public async Task Update(UpdateJobHuntInput input) public async Task Update(UpdateJobHuntInput input)
{ {
var entity = input.Adapt<JobHunt>(); var entity = input.Adapt<JobHunt>();
@ -86,6 +82,7 @@ namespace Magic.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("/JobHunt/detail")] [HttpGet("/JobHunt/detail")]
[AllowAnonymous]
public async Task<JobHunt> Get([FromQuery] QueryeJobHuntInput input) public async Task<JobHunt> Get([FromQuery] QueryeJobHuntInput input)
{ {
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
@ -97,9 +94,13 @@ namespace Magic.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("/JobHunt/list")] [HttpGet("/JobHunt/list")]
[AllowAnonymous]
public async Task<dynamic> List([FromQuery] JobHuntInput input) public async Task<dynamic> List([FromQuery] JobHuntInput input)
{ {
return await _rep.ToListAsync(); return await _rep.AsQueryable()
.Where(x=>x.CreatedUserId == UserManager.UserId)
.OrderByDescending(x=>x.Tags)
.ToListAsync();
} }
} }
} }

@ -1,4 +1,6 @@
using GDZZ.Core; using Furion.DataValidation;
using GDZZ.Application.Enum;
using GDZZ.Core;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -54,6 +56,17 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public string SalaryID { get; set; } public string SalaryID { get; set; }
/// <summary>
/// 状态
/// </summary>
public ResumeStatusEnum Status { get; set; }
/// <summary>
/// 招聘类型
/// </summary>
[DataValidation(AllowNullValue = true)]
public ResumeTypeEnum? TypeEnum { get; set; }
} }
public class AddMiniResumeInput : MiniResumeInput public class AddMiniResumeInput : MiniResumeInput

@ -1,4 +1,5 @@
using GDZZ.Application; using GDZZ.Application;
using GDZZ.Application.Enum;
using System; using System;
namespace GDZZ.Application namespace GDZZ.Application
@ -88,5 +89,9 @@ namespace GDZZ.Application
/// 状态 /// 状态
/// </summary> /// </summary>
public ResumeStatusEnum Status { get; set; } public ResumeStatusEnum Status { get; set; }
/// <summary>
/// 招聘类型
/// </summary>
public ResumeTypeEnum? TypeEnum { get; set; }
} }
} }

@ -8,8 +8,6 @@ namespace GDZZ.Application
{ {
Task Add(AddMiniResumeInput input); Task Add(AddMiniResumeInput input);
Task Delete(DeleteMiniResumeInput input); Task Delete(DeleteMiniResumeInput input);
Task<dynamic> SearchRetFun([FromQuery] MiniResumeInput input); Task<dynamic> SearchRetFun([FromQuery] MiniResumeInput input);
Task Update(UpdateMiniResumeInput input); Task Update(UpdateMiniResumeInput input);
} }

@ -56,15 +56,15 @@ namespace GDZZ.Application
[AllowAnonymous] [AllowAnonymous]
public async Task<dynamic> GetResumeList([FromQuery] MiniResumeInput input) public async Task<dynamic> GetResumeList([FromQuery] MiniResumeInput input)
{ {
var companys = await this.CompanyRep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(input.SearchValue), u => u.Name.Contains(input.SearchValue)).FirstAsync();
var entities = await _rep.AsQueryable() var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.RegionName), u => u.RegionName.Contains(input.RegionName.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.RegionName), u => u.RegionName.Contains(input.RegionName.Trim()))
.WhereIF(!companys.IsNullOrZero(), u => u.Title.Contains(input.SearchValue) || u.CompanyID == companys.Id) .WhereIF(!string.IsNullOrWhiteSpace(input.SearchValue), u => u.Title.Contains(input.SearchValue))
.WhereIF(!string.IsNullOrWhiteSpace(input.Salary), u => u.Salary.Contains(input.Salary.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Salary), u => u.Salary.Contains(input.Salary.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Record), u => u.Record.Contains(input.Record.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Record), u => u.Record.Contains(input.Record.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Level), u => u.Record.Contains(input.Level.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Level), u => u.Record.Contains(input.Level.Trim()))
.Where(u => u.Status == ResumeStatusEnum.Release) .WhereIF(!input.TypeEnum.IsEmpty(), u => u.Types == input.TypeEnum)
.Where(u => u.Status == input.Status)
.LeftJoin<Company>((u, y) => u.CompanyID == y.Id) //关联公司信息 .LeftJoin<Company>((u, y) => u.CompanyID == y.Id) //关联公司信息
.Select((u, y) => new MiniResumeOutput .Select((u, y) => new MiniResumeOutput
{ {
@ -80,19 +80,16 @@ namespace GDZZ.Application
RegionName = u.RegionName, RegionName = u.RegionName,
Record = u.Record, Record = u.Record,
Level = u.Level, Level = u.Level,
Status = u.Status Status = u.Status,
TypeEnum = u.Types
}).MergeTable() }).MergeTable()
.OrderBy(u => u.TypeEnum)
.OrderByDescending(u => u.Time) .OrderByDescending(u => u.Time)
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult(); return entities.XnPagedResult();
} }
/// <summary> /// <summary>
/// 初始化 /// 初始化
/// </summary> /// </summary>

@ -0,0 +1,32 @@
using System;
using GDZZ.Core;
namespace GDZZ.Application
{
/// <summary>
/// 职位管理输出参数
/// </summary>
public class PositionDto
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 职位名称
/// </summary>
public string PositionName { get; set; }
/// <summary>
/// 职位等级
/// </summary>
public int PositionLevel { get; set; }
/// <summary>
/// 父级
/// </summary>
public long ParentID { get; set; }
}
}

@ -0,0 +1,57 @@
using GDZZ.Core;
using System;
using System.ComponentModel.DataAnnotations;
namespace GDZZ.Application
{
/// <summary>
/// 职位管理输入参数
/// </summary>
public class PositionInput : PageInputBase
{
/// <summary>
/// 职位名称
/// </summary>
public virtual string PositionName { get; set; }
/// <summary>
/// 职位等级
/// </summary>
public virtual int PositionLevel { get; set; }
/// <summary>
/// 父级
/// </summary>
public virtual long ParentID { get; set; }
}
public class AddPositionInput : PositionInput
{
}
public class DeletePositionInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class UpdatePositionInput : PositionInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public class QueryePositionInput : DeletePositionInput
{
}
}

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
namespace GDZZ.Application
{
/// <summary>
/// 职位管理输出参数
/// </summary>
public class PositionOutput
{
/// <summary>
/// 主键Id
/// </summary>
public string region_id { get; set; }
/// <summary>
///
/// </summary>
public long ID { get; set; }
public string Label { get; set; }
public string Value { get; set; }
public List<PositionOutput> Children { get; set; }
}
}

@ -0,0 +1,18 @@
using GDZZ.Core;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using System.Collections.Generic;
namespace GDZZ.Application
{
public interface IPositionService
{
Task Add(AddPositionInput input);
Task Delete(DeletePositionInput input);
Task<Position> Get([FromQuery] QueryePositionInput input);
Task<List<PositionOutput>> List([FromQuery] PositionInput input);
Task<dynamic> Page([FromQuery] PositionInput input);
Task Update(UpdatePositionInput input);
}
}

@ -0,0 +1,113 @@
using GDZZ.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using System.Collections.Generic;
using System;
namespace GDZZ.Application
{
/// <summary>
/// 职位管理服务
/// </summary>
[ApiDescriptionSettings("Application", Name = "Position", Order = 1)]
public class PositionService : IPositionService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Position> _rep;
public PositionService(SqlSugarRepository<Position> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询职位管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Position/page")]
public async Task<dynamic> Page([FromQuery] PositionInput input)
{
var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.PositionName), u => u.PositionName == input.PositionName)
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加职位管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Position/add")]
public async Task Add(AddPositionInput input)
{
var entity = input.Adapt<Position>();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 删除职位管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Position/delete")]
public async Task Delete(DeletePositionInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
await _rep.DeleteAsync(entity);
}
/// <summary>
/// 更新职位管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Position/edit")]
public async Task Update(UpdatePositionInput input)
{
var entity = input.Adapt<Position>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取职位管理
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Position/detail")]
public async Task<Position> Get([FromQuery] QueryePositionInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
/// <summary>
/// 获取职位管理列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Position/list")]
public async Task<List<PositionOutput>> List([FromQuery] PositionInput input)
{;
var allProvinces = await _rep.AsQueryable().ToListAsync();
//先查询 省级别
var JobList = allProvinces.Where(x => x.PositionLevel == PositionEnum.JobList).ToList().Adapt<List<PositionOutput>>();
foreach (var province in JobList)
{
province.Children = allProvinces.Where(r => r.PositionLevel == PositionEnum.Subitem && r.ParentID == province.ID).ToList().Adapt<List<PositionOutput>>();
foreach (var city in province.Children)
{
city.Children = allProvinces.Where(r => r.PositionLevel == PositionEnum.Grandson && r.ParentID == city.ID).ToList().Adapt<List<PositionOutput>>()??null;
}
}
return JobList;
}
}
}

@ -8,6 +8,9 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public class SysRegionOutput public class SysRegionOutput
{ {
/// <summary> /// <summary>
/// 主键Id /// 主键Id
/// </summary> /// </summary>

@ -44,13 +44,36 @@ namespace GDZZ.Application
province.children = allRegions.Where(r => r.region_level == 2 && r.region_parent_id == province.region_id).ToList().Adapt<List<SysRegionOutput>>(); province.children = allRegions.Where(r => r.region_level == 2 && r.region_parent_id == province.region_id).ToList().Adapt<List<SysRegionOutput>>();
foreach (var city in province.children) foreach (var city in province.children)
{ {
//rm - RazorFirst
city.children = allRegions.Where(r => r.region_level == 3 && r.region_parent_id == city.region_id).ToList().Adapt<List<SysRegionOutput>>(); city.children = allRegions.Where(r => r.region_level == 3 && r.region_parent_id == city.region_id).ToList().Adapt<List<SysRegionOutput>>();
} }
} }
return provinces; return provinces;
} }
/// <summary>
/// 查询地区列表
/// </summary>
/// <returns></returns>
[HttpGet("/Mini/GetAddressList")]
[AllowAnonymous]
public async Task<List<PositionOutput>> GetAddressList()
{
//先查询 省级别
var allRegions = await _rep.AsQueryable().ToListAsync();
var provinces = allRegions.Where(x => x.region_level == 1).ToList().Adapt<List<PositionOutput>>();
foreach (var province in provinces)
{
province.Children = allRegions.Where(r => r.region_level == 2 && r.region_parent_id == province.region_id).ToList().Adapt<List<PositionOutput>>();
foreach (var city in province.Children)
{
//rm - RazorFirst
city.Children = allRegions.Where(r => r.region_level == 3 && r.region_parent_id == city.region_id).ToList().Adapt<List<PositionOutput>>();
}
}
return provinces;
}
} }
} }

@ -1,4 +1,5 @@
using Furion; using Furion;
using Mapster;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace GDZZ.Application; namespace GDZZ.Application;

@ -3666,7 +3666,7 @@
<param name="state"></param> <param name="state"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:GDZZ.Core.WechatOAuth.GetAccessTokenAsync(System.String,System.String)"> <member name="M:GDZZ.Core.WechatOAuth.GetCode2SessionAsync(System.String,System.String)">
<summary> <summary>
换取JSCodeSessionKey 换取JSCodeSessionKey
</summary> </summary>
@ -3693,7 +3693,12 @@
<summary> <summary>
获取凭证 获取凭证
</summary> </summary>
<param name="refreshToken"></param> <returns></returns>
</member>
<member name="M:GDZZ.Core.WechatOAuth.GetShareCodeAsync(System.String,System.String,System.String)">
<summary>
获取二维码
</summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:GDZZ.Core.Service.AppInput"> <member name="T:GDZZ.Core.Service.AppInput">

@ -4,10 +4,11 @@ namespace GDZZ.Core;
public interface IWechatOAuth public interface IWechatOAuth
{ {
Task<TokenModel> GetAccessTokenAsync(string code, string state = ""); Task<TokenModel> GetCode2SessionAsync(string code, string state = "");
string GetAuthorizeUrl(string state = ""); string GetAuthorizeUrl(string state = "");
Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId); Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId);
Task<TokenModel> GetRefreshTokenAsync(string refreshToken); Task<TokenModel> GetRefreshTokenAsync(string refreshToken);
Task<TokenModel> GetTokenAsync(); Task<TokenModel> GetTokenAsync();
Task<byte[]> GetShareCodeAsync(string access_token, string scene, string page);
} }

@ -1,6 +1,7 @@
using Furion.DependencyInjection; using Furion.DependencyInjection;
using Furion.FriendlyException; using Furion.FriendlyException;
using Furion.RemoteRequest.Extensions; using Furion.RemoteRequest.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json; using Newtonsoft.Json;
using SqlSugar; using SqlSugar;
@ -18,6 +19,8 @@ public class WechatOAuth : IWechatOAuth, ISingleton
private readonly string _refreshTokenUrl = "https://api.weixin.qq.com/sns/oauth2/refresh_token"; private readonly string _refreshTokenUrl = "https://api.weixin.qq.com/sns/oauth2/refresh_token";
private readonly string _userInfoUrl = "https://api.weixin.qq.com/sns/userinfo"; private readonly string _userInfoUrl = "https://api.weixin.qq.com/sns/userinfo";
private readonly string _assessToken = "https://api.weixin.qq.com/sns/oauth2/access_token"; private readonly string _assessToken = "https://api.weixin.qq.com/sns/oauth2/access_token";
private readonly string _getAccessToken = "https://api.weixin.qq.com/cgi-bin/token";
private readonly string _getShareCode = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
private readonly ThirdParty _oauthConfig; private readonly ThirdParty _oauthConfig;
@ -52,7 +55,7 @@ public class WechatOAuth : IWechatOAuth, ISingleton
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="state"></param> /// <param name="state"></param>
/// <returns></returns> /// <returns></returns>
public async Task<TokenModel> GetAccessTokenAsync(string code, string state = "") public async Task<TokenModel> GetCode2SessionAsync(string code, string state = "")
{ {
var param = new Dictionary<string, string>() var param = new Dictionary<string, string>()
{ {
@ -110,21 +113,35 @@ public class WechatOAuth : IWechatOAuth, ISingleton
/// <summary> /// <summary>
/// 获取凭证 /// 获取凭证
/// </summary> /// </summary>
/// <param name="refreshToken"></param>
/// <returns></returns> /// <returns></returns>
public async Task<TokenModel> GetTokenAsync() public async Task<TokenModel> GetTokenAsync()
{ {
var param = new Dictionary<string, string>() var param = new Dictionary<string, string>()
{ {
["code"] = "client_credential", ["grant_type"] = "client_credential",
["appid"] = _oauthConfig.app_id, ["appid"] = _oauthConfig.app_id,
["secret"] = _oauthConfig.app_key, ["secret"] = _oauthConfig.app_key,
}; };
var refreshTokenModel = await $"{_assessToken}?{param.ToQueryString()}".GetAsAsync<TokenModel>(); var refreshTokenModel = await $"{_getAccessToken}?{param.ToQueryString()}".GetAsAsync<TokenModel>();
if (refreshTokenModel.HasError()) if (refreshTokenModel.HasError())
throw Oops.Oh($"{refreshTokenModel.Errmsg}"); throw Oops.Oh($"{refreshTokenModel.Errmsg}");
return refreshTokenModel; return refreshTokenModel;
} }
/// <summary>
/// 获取二维码
/// </summary>
/// <returns></returns>
public async Task<byte[]> GetShareCodeAsync(string access_token, string scene , string page = "")
{
var param = new Dictionary<string, string>()
{
["access_token"] = access_token
};
var refreshTokenModel = await $"{_getShareCode}?{param.ToQueryString()}".SetBody(new { page=page,scene=scene }, "application/json").PostAsByteArrayAsync();
if (!refreshTokenModel.IsFixedSize)
throw Oops.Oh($"{refreshTokenModel.SyncRoot}");
return refreshTokenModel;
}
} }

@ -53,7 +53,7 @@ public class SysOauthService : ISysOauthService, IDynamicApiController, ITransie
{ {
if (!string.IsNullOrEmpty(error_description)) if (!string.IsNullOrEmpty(error_description))
throw Oops.Oh(error_description); throw Oops.Oh(error_description);
var accessTokenModel = await _wechatOAuth.GetAccessTokenAsync(code, state); var accessTokenModel = await _wechatOAuth.GetCode2SessionAsync(code, state);
return accessTokenModel; return accessTokenModel;
} }

@ -26,6 +26,7 @@ using Senparc.Weixin.WxOpen.Containers;
using Senparc.Weixin.Sample.CommonService.MessageHandlers.WebSocket; using Senparc.Weixin.Sample.CommonService.MessageHandlers.WebSocket;
using Senparc.Weixin.AspNet.RegisterServices; using Senparc.Weixin.AspNet.RegisterServices;
using Senparc.WebSocket; using Senparc.WebSocket;
using Mapster;
namespace GDZZ.Web.Core; namespace GDZZ.Web.Core;
@ -41,6 +42,7 @@ public class Startup : AppStartup
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
services.AddBStyle(m => m.UseDefault()); services.AddBStyle(m => m.UseDefault());
services.AddConfigurableOptions<ConnectionStringsOptions>(); services.AddConfigurableOptions<ConnectionStringsOptions>();
services.AddConfigurableOptions<JWTSettingsOptions>(); services.AddConfigurableOptions<JWTSettingsOptions>();

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Loading…
Cancel
Save