using System; using System.Web.Mvc; using Abp.Web.Mvc.Controllers; using IwbZero.ToolCommon.StringModel; using WeEngine.Message; namespace WeEngine.Controllers { public class HomeController : AbpController { public HomeController(WeEngineMsgClientManager msgClient) { MsgClient = msgClient; } private WeEngineMsgClientManager MsgClient { get; } public ActionResult Index() { return View(); } public ActionResult Test(string id) { string msg = id.IsEmpty() ? new Random().Next(1000, 9999) + "" : id; MsgClient.SendMessage("WeApp", $"Engine发送测试消息:{msg}"); return View("Index"); } public ActionResult Refresh() { MsgClient.RefreshClient(); return View("Index"); } public ActionResult Send(string id,string topic=null) { topic = topic ?? "WeApp"; string msg = id.IsEmpty() ? new Random().Next(1000, 9999) + "" : id; MsgClient.SendMessage(topic, $"Engine发送测试消息:{msg}"); return Content("OK"); } public ActionResult RefreshClient() { MsgClient.RefreshClient(); return Content("OK"); } } }