减少通信字段;通信添加比赛字段;

This commit is contained in:
suntao 2020-12-01 10:13:53 +08:00
parent 3e28d52154
commit 70abe45eb0
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
@ -39,6 +40,6 @@ namespace OnlineUserPool.Model
/// </summary>
public double WeightKg { get; set; }
public int Competitionid { get; set; }
}
}

View File

@ -199,7 +199,19 @@ namespace OnlineUserPool.ViewModels
private static void SendMessage(Collection<HostModel> clients, List<MsgModel> msgModels)
{
string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(msgModels);
string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(msgModels.Select(m=> new {
m.RouteId,
m.MemberId,
m.Point,
m.IsCompleted,
m.exit,
m.Speed,
m.PreDistance,
m.EndDistance,
m.IsVirtual,//后面要把这个字段过滤掉
m.WeightKg,
m.Competitionid
}));
var data = Encoding.ASCII.GetBytes(jsonString);
foreach (var item in clients)
{