预备signalr
This commit is contained in:
57
ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs
Normal file
57
ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Infrastructure.Constant;
|
||||
using Infrastructure.Extensions;
|
||||
using JinianNet.JNTemplate;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Text.Json;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Hubs;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.System;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC
|
||||
{
|
||||
|
||||
|
||||
[Route("mes/qc/FQC")]
|
||||
public class FirstFQCController : BaseController
|
||||
{
|
||||
private readonly IFirstFQCService fQCService;
|
||||
private readonly IHubContext<MessageHub> hubContext;
|
||||
|
||||
public FirstFQCController(IFirstFQCService fQCService, IHubContext<MessageHub> hubContext) {
|
||||
this.fQCService = fQCService;
|
||||
this.hubContext = hubContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取 检测项 填充
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getcheckItemTable")]
|
||||
public IActionResult GetcheckItemTable()
|
||||
{
|
||||
|
||||
CheckItemTableDTO itemTableDTO= fQCService.GetCheckItemTable();
|
||||
hubContext.Clients.All.SendAsync(HubsConstant.mymy, "123456");
|
||||
return SUCCESS(itemTableDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -31,14 +31,9 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc
|
||||
/// <returns></returns>
|
||||
[HttpGet("getinspectionItemList")]
|
||||
public IActionResult GetinspectionItemList(string inspectionModule="",string inspectionType="")
|
||||
{
|
||||
|
||||
{
|
||||
List<QcInspectionitem> data = qcinspection.GetinspectionItemList(inspectionModule, inspectionType);
|
||||
|
||||
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace ZR.Admin.WebApi.Hubs
|
||||
};
|
||||
clientUsers.Add(users);
|
||||
Console.WriteLine($"{DateTime.Now}:{name},{Context.ConnectionId}连接服务端success,当前已连接{clientUsers.Count}个");
|
||||
//Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}");
|
||||
Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}");
|
||||
Clients.All.SendAsync(HubsConstant.MoreNotice, SendNotice());
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace ZR.Admin.WebApi.Hubs
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 注册信息
|
||||
/// 注册信息 todo vue向服务器端发送请求 注意参数一致和集线器转发的客户端
|
||||
/// </summary>
|
||||
/// <param name="connectId"></param>
|
||||
/// <param name="userName"></param>
|
||||
@@ -100,7 +100,6 @@ namespace ZR.Admin.WebApi.Hubs
|
||||
public async Task SendMessage(string connectId, string userName, string message)
|
||||
{
|
||||
Console.WriteLine($"{connectId},message={message}");
|
||||
|
||||
await Clients.Client(connectId).SendAsync("receiveChat", new { userName, message });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ app.UseRateLimiter();
|
||||
//设置socket连接
|
||||
app.MapHub<MessageHub>("/msgHub");
|
||||
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchUrl": "",
|
||||
"applicationUrl": "http://localhost:8888",
|
||||
"applicationUrl": "http://localhost:8889",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
|
||||
"urls": "http://localhost:8888", //(app会默认去读)项目启动url,如果改动端口前端对应devServer也需要进行修改
|
||||
"dbConfigs": [
|
||||
{
|
||||
"Conn": "Data Source=192.168.0.36;User ID=root;Password=123456;Initial Catalog=ZrAdmin;",
|
||||
|
||||
Reference in New Issue
Block a user