| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Web.Mvc;
- using System.Web.WebPages;
- using Abp.Auditing;
- using Abp.Web.Mvc.Authorization;
- using IwbZero.ToolCommon;
- using IwbZero.ToolCommon.StringModel;
- using WeApp.CommonManager.MqttClient;
- using WeApp.Configuration;
- namespace WeApp.Controllers
- {
- [AbpMvcAuthorize, DisableAuditing]
- public class MsgMonitorController : IwbControllerBase
- {
- public MsgMonitorController(WeAppMsgClientManager msgClient)
- {
- MsgClient = msgClient;
- }
- private string EngineUrl => IwbSettingNames.GetWeEngineIp(SettingManager).Ew("/");
- private WeAppMsgClientManager MsgClient { get; }
- public ActionResult Index()
- {
- return View();
- }
- public ActionResult Refresh(int id)
- {
- if (id == 1)
- {
- MsgClient.RefreshClient();
- }
- else
- {
- $"{EngineUrl}Home/RefreshClient".RequestPost("");
- }
- return Content("OK");
- }
- public ActionResult Send(string id)
- {
- string msg = string.IsNullOrEmpty(id) ? new Random().Next(1000, 9999) + "" : id;
- //MsgClient.SendMessage("WeEngine", $"APP发送测试消息:{msg}");
- MsgClient.SendMessage(IwbConsts.ClientName, $"APP发送测试消息:{msg}");
- return Content("OK");
- }
- public ActionResult EngineSend(string id)
- {
- string msg = string.IsNullOrEmpty(id) ? new Random().Next(1000, 9999) + "" : id;
- $"{EngineUrl}Home/Send?topic={IwbConsts.ClientName}&id={msg}".RequestPost("");
- return Content("OK");
- }
- }
- }
|