Esempio n. 1
0
 private void 增加(List <string> __号码列表, IPEndPoint __地址)
 {
     HB日志.记录("订阅", string.Format("{0} 增加 {1}", __地址, string.Join(",", __号码列表)));
     if (!_客户端订阅缓存.ContainsKey(__地址))
     {
         _客户端订阅缓存[__地址] = __号码列表;
     }
     else
     {
         var __合并 = new List <int>();
         _客户端订阅缓存[__地址].AddRange(__号码列表);
         _客户端订阅缓存[__地址] = _客户端订阅缓存[__地址].Distinct().ToList();
     }
     __号码列表.ForEach(q =>
     {
         if (!_号码状态缓存.ContainsKey(q))
         {
             _号码状态缓存[q] = new M号码状态();
         }
         if (!_号码状态缓存[q].订购者.Contains(__地址))
         {
             _号码状态缓存[q].订购者.Add(__地址);
         }
         if (_号码状态缓存[q].最后位置 != null && _号码状态缓存[q].最后位置.时间.AddMinutes(2) > DateTime.Now)
         {
             _IT服务端.触发事件("订阅", "GPS上报", new Dictionary <string, string> {
                 { "号码", q }, { "GPS", HJSON.序列化(_号码状态缓存[q].最后位置) }
             }, new List <IPEndPoint> {
                 __地址
             });
         }
     });
 }
Esempio n. 2
0
        void _IB插件_GPS上报(string __号码, MGPS __GPS)
        {
            if (!_号码状态缓存.ContainsKey(__号码))
            {
                _号码状态缓存[__号码] = new M号码状态()
                {
                    最后位置 = __GPS
                };
            }
            _号码状态缓存[__号码].最后位置 = __GPS;

            var __地址列表 = 查询号码(__号码);

            if (__地址列表.Count == 0)
            {
                return;
            }
            _IT服务端.触发事件("订阅", "GPS上报", new Dictionary <string, string> {
                { "号码", __号码.ToString() }, { "GPS", HJSON.序列化(__GPS) }
            }, __地址列表);
        }