| | |
| | | logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | | } |
| | | ///有自动列表才处理 |
| | | if (logicDataList.Count>0) { |
| | | if (logicDataList.Count > 0) |
| | | { |
| | | ///遍历所有列表 |
| | | for (int i = 0; i < logicDataList.Count; i++) |
| | | { |
| | |
| | | //定义一个局部变量 |
| | | string direction = string.Empty; |
| | | //两点距离小于配置距离<既自动化配置输入条件地理围栏半径>,说明进入区域 |
| | | if (r<radius) { |
| | | if (r < radius) |
| | | { |
| | | //到达某地 |
| | | direction = "arrive"; |
| | | } else { |
| | | } |
| | | else |
| | | { |
| | | //离开 |
| | | direction = "leave"; |
| | | } |
| | | var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction); |
| | | if (isPush == null) |
| | | { |
| | | //推送给云端是否成功 |
| | | bool f= Send.GeoFenceStateReport(logicDate.userLogicId,logicDate.sid, direction); |
| | | //if () { } |
| | | //Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction); |
| | | if (push) |
| | | { |
| | | pushList.Add(new Push |
| | | { |
| | | homeId = HomeId, |
| | | userId = UserInfo.Current.ID, |
| | | userLogicId = logicDate.userLogicId, |
| | | arriveOnLeave = direction, |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | private static List<Push> pushList = new List<Push>(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | public class DD { |
| | | |
| | | public class Push |
| | | { |
| | | /// <summary> |
| | | /// 云端唯一id |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public string homeId = ""; |
| | | /// <summary> |
| | | /// 是否推送过(true:已经推送,false:没有不推送) |
| | | /// 到达某地 离开 |
| | | /// </summary> |
| | | public bool IsPush; |
| | | public string arriveOnLeave = ""; |
| | | /// <summary> |
| | | /// 到达某地 |
| | | /// 用户id |
| | | /// </summary> |
| | | public string arrive = ""; |
| | | /// <summary> |
| | | /// 离开 |
| | | /// </summary> |
| | | public string leave = ""; |
| | | public string userId = ""; |
| | | |
| | | } |
| | | } |