/// <summary> /// 后台指派订单给骑手,通知骑手 /// </summary> public void PushRiderServerAssign(OrderInfo order) { var rider = RiderInfoOper.Instance.GetById((int)order.riderId); var dict = new Dictionary <string, string>(); RiderPush.PostOne(rider.deviceToken, set.serverAssignRiderTips, "test", dict); }
/// <summary> /// 骑手向别人请求菜品,发送到别人那的消息 /// </summary> /// <param name="targetRiderId"></param> /// <param name="foodId"></param> /// <param name="amount"></param> /// <param name="riderId"></param> public void PushRiderApply(int targetRiderId, List <foodId_Amount> listFoods, int riderId, string timestamp) { var list = CacheHelper.GetByCondition <RiderInfo>("riderinfo", " id in (" + riderId + "," + targetRiderId + ")"); var name = list.Where(p => p.id == riderId).First().name; var deviceToken = list.Where(p => p.id == targetRiderId).First().deviceToken; var ids = listFoods.Select(p => p.foodId).Distinct().ToArray(); var idsStr = string.Join(",", ids); var foodList = CacheHelper.GetByCondition <FoodInfo>("foodinfo", " id in (" + idsStr + ")"); var str = "骑手" + name + "向您请求调配"; foreach (var item in foodList) { var listTemp = listFoods.Where(p => p.foodId == item.id).ToList(); if (listTemp.Count > 0) { var amount = listTemp.First().amount; str += amount + "份" + item.foodName + ","; } } str = StringHelperHere.Instance.RemoveLastOne(str); var dict = new Dictionary <string, string>(); dict.Add("timestamp", timestamp); //RiderPush.PostOne(deviceToken, "有新的调配请求", "allocate", dict); RiderPush.PostOne(deviceToken, str, "allocate", dict); }
/// <summary> /// 骑手同意别人的请求 /// </summary> /// <param name="targetRiderId"></param> /// <param name="riderId"></param> public void PushRiderAgree(int targetRiderId, int riderId) { var list = CacheHelper.GetByCondition <RiderInfo>("riderinfo", " id in (" + riderId + "," + targetRiderId + ")"); var name = list.Where(p => p.id == targetRiderId).First().name; var deviceToken = list.Where(p => p.id == riderId).First().deviceToken; var str = "骑手" + name + "已同意您的调配请求"; RiderPush.PostOne(deviceToken, str, "allocate", new Dictionary <string, string>()); }
/// <summary> /// 告诉自提点有新预定订单 /// </summary> /// <param name="order"></param> public void PushShopNewReserveOrder(OrderInfo order) { var rider = RiderInfoOper.Instance.GetById((int)order.riderId); var deviceToken = rider.deviceToken; var dict = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(deviceToken)) { RiderPush.PostOne(deviceToken, "您有新的预定订单", "shopNewOrder", dict); } }
/// <summary> /// 告诉骑手,订单可以回收了 /// </summary> public void PushRiderToRecovery(OrderInfo order) { var rider = RiderInfoOper.Instance.GetById((int)order.riderId); var deviceToken = rider.deviceToken; var dict = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(deviceToken)) { RiderPush.PostOne(deviceToken, set.recoveryBoxTips, "CycleOrder", dict); } }