平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
2.2 KiB

  1. //
  2. namespace SafeCampus.Web.Core;
  3. /// <summary>
  4. /// B端登录控制器
  5. /// </summary>
  6. [ApiDescriptionSettings(Tag = "B端权限校验")]
  7. [Route("sys/auth/b")]
  8. public class AuthBController : BaseController
  9. {
  10. private readonly IAuthService _authService;
  11. public AuthBController(IAuthService authService)
  12. {
  13. _authService = authService;
  14. }
  15. /// <summary>
  16. /// B端获取图片验证码
  17. /// </summary>
  18. /// <returns></returns>
  19. [HttpGet("getPicCaptcha")]
  20. [AllowAnonymous]
  21. public async Task<dynamic> GetPicCaptcha()
  22. {
  23. return await _authService.GetCaptchaInfo();
  24. }
  25. /// <summary>
  26. /// B端获取手机验证码
  27. /// </summary>
  28. /// <param name="input"></param>
  29. /// <returns></returns>
  30. [HttpGet("getPhoneValidCode")]
  31. [AllowAnonymous]
  32. public async Task<dynamic> GetPhoneValidCode([FromQuery] GetPhoneValidCodeInput input)
  33. {
  34. return await _authService.GetPhoneValidCode(input, LoginClientTypeEnum.B);
  35. }
  36. /// <summary>
  37. /// B端登录
  38. /// </summary>
  39. /// <param name="input"></param>
  40. /// <returns></returns>
  41. [AllowAnonymous]
  42. [HttpPost("login")]
  43. [DisplayName(EventSubscriberConst.LOGIN_B)]
  44. public async Task<dynamic> Login(LoginInput input)
  45. {
  46. return await _authService.Login(input, LoginClientTypeEnum.B);
  47. }
  48. /// <summary>
  49. /// B端手机号登录
  50. /// </summary>
  51. /// <param name="input"></param>
  52. /// <returns></returns>
  53. [AllowAnonymous]
  54. [HttpPost("loginByPhone")]
  55. public async Task<dynamic> LoginByPhone(LoginByPhoneInput input)
  56. {
  57. return await _authService.LoginByPhone(input, LoginClientTypeEnum.B);
  58. }
  59. /// <summary>
  60. /// 登出
  61. /// </summary>
  62. /// <returns></returns>
  63. [HttpPost("logout")]
  64. [DisplayName(EventSubscriberConst.LOGIN_OUT_B)]
  65. public async Task LoginOut([FromBody] LoginOutInput input)
  66. {
  67. await _authService.LoginOut(input.Token, LoginClientTypeEnum.B);
  68. }
  69. /// <summary>
  70. /// 获取用户信息
  71. /// </summary>
  72. /// <returns></returns>
  73. [HttpGet("getLoginUser")]
  74. public async Task<dynamic> GetLoginUser()
  75. {
  76. return await _authService.GetLoginUser();
  77. }
  78. }