/// <summary> /// 关闭当前客户端 /// </summary> /// <param name="service"></param> internal void CloseService(Client service) { try { // 如果有老的通讯, 先终止掉它 if (null != service.ClientChannel) { ServiceOperate.GetServiceOperate().AbortOldChannel(service.ClientChannel); } else if (null != service.SignalRClientSessionId) { var hub = GlobalHost.ConnectionManager.GetHubContext <ServiceHub>(); //hub.Clients.Client(service.SignalRClientSessionId).Close(); // SingnalR这个设计....不能手动关闭连接... } service.Dispose(); } catch (Exception ex) { ExceptionPro.ExpLog(ex); } Resources.GetRes().Services.Remove(service); }
/// <summary> /// 服务新情求 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceNewRequest ServiceNewRequest(ToServerServiceNewRequest toServer) { string IpAddress = Context?.Request?.Environment["server.RemoteIpAddress"]?.ToString(); if (!string.IsNullOrWhiteSpace(IpAddress)) { // 实属无奈, SignalR设计原因只能这么做了.... if (null == ServiceHubContext.Instance.ServiceHub) { ServiceHubContext.Instance.Initial(this); } } return(ServiceOperate.GetServiceOperate().ServiceNewRequest(toServer, Context?.ConnectionId, IpAddress)); }
/// <summary> /// 清理其他人用的账户 /// </summary> private void CleanUsedByOtherService() { List <Client> removeUsedServiceCount = new List <Client>(); foreach (var item in Resources.GetRes().ServicesUsedByOther) { if ((DateTime.Now - item.CheckDate).TotalSeconds >= 60 * 3) { // 这里之所以保留原始逻辑, 即便不按原始逻辑检测, 到时session也会失效 int countLimit = 1; if (item.LostCount >= countLimit) { removeUsedServiceCount.Add(item); } else { ++item.LostCount; } } else { item.LostCount = 0; } } //移出失效的 foreach (var item in removeUsedServiceCount) { lock (Resources.GetRes().ServicesUsedByOther) { // 如果有老的通讯, 先终止掉它 if (null != item.ClientChannel) { ServiceOperate.GetServiceOperate().AbortOldChannel(item.ClientChannel); } item.Dispose(); Resources.GetRes().ServicesUsedByOther.Remove(item); } } }
/// <summary> /// 删除管理员 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelAdmin ServiceDelAdmin(ToServerServiceDelAdmin toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelAdmin(toServer)); }
/// <summary> /// 增加管理员支付 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceAddAdminPay ServiceAddAdminPay(ToServerServiceAddAdminPay toServer) { return(ServiceOperate.GetServiceOperate().ServiceAddAdminPay(toServer)); }
/// <summary> /// 修改产品 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceEditProduct ServiceEditProduct(ToServerServiceEditProduct toServer) { return(ServiceOperate.GetServiceOperate().ServiceEditProduct(toServer)); }
/// <summary> /// 删除包厢 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelRoom ServiceDelRoom(ToServerServiceDelRoom toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelRoom(toServer)); }
/// <summary> /// 查找会员 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetMember ServiceGetMembers(ToServerServiceGetMember toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetMembers(toServer)); }
/// <summary> /// 新建订单 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceNewOrder ServiceAddOrder(ToServerServiceNewOrder toServer) { return(ServiceOperate.GetServiceOperate().ServiceAddOrder(toServer)); }
/// <summary> /// 删除订单明细 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelTakeoutDetail ServiceDelTakeoutDetail(ToServerServiceDelTakeoutDetail toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelTakeoutDetail(toServer)); }
/// <summary> /// 修改密码 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceChangePWD ServiceChangePWD(ToServerServiceChangePWD toServer) { return(ServiceOperate.GetServiceOperate().ServiceChangePWD(toServer)); }
/// <summary> /// 新建外卖 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceNewTakeout ServiceAddTakeout(ToServerServiceNewTakeout toServer) { return(ServiceOperate.GetServiceOperate().ServiceAddTakeout(toServer)); }
/// <summary> /// 查找外卖 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetTakeouts ServiceGetTakeout(ToServerServiceGetTakeouts toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetTakeout(toServer)); }
/// <summary> /// 修改订单明细 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceSaveOrderDetail ServiceSaveOrderDetail(ToServerServiceSaveOrderDetail toServer) { return(ServiceOperate.GetServiceOperate().ServiceSaveOrderDetail(toServer)); }
/// <summary> /// 查找订单 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetOrders ServiceGetOrders(ToServerServiceGetOrders toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetOrders(toServer)); }
/// <summary> /// 替换订单 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceReplaceOrder ServiceReplaceOrder(ToServerServiceReplaceOrder toServer) { return(ServiceOperate.GetServiceOperate().ServiceReplaceOrder(toServer)); }
/// <summary> /// 查找余额 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetBalance ServiceGetBalances(ToServerServiceGetBalance toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetBalances(toServer)); }
/// <summary> /// 增加进货及明细 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceNewImport ServiceAddImportWithDetail(ToServerServiceNewImport toServer) { return(ServiceOperate.GetServiceOperate().ServiceAddImportWithDetail(toServer)); }
/// <summary> /// 删除余额支付 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelBalancePay ServiceDelBalancePay(ToServerServiceDelBalancePay toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelBalancePay(toServer)); }
/// <summary> /// 修改供应商 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceEditSupplier ServiceEditSupplier(ToServerServiceEditSupplier toServer) { return(ServiceOperate.GetServiceOperate().ServiceEditSupplier(toServer)); }
/// <summary> /// 查找管理员日志(按管理员) /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetAdminLog ServiceGetAdminLog(ToServerServiceGetAdminLog toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetAdminLog(toServer)); }
/// <summary> /// 查找供应商支付(按供应商) /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetSupplierPay ServiceGetSupplierPay(ToServerServiceGetSupplierPay toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetSupplierPay(toServer)); }
/// <summary> /// 获取UID /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceUID ServiceUID(ToServerServiceUID toServer) { return(ServiceOperate.GetServiceOperate().ServiceUID(toServer)); }
/// <summary> /// 删除产品类型 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelProductType ServiceDelProductType(ToServerServiceDelProductType toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelProductType(toServer)); }
/// <summary> /// 写入设置 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceSetCon ServiceSetCon(ToServerServiceSetCon toServer) { return(ServiceOperate.GetServiceOperate().ServiceSetCon(toServer)); }
/// <summary> /// 编辑进货 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceEditImport ServiceEditImport(ToServerServiceEditImport toServer) { return(ServiceOperate.GetServiceOperate().ServiceEditImport(toServer)); }
/// <summary> /// 删除打印机 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceDelPrinter ServiceDelPrinter(ToServerServiceDelPrinter toServer) { return(ServiceOperate.GetServiceOperate().ServiceDelPrinter(toServer)); }
/// <summary> /// 查找进货 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetImports ServiceGetImports(ToServerServiceGetImports toServer) { return(ServiceOperate.GetServiceOperate().ServiceGetImports(toServer)); }
/// <summary> /// 查找进货明细(按订单) /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceGetImportDetail ServiceGeImportDetail(ToServerServiceGetImportDetail toServer) { return(ServiceOperate.GetServiceOperate().ServiceGeImportDetail(toServer)); }
/// <summary> /// 刷新会话 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceSession ServiceSession(ToServerServiceSession toServer) { string IpAddress = Context?.Request?.Environment["server.RemoteIpAddress"]?.ToString(); return(ServiceOperate.GetServiceOperate().ServiceSession(toServer, Context?.ConnectionId, IpAddress)); }