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

MqttController.cs 1.1 KiB

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