| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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");
- }
-
- }
- }
|