|
@@ -37,10 +37,12 @@ namespace OASystem.API.Controllers
|
|
|
private readonly MessageRepository _messageRep;
|
|
|
private readonly IQiYeWeChatApiService _qiYeWeChatApiServic;
|
|
|
private readonly IHubContext<ChatHub, IChatClient> _hubContext;
|
|
|
+ private readonly DeviceTokenRepository _deviceTokenRepository;
|
|
|
|
|
|
|
|
|
- public AuthController(IConfiguration config, LoginRepository loginRep, IMapper mapper,MessageRepository message,
|
|
|
+ public AuthController(IConfiguration config, LoginRepository loginRep, IMapper mapper, MessageRepository message,
|
|
|
SystemMenuPermissionRepository systemMenuPermissionRepository, IQiYeWeChatApiService qiYeWeChatApiService, MessageRepository messageRep,
|
|
|
+ DeviceTokenRepository deviceRep,
|
|
|
IHubContext<ChatHub, IChatClient> hubContext)
|
|
|
{
|
|
|
_config = config;
|
|
@@ -50,6 +52,7 @@ namespace OASystem.API.Controllers
|
|
|
_SystemMenuPermissionRepository = systemMenuPermissionRepository;
|
|
|
_qiYeWeChatApiServic = qiYeWeChatApiService;
|
|
|
_messageRep = messageRep;
|
|
|
+ _deviceTokenRepository = deviceRep;
|
|
|
_hubContext = hubContext;
|
|
|
}
|
|
|
|
|
@@ -70,7 +73,7 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
#region 校验用户信息
|
|
|
var userData = _loginRep.Login(dto).Result;
|
|
|
- if (userData.Code != 0) return Ok(JsonView(false, userData.Msg));
|
|
|
+ if (userData.Code != 0) return Ok(JsonView(false, userData.Msg));
|
|
|
|
|
|
#endregion
|
|
|
Result authData = null;
|
|
@@ -286,15 +289,18 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
var companyDetails2 = companyDetails.GroupBy(it => it.DepId).Select(it => it.First()).ToList();
|
|
|
//部门
|
|
|
- depDetailsView = companyDetails2.Where(depIt => depIt.CompanyId == it.CompanyId).Select(depIt => {
|
|
|
+ depDetailsView = companyDetails2.Where(depIt => depIt.CompanyId == it.CompanyId).Select(depIt =>
|
|
|
+ {
|
|
|
|
|
|
DepDetailsView depDetails = new DepDetailsView();
|
|
|
List<JobDetailsView> jobDetails = new List<JobDetailsView>();
|
|
|
|
|
|
//岗位
|
|
|
- jobDetails = companyDetails.Where(jobIt => jobIt.DepId == depIt.DepId).Select(jobIt => {
|
|
|
+ jobDetails = companyDetails.Where(jobIt => jobIt.DepId == depIt.DepId).Select(jobIt =>
|
|
|
+ {
|
|
|
|
|
|
- JobDetailsView jobDetail = new JobDetailsView() {
|
|
|
+ JobDetailsView jobDetail = new JobDetailsView()
|
|
|
+ {
|
|
|
JobId = jobIt.JobId,
|
|
|
JobName = jobIt.JobName,
|
|
|
};
|
|
@@ -375,12 +381,46 @@ namespace OASystem.API.Controllers
|
|
|
//Result result = new Result();
|
|
|
//var httpContext = HttpContext.User.Claims.FirstOrDefault(it => it.Type == ClaimTypes.Name)?.Value;
|
|
|
//Sys_Users sys_Users = _mapper.Map<Sys_Users>(dto);
|
|
|
- var _view = await _loginRep.ChangePassword(dto.UserId,dto.Password);
|
|
|
- if (_view.Code == 0) return Ok(JsonView(true,"操作成功!"));
|
|
|
+ var _view = await _loginRep.ChangePassword(dto.UserId, dto.Password);
|
|
|
+ if (_view.Code == 0) return Ok(JsonView(true, "操作成功!"));
|
|
|
|
|
|
return Ok(JsonView(false, _view.Msg));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 保存deviceToken
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [OASystemAuthentication]
|
|
|
+ [HttpPost("SaveDeviceToken")]
|
|
|
+ [ProducesResponseType(typeof(LoginView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> SaveDeviceToken(SaveDeviceToken dto)
|
|
|
+ {
|
|
|
+ var view = await _deviceTokenRepository.SaveToken(dto);
|
|
|
+
|
|
|
+ if (view.Code == 0) return Ok(JsonView(true, "操作成功!"));
|
|
|
+
|
|
|
+ return Ok(JsonView(false, view.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取deviceToken
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [OASystemAuthentication]
|
|
|
+ [HttpPost("GetDeviceToken")]
|
|
|
+ [ProducesResponseType(typeof(LoginView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> GetDeviceToken(GetDeviceToken dto)
|
|
|
+ {
|
|
|
+ var view = await _deviceTokenRepository.GetToken(dto.account);
|
|
|
+
|
|
|
+ if (view.Code == 0) return Ok(JsonView(true, "操作成功!"));
|
|
|
+
|
|
|
+ return Ok(JsonView(false, view.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 测试auth
|
|
|
/// </summary>
|
|
@@ -826,7 +866,7 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
return Ok(JsonView(false, "操作失败!", ex.Message));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|