forked from powerfun/udpservice
减少通信字段;通信添加比赛字段;
This commit is contained in:
parent
3e28d52154
commit
70abe45eb0
@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user