平安校园
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.

AuthBController.cs 2.2 KiB

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