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

45 lines
1.1 KiB

  1. using Furion.DynamicApiController;
  2. namespace SafeCampus.Plugin.Mqtt
  3. {
  4. /// <summary>
  5. /// mqtt服务控制器
  6. /// </summary>
  7. [ApiDescriptionSettings(Tag = "mqtt服务")]
  8. [Route("mqtt")]
  9. public class MqttController : IDynamicApiController
  10. {
  11. private readonly IMqttService _mqttService;
  12. public MqttController(IMqttService mqttService)
  13. {
  14. _mqttService = mqttService;
  15. }
  16. /// <summary>
  17. /// 获取mqtt登录参数
  18. /// </summary>
  19. /// <returns></returns>
  20. [HttpGet("getParameter")]
  21. public async Task<dynamic> GetParameter()
  22. {
  23. return await _mqttService.GetWebLoginParameter();
  24. }
  25. /// <summary>
  26. /// mqtt认证
  27. /// </summary>
  28. /// <param name="input"></param>
  29. /// <returns></returns>
  30. [HttpPost("auth")]
  31. [AllowAnonymous]
  32. [NonUnify]
  33. public async Task<dynamic> Auth([FromBody] MqttAuthInput input)
  34. {
  35. return await _mqttService.Auth(input);
  36. }
  37. }
  38. }