示例#1
0
        public object radarHeat(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            string token  = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;

            UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.gID.Equals(token)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
            if (item == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "雷达token不存在"));
            }

            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(item.StoreID, ref storeCacheModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            ClientService service = new ClientService();

            service.Connection();
            RadarHeartbeatRequestDataModel dataModel = new RadarHeartbeatRequestDataModel(token, "");

            byte[] data = DataFactory.CreateRequesProtocolData(TransmiteEnum.雷达心跳, dataModel);
            service.Send(data);

            var obj = new { token = token };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
示例#2
0
        public object getstorepassword(Dictionary <string, object> dicParas)
        {
            string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        Dogid        = dicParas.ContainsKey("dogid") ? dicParas["dogid"].ToString() : string.Empty;
            StoreBusiness store        = new StoreBusiness();
            string        xcGameDBName = string.Empty;
            string        password     = string.Empty;
            string        errMsg       = string.Empty;

            if (!store.IsExistDog(storeId, Dogid))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "加密不合法"));
            }
            if (storeId == "")
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "店号不能为空"));
            }

            if (!store.IsEffectiveStore(storeId, out xcGameDBName, out password, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            storeId = storeId.PadRight(8, '0');
            string pass = Utils.EncryptDES(password, storeId);

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, pass));
        }
示例#3
0
        public object deviceControl(Dictionary <string, object> dicParas)
        {
            string errMsg   = string.Empty;
            string token    = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;
            string mcuid    = dicParas.ContainsKey("mcuid") ? dicParas["mcuid"].ToString() : string.Empty;
            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string action   = dicParas.ContainsKey("controlAction") ? dicParas["controlAction"].ToString() : string.Empty;
            string coins    = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;

            UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.gID.Equals(token)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
            if (item == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "雷达token不存在"));
            }

            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(item.StoreID, ref storeCacheModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            IMemberService memberService = BLLContainer.Resolve <IMemberService>(storeCacheModel.StoreDBName);
            var            memberlist    = memberService.GetModels(x => x.ICCardID.ToString() == icCardId).FirstOrDefault <t_member>();

            if (memberlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码无效"));
            }

            //判断设备状态是否为启用状态
            XCCloudService.BLL.IBLL.XCGame.IDeviceService ids = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(storeCacheModel.StoreDBName);
            var menlist = ids.GetModels(p => p.MCUID.Equals(mcuid, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();

            if (menlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在"));
            }

            if (menlist.state != "启用")
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备未启用"));
            }

            string sn      = UDPSocketAnswerBusiness.GetSN();
            string orderId = System.Guid.NewGuid().ToString("N");
            DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(item.StoreID, memberlist.Mobile, icCardId, item.Segment, mcuid, action, int.Parse(coins), sn, orderId, storeCacheModel.StorePassword, 0, "");

            MPOrderBusiness.AddTCPAnswerOrder(orderId, memberlist.Mobile, int.Parse(coins), action, icCardId, item.StoreID);

            if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg))
            {
                ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, errMsg);
            }

            var obj = new { orderId = orderId, sn = sn };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
示例#4
0
        public object getUserRegister(Dictionary <string, object> dicParas)
        {
            string        errMsg       = string.Empty;
            string        xcGameDBName = string.Empty;
            string        Mobile       = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
            string        StoreId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        UserName     = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string        PassWord     = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;
            string        smsCode      = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
            string        Pass         = Utils.MD5(PassWord);
            StoreBusiness store        = new StoreBusiness();

            if (!store.IsEffectiveStore(StoreId, out xcGameDBName, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            string key = Mobile + "_" + smsCode;

            //判断缓存验证码是否正确
            if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile))
            {
                if (!SMSCodeCache.IsExist(key))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                }
            }
            IUserRegisterService userregisterService = BLLContainer.Resolve <IUserRegisterService>();
            //判断用户名是否存在
            var userlist = userregisterService.GetModels(p => p.UserName == UserName).ToList();

            if (userlist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户名已经存在"));
            }
            //判断用户是否注册
            var menulist = userregisterService.GetModels(p => p.Mobile == Mobile && p.StoreId == StoreId).ToList();

            if (menulist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户已注册"));
            }
            xcGameDBName = "XCGameManagerDB";
            string sql = "exec InsertUserRegister @UserName,@PassWord,@Mobile,@StoreId,@Return output ";

            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0]           = new SqlParameter("@UserName", UserName);
            parameters[1]           = new SqlParameter("@PassWord", Pass);
            parameters[2]           = new SqlParameter("@Mobile", Mobile);
            parameters[3]           = new SqlParameter("@StoreId", StoreId);
            parameters[4]           = new SqlParameter("@Return", 0);
            parameters[4].Direction = System.Data.ParameterDirection.Output;
            t_UserRegister userregister = userregisterService.SqlQuery(sql, xcGameDBName, parameters).FirstOrDefault <t_UserRegister>();

            if (userregister == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户添加异常"));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }
示例#5
0
        public object GetStoreSales(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string storeId    = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string date       = dicParas.ContainsKey("date") ? dicParas["date"].ToString() : string.Empty;
            string icCardId   = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string searchType = dicParas.ContainsKey("searchType") ? dicParas["searchType"].ToString() : string.Empty;

            //验证门店信息
            StoreCacheModel storeModel = null;
            StoreBusiness   store      = new StoreBusiness();

            if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            string sn         = UDPSocketStoreQueryAnswerBusiness.GetSN();
            string radarToken = string.Empty;

            if (!DataFactory.SendDataStoreQuery(storeId, date, sn, searchType, icCardId, storeModel.StorePassword, out radarToken, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            int whileCount = 0;
            UDPSocketStoreQueryAnswerModel answerModel = null;

            while (answerModel == null && whileCount <= 25)
            {
                whileCount++;
                System.Threading.Thread.Sleep(1000);
                answerModel = UDPSocketStoreQueryAnswerBusiness.GetAnswerModel(sn, 2);
            }

            if (answerModel == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
            }

            List <StoreQueryResultNotifyTableData> list = (List <StoreQueryResultNotifyTableData>)(answerModel.Result);

            if (list == null || list.Count == 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else if (list[0].Key.Equals("查询结果") && list[0].Value.Equals("无此营业日期"))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else
            {
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, list));
            }
        }
示例#6
0
        public object getMemberSaveMoney(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg       = string.Empty;
                string xcGameDBName = string.Empty;
                string state        = "0";//设备状态
                string stateName    = string.Empty;
                string password     = string.Empty;
                XCGameMemberTokenModel memberTokenKeyModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
                if (memberTokenKeyModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员令牌不存在"));
                }
                string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                if (MobileToken == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
                }

                string         terminalNo    = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;
                IDeviceService deviceService = BLLContainer.Resolve <IDeviceService>();
                var            deviceModel   = deviceService.GetModels(p => p.TerminalNo.Equals(terminalNo, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_device>();
                if (deviceModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在"));
                }
                string        DeviceStoreID = deviceModel.StoreId;
                string        StoreID       = memberTokenKeyModel.StoreId;
                StoreBusiness store         = new StoreBusiness();
                if (!store.IsEffectiveStore(memberTokenKeyModel.StoreId, out xcGameDBName, out password, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }
                if (DeviceStoreID != StoreID)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "当前设备无效"));
                }
                if (DeviceStateBusiness.ExistDeviceState(deviceModel.StoreId, deviceModel.DeviceId))
                {
                    state = DeviceStateBusiness.GetDeviceState(deviceModel.StoreId, deviceModel.DeviceId);
                }
                if (state != "1")
                {
                    stateName = DeviceStateBusiness.GetStateName(state);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, stateName));
                }

                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#7
0
 public static void StoreDogInit()
 {
     try
     {
         StoreBusiness.StoreDogInit();
         LogHelper.SaveLog(TxtLogType.SystemInit, "XCGameManaStoreDogInit Sucess");
     }
     catch (Exception ex)
     {
         LogHelper.SaveLog(TxtLogType.SystemInit, "XCGameManaStoreInit..." + Utils.GetException(ex));
     }
 }
示例#8
0
        // GET: api/Store/
        public HttpResponseMessage GetAllStores()
        {
            List <Store> list = StoreBusiness.GetStore();

            articulo = new
            {
                stores         = list,
                success        = true,
                total_elements = list.Count
            };
            return(Request.CreateResponse(HttpStatusCode.OK, articulo));
        }
示例#9
0
        public static bool GetParam(string storeId, string requestType, ref ParamQueryResultModel paramQueryResultModel, out string errMsg)
        {
            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(storeId, ref storeCacheModel, out errMsg))
            {
                return(false);
            }

            string sn = System.Guid.NewGuid().ToString().Replace("-", "");
            UDPSocketCommonQueryAnswerModel answerModel = null;
            string radarToken = string.Empty;

            if (DataFactory.SendDataParamQuery(sn, storeId, storeCacheModel.StorePassword, requestType, out radarToken, out errMsg))
            {
            }
            else
            {
                return(false);
            }

            answerModel = null;
            while (answerModel == null)
            {
                System.Threading.Thread.Sleep(1000);
                answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
            }

            if (answerModel != null)
            {
                ParamQueryResultNotifyRequestModel model = (ParamQueryResultNotifyRequestModel)(answerModel.Result);
                //移除应答缓存数据
                UDPSocketCommonQueryAnswerBusiness.Remove(sn);

                if (model.Result_Code == "1")
                {
                    paramQueryResultModel = model.Result_Data;
                    return(true);
                }
                else
                {
                    errMsg = model.Result_Msg;
                    return(false);
                }
            }
            else
            {
                errMsg = "系统没有响应";
                return(false);
            }
        }
示例#10
0
        public object radarRegister(Dictionary <string, object> dicParas)
        {
            string errMsg  = string.Empty;
            string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string segment = dicParas.ContainsKey("segment") ? dicParas["segment"].ToString() : string.Empty;

            XCGameManaAdminUserTokenModel tokenModel = (XCGameManaAdminUserTokenModel)(dicParas[Constant.XCGameManamAdminUserToken]);

            if (tokenModel == null)
            {
                errMsg = "用户没有授权";
                return(false);
            }

            StoreBusiness   storeBusiness   = new StoreBusiness();
            StoreCacheModel storeCacheModel = null;

            if (!storeBusiness.IsEffectiveStore(storeId, ref storeCacheModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            ClientService service = new ClientService();

            service.Connection();
            RadarRegisterRequestDataModel dataModel = new RadarRegisterRequestDataModel(storeId, segment);

            SignKeyHelper.SetSignKey(dataModel, storeCacheModel.StorePassword);
            byte[] data = DataFactory.CreateRequesProtocolData(TransmiteEnum.雷达注册授权, dataModel);
            service.Send(data);

            System.Threading.Thread.Sleep(5000);

            int count = 0;

            UDPClientItemBusiness.ClientItem item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.StoreID.Equals(storeId) && p.Segment.Equals(segment)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
            while (item == null && count < 10)
            {
                item = XCCloudService.SocketService.UDP.ClientList.ClientListObj.Where <UDPClientItemBusiness.ClientItem>(p => p.StoreID.Equals(storeId) && p.Segment.Equals(segment)).FirstOrDefault <UDPClientItemBusiness.ClientItem>();
                System.Threading.Thread.Sleep(1000);
                count++;
            }

            if (item == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "注册失败"));
            }

            var obj = new { token = item.gID };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
示例#11
0
 public HttpResponseMessage EditStore(int id, [FromBody()] Store store)
 {
     if ((store.Id.Equals(id)))
     {
         articulo = new
         {
             success = true,
             store   = StoreBusiness.EditStore(ref store)
         };
         return(Request.CreateResponse(HttpStatusCode.Created, articulo));
     }
     return(Request.CreateResponse(HttpStatusCode.BadRequest, MsgError("Invalid Id Store", 404)));
 }
示例#12
0
 public HttpResponseMessage DeleteStore(int id)
 {
     if ((!id.Equals(0)))
     {
         articulo = new
         {
             success = true,
             store   = StoreBusiness.DeleteStore(id)
         };
         return(Request.CreateResponse(HttpStatusCode.OK, articulo));
     }
     return(Request.CreateResponse(HttpStatusCode.BadRequest, MsgError("Invalid Id Store", 404)));
 }
示例#13
0
 public HttpResponseMessage AddStore([FromBody()] Store store)
 {
     if ((ModelState.IsValid))
     {
         articulo = new
         {
             success = true,
             store   = StoreBusiness.AddStore(store)
         };
         return(Request.CreateResponse(HttpStatusCode.Created, articulo));
     }
     return(Request.CreateResponse(HttpStatusCode.BadRequest, MsgError("Record not Found", 404)));
 }
示例#14
0
        /// <summary>
        /// 读取IC卡信息
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="sessionPool"></param>
        /// <param name="sendIP"></param>
        public static void GetICCard(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string receiveIP        = string.Empty;
            string dogId            = string.Empty;
            string answerMsgType    = Convert.ToInt32(TCPMessageType.读取IC卡).ToString();
            string cardMsg          = string.Empty;
            string storePassword    = string.Empty;
            string icCardId         = string.Empty;
            string repeatCode       = string.Empty;
            string memberRepeatCode = string.Empty;
            string errMsg           = string.Empty;
            //解析消息对象
            SocketDataModel <UserSendObject> socketDataModel = Utils.DataContractJsonDeserializer <SocketDataModel <UserSendObject> >(msg);
            UserSendObject sendObj = socketDataModel.SendObject;

            //接受信息方是否存在
            if (!GetIP(sessionPool, sendObj.UserToken, out receiveIP))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "用户未注册");
                return;
            }
            //获取店密码接口
            string userToken = sendObj.UserToken;

            if (!StoreBusiness.GetStorePassword(userToken, out storePassword, out errMsg))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取门店信息出错");
                return;
            }

            object result_data = null;

            //读取IC卡信息
            if (ICCardUtility.GetICCardID(storePassword, out icCardId, out repeatCode, out errMsg))
            {
                if (MemberBusiness.GetMember(userToken, sendObj.StoreId, icCardId, ref result_data, out errMsg))
                {
                    SendSuccessData(answerMsgType, sessionPool, sendIP, "读取会员信息成功", result_data);
                }
                else
                {
                    SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                }
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
            }
        }
示例#15
0
        public object getRouteToken(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg   = string.Empty;
                string dbName   = string.Empty;
                string password = string.Empty;
                string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string segment  = dicParas.ContainsKey("segment") ? dicParas["segment"].ToString() : string.Empty;
                string token    = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;

                //验证参数
                if (!checkGetRouteTokenParams(dicParas, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                //验证店Id
                StoreBusiness storeBusiness = new StoreBusiness();
                if (!storeBusiness.IsEffectiveStore(storeId, out dbName, out password, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                //验证MD5
                string md5token = Utils.MD5(storeId + segment + password);
                if (!token.Equals(md5token))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "token不正确"));
                }

                //验证segment
                if (!new DeviceBusiness().IsEffectiveStoreSegment(dbName, segment, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                //设置路由设备token
                string radarToken = XCGameRadarDeviceTokenBusiness.SetRadarDeviceToken(storeId, segment);

                RadarTokenModel radarTokenModel = new RadarTokenModel(storeId, segment, radarToken);
                return(ResponseModelFactory <RadarTokenModel> .CreateModel(isSignKeyReturn, radarTokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#16
0
        public HttpResponseMessage GetStoreId(int id)
        {
            Store article = StoreBusiness.GetStoreById(ref id);

            if (article == null)
            {
                respuesta = Request.CreateResponse(HttpStatusCode.NotFound, MsgError("Invalid Idn Store", 404));
                return(respuesta);
            }
            articulo = new
            {
                store          = article,
                success        = true,
                total_elements = 1
            };
            return(Request.CreateResponse(HttpStatusCode.OK, articulo));
        }
示例#17
0
        public object getRegisterRadar(Dictionary <string, object> dicParas)
        {
            try
            {
                string        storeId       = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string        errMsg        = string.Empty;
                string        storeName     = string.Empty;
                StoreBusiness storeBusiness = new StoreBusiness();
                List <UDPClientItemBusiness.ClientItem> clientList  = XCCloudService.SocketService.UDP.ClientList.ClientListObj;
                List <XCGameManaRadarMonitor>           monitorList = new List <XCGameManaRadarMonitor>();

                if (!string.IsNullOrEmpty(storeId))
                {
                    clientList = clientList.Where <UDPClientItemBusiness.ClientItem>(p => p.StoreID.Equals(storeId)).ToList <UDPClientItemBusiness.ClientItem>();
                }

                for (int i = 0; i < clientList.Count; i++)
                {
                    XCGameManaRadarMonitor monitor = new XCGameManaRadarMonitor();
                    monitor.StoreId = clientList[i].StoreID;
                    if (storeBusiness.GetStoreName(monitor.StoreId, out storeName, out errMsg))
                    {
                        monitor.StoreName = storeName;
                    }
                    else
                    {
                        monitor.StoreName = "门店不存在";
                    }
                    monitor.Segment      = clientList[i].Segment;
                    monitor.Token        = clientList[i].gID;
                    monitor.RegisterTime = clientList[i].curTime.ToString("yyyy-MM-dd HH:mm:ss");
                    monitor.HeatTime     = clientList[i].HeatTime.ToString("yyyy-MM-dd HH:mm:ss");
                    monitor.Address      = ((IPEndPoint)(clientList[i].remotePoint)).Address.ToString();
                    monitor.Port         = ((IPEndPoint)(clientList[i].remotePoint)).Port;
                    monitor.StateName    = getStateName(clientList[i].HeatTime);
                    monitorList.Add(monitor);
                }
                return(ResponseModelFactory.CreateSuccessModel <List <XCGameManaRadarMonitor> >(isSignKeyReturn, monitorList));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#18
0
        /// <summary>
        /// 会员存币处理
        /// </summary>
        /// <param name="iccard"></param>
        /// <param name="storeId"></param>
        /// <param name="balance"></param>
        /// <returns></returns>
        public static bool PreservationBusiness(int iccard, int storeId, int balance, out int lastBalance, out string storeName, out string mobile)
        {
            string errMsg = string.Empty;

            lastBalance = 0;
            storeName   = string.Empty;
            mobile      = string.Empty;
            StoreBusiness   storeBusiness = new StoreBusiness();
            StoreCacheModel storeModel    = null;

            if (!storeBusiness.IsEffectiveStore(storeId.ToString(), ref storeModel, out errMsg))
            {
                errMsg = "门店信息不存在";
                return(false);
            }

            storeName = storeModel.StoreName;

            IMemberService memberService = BLLContainer.Resolve <IMemberService>(storeModel.StoreDBName);
            var            model         = memberService.GetModels(p => p.ICCardID == iccard).FirstOrDefault <t_member>();

            if (model == null)
            {
                errMsg = "未查询到该店的会员信息";
                return(false);
            }
            int num = 0;

            if (model.Balance == null)
            {
                num = 0;
            }
            else
            {
                num = (int)(model.Balance);
            }
            num          += balance;
            model.Balance = num;
            lastBalance   = (int)(model.Balance);
            mobile        = model.Mobile;
            memberService.Update(model);
            return(true);
        }
示例#19
0
        public object getmemberInformation(Dictionary <string, object> dicParas)
        {
            string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        Iccard       = dicParas.ContainsKey("iccard") ? dicParas["iccard"].ToString() : string.Empty;
            StoreBusiness store        = new StoreBusiness();
            string        xcGameDBName = string.Empty;
            string        password     = string.Empty;
            string        errMsg       = string.Empty;

            if (!store.IsEffectiveStore(storeId, out xcGameDBName, out password, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            string sql = " exec GetMemberInformation @ICCardID";

            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = new SqlParameter("@ICCardID", Iccard);
            System.Data.DataSet         ds = XCGameBLL.ExecuteQuerySentence(sql, xcGameDBName, parameters);
            RegisterMemberResponseModel registerMemberResponseModel = Utils.GetModelList <RegisterMemberResponseModel>(ds.Tables[0])[0];

            return(ResponseModelFactory <RegisterMemberResponseModel> .CreateModel(isSignKeyReturn, registerMemberResponseModel));
        }
示例#20
0
        public object updateDeviceState(Dictionary <string, object> dicParas)
        {
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string deviceId = dicParas.ContainsKey("deviceId") ? dicParas["deviceId"].ToString() : string.Empty;
            string token    = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;
            string state    = dicParas.ContainsKey("state") ? dicParas["state"].ToString() : string.Empty;

            string        dbName        = string.Empty;
            string        password      = string.Empty;
            string        errMsg        = string.Empty;
            StoreBusiness storeBusiness = new StoreBusiness();

            if (!storeBusiness.IsEffectiveStore(storeId, out dbName, out password, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            DeviceBusiness deviceBusiness = new DeviceBusiness();

            if (!deviceBusiness.IsEffectiveStoreDevice(dbName, deviceId, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }

            //验证MD5
            string md5token = Utils.MD5(storeId + deviceId + password);

            if (!token.Equals(md5token))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "token不正确"));
            }

            //设置设备状态
            DeviceStateBusiness.SetDeviceState(storeId, deviceId, state);

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }
示例#21
0
        public static void ExitICCard(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string receiveIP     = string.Empty;
            string dogId         = string.Empty;
            string storePassword = string.Empty;
            string newICCardId   = string.Empty;
            string errMsg        = string.Empty;
            string answerMsgType = Convert.ToInt32(TCPMessageType.退卡).ToString();
            //解析消息对象
            SocketDataModel <UserSendObject> socketDataModel = Utils.DataContractJsonDeserializer <SocketDataModel <UserSendObject> >(msg);
            UserSendObject sendObj = socketDataModel.SendObject;

            //接受信息方是否存在
            if (!GetIP(sessionPool, sendObj.UserToken, out receiveIP))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "用户未注册");
                return;
            }
            //获取店密码接口
            string userToken = sendObj.UserToken;

            if (!StoreBusiness.GetStorePassword(userToken, out storePassword, out errMsg))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取门店信息出错");
                return;
            }
            //清理卡片
            if (!ICCardUtility.RecoveryICCard(storePassword, out errMsg))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                return;
            }
            else
            {
                SendSuccessData(answerMsgType, sessionPool, sendIP, "会员卡回收成功", null);
            }
        }
示例#22
0
        public object saveCoins(Dictionary <string, object> dicParas)
        {
            try
            {
                string state         = string.Empty;
                string stateName     = string.Empty;
                string xcGameDBName  = string.Empty;
                string errMsg        = string.Empty;
                string storePassword = string.Empty;
                string terminalNo    = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;

                XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
                MobileTokenModel       mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);

                //根据终端号查询终端号是否存在
                XCCloudService.BLL.IBLL.XCGameManager.IDeviceService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IDeviceService>();
                var deviceModel = deviceService.GetModels(p => p.TerminalNo.Equals(terminalNo, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_device>();
                if (deviceModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在"));
                }
                StoreBusiness store = new StoreBusiness();
                if (!store.IsEffectiveStore(deviceModel.StoreId, out xcGameDBName, out storePassword, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                if (!deviceModel.StoreId.Equals(memberTokenModel.StoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员令牌对应门店和设备不一致"));
                }

                //判断设备状态是否为启用状态
                XCCloudService.BLL.IBLL.XCGame.IDeviceService ids = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(xcGameDBName);
                var menlist = ids.GetModels(p => p.MCUID.Equals(deviceModel.DeviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();
                if (menlist == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在"));
                }

                if (menlist.state != "启用")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备未启用"));
                }

                //验证缓存设备状态
                if (DeviceStateBusiness.ExistDeviceState(deviceModel.StoreId, deviceModel.DeviceId))
                {
                    state = DeviceStateBusiness.GetDeviceState(deviceModel.StoreId, deviceModel.DeviceId);
                }
                if (state != "1")
                {
                    stateName = DeviceStateBusiness.GetStateName(state);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, stateName));
                }

                //请求雷达处理存币
                string action  = ((int)(DevieControlTypeEnum.存币)).ToString();
                string sn      = UDPSocketAnswerBusiness.GetSN();
                string orderId = System.Guid.NewGuid().ToString("N");
                DeviceControlRequestDataModel deviceControlModel = new DeviceControlRequestDataModel(deviceModel.StoreId, mobileTokenModel.Mobile, memberTokenModel.ICCardId, menlist.segment, menlist.MCUID, action, 0, sn, orderId, storePassword, 0, "");
                MPOrderBusiness.AddTCPAnswerOrder(orderId, mobileTokenModel.Mobile, 0, action, memberTokenModel.ICCardId, deviceModel.StoreId);
                IconOutLockBusiness.AddByNoTimeLimit(mobileTokenModel.Mobile);
                if (!DataFactory.SendDataToRadar(deviceControlModel, out errMsg))
                {
                    ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, errMsg);
                }

                //设置推送消息的缓存结构
                string form_id = dicParas.ContainsKey("form_id") ? dicParas["form_id"].ToString() : string.Empty;
                SAppMessageMana.SetMemberCoinsMsgCacheData(SAppMessageType.MemberCoinsOperationNotify, orderId, form_id, mobileTokenModel.Mobile, null, out errMsg);

                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#23
0
        public object getfoods(Dictionary <string, object> dicParas)
        {
            try
            {
                string          errMsg     = string.Empty;
                TokenType       tokenType  = TokenType.Member;
                StoreCacheModel storeModel = null;
                List <XCCloudService.Model.XCGame.t_foods>       xcGameFoodsList = null;
                List <XCCloudService.Model.XCCloudRS232.t_foods> rs232FoodsList  = null;

                //获取token模式
                MobileTokenModel       mobileTokenModel = null;
                XCGameMemberTokenModel memberTokenModel = null;
                if (!XCCloudService.Business.XCGame.MeberAndMobileTokenBusiness.GetTokenData(dicParas, out tokenType, ref mobileTokenModel, ref memberTokenModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                //验证门店
                StoreBusiness store = new StoreBusiness();
                if (!store.IsEffectiveStore(memberTokenModel.StoreId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }
                if (storeModel.StoreType == 0)
                {
                    XCCloudService.BLL.IBLL.XCGame.IFoodsService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFoodsService>(storeModel.StoreDBName);
                    xcGameFoodsList = memberService.GetModels(p => p.FoodState.Equals("1") && p.FoodType.Equals("0") && p.ForeAuthorize.ToString().Equals("0")).ToList <XCCloudService.Model.XCGame.t_foods>();
                }
                else if (storeModel.StoreType == 1)
                {
                    XCCloudService.BLL.IBLL.XCCloudRS232.IFoodsService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IFoodsService>();
                    rs232FoodsList = memberService.GetModels(p => p.FoodState == 1).ToList <XCCloudService.Model.XCCloudRS232.t_foods>();
                }

                //根据查询结果输出
                if (xcGameFoodsList == null && rs232FoodsList == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "套餐明细信息不存在"));
                }
                else
                {
                    if (xcGameFoodsList != null)
                    {
                        List <FoodsResponseModel> foodsResponseModel = Utils.GetCopyList <FoodsResponseModel, XCCloudService.Model.XCGame.t_foods>(xcGameFoodsList);
                        SetFoodsResponseModelList(foodsResponseModel);
                        return(ResponseModelFactory <List <FoodsResponseModel> > .CreateModel(isSignKeyReturn, foodsResponseModel));
                    }
                    else
                    {
                        List <FoodsResponseModel> foodsResponseModel = Utils.GetCopyList <FoodsResponseModel, XCCloudService.Model.XCCloudRS232.t_foods>(rs232FoodsList);
                        SetFoodsResponseModelList(foodsResponseModel);
                        return(ResponseModelFactory <List <FoodsResponseModel> > .CreateModel(isSignKeyReturn, foodsResponseModel));
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#24
0
        public object foodsale(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg           = string.Empty;
                string storeName        = string.Empty;
                string foodName         = string.Empty;
                string storePassword    = string.Empty;
                int    icCardId         = 0; //会员
                int    balance          = 0; //币余额
                int    memberLevelId    = 0; //会员级别
                string state            = string.Empty;
                string stateName        = string.Empty;
                string mobile           = string.Empty;
                string segment          = string.Empty;
                string mcuId            = string.Empty;
                string storeId          = string.Empty;
                string deviceId         = string.Empty;
                int    foodId           = 0;
                int    deviceIdentityId = 0;
                string terminalNo       = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;
                string type             = dicParas.ContainsKey("type") ? dicParas["type"].ToString() : string.Empty;
                string paymentype       = dicParas.ContainsKey("Paymentype") ? dicParas["Paymentype"].ToString() : string.Empty; //获取支付方式
                string foodIdStr        = dicParas.ContainsKey("foodid") ? dicParas["foodid"].ToString() : string.Empty;         //获取支付方式
                string money            = dicParas.ContainsKey("money") ? dicParas["money"].ToString() : string.Empty;
                string orderId          = dicParas.ContainsKey("OrderID") ? dicParas["OrderID"].ToString() : string.Empty;
                int    coins            = int.Parse(dicParas.ContainsKey("Coins") ? dicParas["Coins"].ToString() : string.Empty);
                int    foodNum          = int.Parse(dicParas.ContainsKey("foodNum") ? dicParas["foodNum"].ToString() : "1");
                int.TryParse(foodIdStr, out foodId);

                XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
                mobile = memberTokenModel.Mobile;

                if (string.IsNullOrEmpty(orderId))
                {
                    orderId = System.Guid.NewGuid().ToString("N");
                }

                if (type == "购币")
                {
                    string xcGameDBName = string.Empty;
                    //根据终端号查询终端号是否存在
                    XCGameManaDeviceStoreType deviceStoreType;
                    if (!ExtendBusiness.checkXCGameManaDeviceInfo(terminalNo, out deviceStoreType, out storeId, out deviceId))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在"));
                    }
                    //验证会员令牌的门店号和设备门店号
                    if (!memberTokenModel.StoreId.Equals(storeId))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员令牌不能再此设备上操作"));
                    }
                    //验证门店信息和设备状态是否为启用状态
                    if (!ExtendBusiness.checkStoreDeviceInfo(deviceStoreType, storeId, deviceId, out segment, out mcuId, out xcGameDBName, out deviceIdentityId, out storePassword, out storeName, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //验证雷达设备缓存状态
                    if (!ExtendBusiness.checkRadarDeviceState(deviceStoreType, storeId, deviceId, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //获取会员信息
                    if (!ExtendBusiness.GetMemberInfo(deviceStoreType, mobile, xcGameDBName, out balance, out icCardId, out memberLevelId, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //购币
                    if (!BuyCoin(deviceStoreType, xcGameDBName, storeId, icCardId, memberLevelId, foodId, orderId, money, coins, balance, paymentype, deviceId, deviceIdentityId, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //请求雷达处理出币
                    if (!IConUtiltiy.DeviceOutputCoin(deviceStoreType, DevieControlTypeEnum.出币, storeId, mobile, icCardId, orderId, segment, mcuId, storePassword, foodId, coins, string.Empty, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //设置推送消息的缓存结构
                    string form_id = dicParas.ContainsKey("form_id") ? dicParas["form_id"].ToString() : string.Empty;
                    MemberFoodSaleNotifyDataModel dataModel = new MemberFoodSaleNotifyDataModel("购币", storeName, mobile, foodName, foodNum, icCardId, decimal.Parse(money), coins);
                    SAppMessageMana.SetMemberCoinsMsgCacheData(SAppMessageType.MemberFoodSaleNotify, orderId, form_id, mobile, dataModel, out errMsg);
                }
                else if (type == "充值")
                {
                    StoreCacheModel           storeModel = null;
                    XCGameManaDeviceStoreType deviceStoreType;
                    //验证门店
                    StoreBusiness store = new StoreBusiness();
                    if (!store.IsEffectiveStore(memberTokenModel.StoreId, out deviceStoreType, ref storeModel, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //获取会员信息
                    if (!ExtendBusiness.GetMemberInfo(deviceStoreType, mobile, storeModel.StoreDBName, out balance, out icCardId, out memberLevelId, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //充值
                    LogHelper.SaveLog(TxtLogType.Api, TxtLogContentType.Debug, TxtLogFileType.Day, "Recharge:" + errMsg);
                    if (!Recharge(deviceStoreType, mobile, storeModel.StoreDBName, storeId, icCardId, memberLevelId, foodId, orderId, money, coins, balance, paymentype, deviceId, deviceIdentityId, out foodName, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                    //推送消息
                    string form_id = dicParas.ContainsKey("form_id") ? dicParas["form_id"].ToString() : string.Empty;
                    SAppMessageMana.PushMemberFoodSaleMsg("", "", "充值", storeModel.StoreName, mobile, orderId, foodName, foodNum, icCardId, decimal.Parse(money), coins, form_id, out errMsg);
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "类型无效"));
                }


                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#25
0
        private bool CheckAddStore(Dictionary <string, object> dicParas, out string errMsg)
        {
            errMsg = string.Empty;
            string storeId        = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string companyname    = dicParas.ContainsKey("companyname") ? dicParas["companyname"].ToString() : string.Empty;
            string province       = dicParas.ContainsKey("province") ? dicParas["province"].ToString() : string.Empty;
            string address        = dicParas.ContainsKey("address") ? dicParas["address"].ToString() : string.Empty;
            string boss           = dicParas.ContainsKey("boss") ? dicParas["boss"].ToString() : string.Empty;
            string phone          = dicParas.ContainsKey("phone") ? dicParas["phone"].ToString() : string.Empty;
            string telphone       = dicParas.ContainsKey("telphone") ? dicParas["telphone"].ToString() : string.Empty;
            string clienttype     = dicParas.ContainsKey("clienttype") ? dicParas["clienttype"].ToString() : string.Empty;
            string power_due_date = dicParas.ContainsKey("power_due_date") ? dicParas["power_due_date"].ToString() : string.Empty;
            string note           = dicParas.ContainsKey("note") ? dicParas["note"].ToString() : string.Empty;
            string parentid       = dicParas.ContainsKey("parentid") ? dicParas["parentid"].ToString() : string.Empty;
            string developer      = dicParas.ContainsKey("developer") ? dicParas["developer"].ToString() : string.Empty;
            string store_password = dicParas.ContainsKey("store_password") ? dicParas["store_password"].ToString() : string.Empty;
            string wxfee          = dicParas.ContainsKey("wxfee") ? dicParas["wxfee"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(storeId))
            {
                errMsg = "店Id不能为空";
                return(false);
            }

            if (!Utils.isNumber(storeId))
            {
                errMsg = "店Id只能使用数字";
                return(false);
            }

            if (string.IsNullOrEmpty(companyname))
            {
                errMsg = "店名称不能为空";
                return(false);
            }

            if (string.IsNullOrEmpty(address))
            {
                errMsg = "地址不能为空";
                return(false);
            }

            if (string.IsNullOrEmpty(store_password))
            {
                errMsg = "店密码不能为空";
                return(false);
            }

            if (string.IsNullOrEmpty(wxfee))
            {
                errMsg = "费率不能为空";
                return(false);
            }

            if (!Utils.isNumber(wxfee) || int.Parse(wxfee) > 100)
            {
                errMsg = "费率无效";
                return(false);
            }

            if (phone.Length != 11)
            {
                errMsg = "手机号码无效";
                return(false);
            }

            //if (!client_level.Equals("普通级", StringComparison.OrdinalIgnoreCase))
            //{
            //    errMsg = "门店级别无效";
            //    return false;
            //}

            if (!clienttype.Equals("代理商", StringComparison.OrdinalIgnoreCase) && !clienttype.Equals("终端客户", StringComparison.OrdinalIgnoreCase))
            {
                errMsg = "门店类别无效";
                return(false);
            }

            if (!string.IsNullOrEmpty(parentid))
            {
                string[] parentIdArr = parentid.Split(',');
                for (int i = 0; i < parentIdArr.Length; i++)
                {
                    if (string.IsNullOrEmpty(parentIdArr[i]))
                    {
                        errMsg = "门店类别无效";
                        return(false);
                    }

                    StoreBusiness storeBusiness = new StoreBusiness();
                    if (!storeBusiness.IsEffectiveStore(parentIdArr[i], out errMsg))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#26
0
        public object GetGameInfo(Dictionary <string, object> dicParas)
        {
            //获取token模式
            XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
            string        deviceToken  = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;
            StoreBusiness store        = new StoreBusiness();
            string        xcGameDBName = string.Empty;
            string        password     = string.Empty;
            string        errMsg       = string.Empty;
            string        storeId      = string.Empty;

            //验证门店信息
            if (!store.IsEffectiveStore(memberTokenModel.StoreId, out xcGameDBName, out password, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            //验证设备信息
            XCCloudService.Model.XCGameManager.t_device deviceModel = null;
            XCCloudService.Model.XCGame.t_member        memberModel = null;
            if (!DeviceManaBusiness.ExistDevice(deviceToken, ref deviceModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            //验证设备门店信息和会员门店信息
            if (!memberTokenModel.StoreId.Equals(deviceModel.StoreId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            //验证会员信息
            if (!MemberBusiness.IsEffectiveStore(memberTokenModel.Mobile, xcGameDBName, ref memberModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            //验证头信息
            XCCloudService.BLL.IBLL.XCGame.IHeadService headService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IHeadService>(xcGameDBName);
            var headModel = headService.GetModels(p => p.MCUID.Equals(deviceModel.DeviceId)).FirstOrDefault <XCCloudService.Model.XCGame.t_head>();

            if (headModel == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备门店头部信息不存在"));
            }
            //验证游戏机信息
            XCCloudService.BLL.IBLL.XCGame.IGameService gameService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameService>(xcGameDBName);
            var gameModel = gameService.GetModels(p => p.GameID.Equals(headModel.GameID)).FirstOrDefault <XCCloudService.Model.XCGame.t_game>();

            if (gameModel == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备门店头部信息不存在"));
            }
            //获取游戏机投币规则
            XCCloudService.BLL.IBLL.XCGame.IPushRuleService pushRuleService   = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IPushRuleService>(xcGameDBName);
            List <XCCloudService.Model.XCGame.t_push_rule>  pushRuleModelList = pushRuleService.GetModels(p => p.game_id.Equals(headModel.GameID) && p.member_level_id == memberModel.MemberLevelID).OrderBy(p => p.level).ToList <XCCloudService.Model.XCGame.t_push_rule>();
            List <int> pushRuleModelResultList = new List <int>();

            //验证会员是否存在优惠记录
            List <object> gameFreeRuleObjList = new List <object>();
            List <XCCloudService.Model.XCGame.t_game_free_rule> gameFreeRuleModelList = null;

            XCCloudService.BLL.IBLL.XCGame.IFlwGameFreeService flwGameFreeService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFlwGameFreeService>(xcGameDBName);
            var flwGameFreeModel = flwGameFreeService.GetModels(p => p.GameID.Equals(headModel.GameID) && p.ICCardID.Equals(memberModel.ICCardID.ToString())).FirstOrDefault <XCCloudService.Model.XCGame.flw_game_free>();

            if (flwGameFreeModel == null)
            {
                //如果不存在优惠记录,则返回优惠信息
                XCCloudService.BLL.IBLL.XCGame.IGameFreeRuleService gameFreeRuleService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameFreeRuleService>(xcGameDBName);
                gameFreeRuleModelList = gameFreeRuleService.GetModels(
                    p => p.GameID.Equals(headModel.GameID) &&
                    p.MemberLevelID == memberModel.MemberLevelID &&
                    p.State == "启用").ToList <XCCloudService.Model.XCGame.t_game_free_rule>();
            }

            gameFreeRuleModelList = gameFreeRuleModelList.OrderBy(p => p.FreeCoin / decimal.Parse(p.NeedCoin.ToString())).ToList <XCCloudService.Model.XCGame.t_game_free_rule>();

            for (int i = 0; i < gameFreeRuleModelList.Count; i++)
            {
                DateTime currentTime = System.DateTime.Now;
                if (currentTime >= gameFreeRuleModelList[i].StartTime && currentTime <= gameFreeRuleModelList[i].EndTime)
                {
                    var obj = new {
                        id       = gameFreeRuleModelList[i].ID,
                        needCoin = gameFreeRuleModelList[i].NeedCoin,
                        freeCoin = gameFreeRuleModelList[i].FreeCoin,
                        exitCoin = gameFreeRuleModelList[i].ExitCoin
                    };
                    gameFreeRuleObjList.Add(obj);
                }
            }

            foreach (var pushRuleModel in pushRuleModelList)
            {
                if (gameModel.PushReduceFromCard > pushRuleModel.coin)
                {
                    pushRuleModelResultList.Add(Convert.ToInt32(gameModel.PushReduceFromCard));
                }
            }

            if (pushRuleModelResultList.Count == 0)
            {
                pushRuleModelResultList.Add(Convert.ToInt32(gameModel.PushReduceFromCard));
            }

            var obj2 = new {
                gameId        = gameModel.GameID,
                gameName      = gameModel.GameName,
                gameType      = GetGameType(gameModel.GameType),
                price         = gameModel.PushReduceFromCard,
                discountPrice = pushRuleModelResultList[0],
                gameFreeRule  = gameFreeRuleObjList
            };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj2));
        }
示例#27
0
        public object exchangeLottery(Dictionary <string, object> dicParas)
        {
            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);
            string barCode    = dicParas.ContainsKey("barCode") ? dicParas["barCode"].ToString() : string.Empty;
            string icCardId   = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string mobileName = dicParas.ContainsKey("mobileName") ? dicParas["mobileName"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(barCode))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入条码编号"));
            }

            StoreBusiness   store         = new StoreBusiness();
            string          errMsg        = string.Empty;
            StoreCacheModel storeModel    = null;
            StoreBusiness   storeBusiness = new StoreBusiness();

            if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            if (storeModel.StoreDBDeployType == 0)
            {
                XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService lotteryService  = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService>(storeModel.StoreDBName);
                XCCloudService.BLL.IBLL.XCGame.IMemberService     memberService   = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName);
                XCCloudService.BLL.IBLL.XCGame.IScheduleService   scheduleService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IScheduleService>(storeModel.StoreDBName);

                System.DateTime startTime = System.DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
                System.DateTime endTime   = System.DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");

                var lotteryModel  = lotteryService.GetModels(p => p.Barcode.Equals(barCode)).FirstOrDefault <flw_lottery>();
                var memberModel   = memberService.GetModels(p => p.ICCardID.ToString().Equals(icCardId)).FirstOrDefault <t_member>();
                var scheduleModel = scheduleService.GetModels(p => (p.OpenTime >= startTime && p.OpenTime <= endTime && p.UserID == userTokenModel.XCGameUserId && p.State.Equals("0"))).FirstOrDefault <flw_schedule>();

                if (scheduleModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户班次信息不存在"));
                }

                if (lotteryModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "彩票信息不存在"));
                }

                if (lotteryModel.State == 1)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "当前彩票已使用"));
                }

                if (memberModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员信息不存在"));
                }

                XCCloudService.BLL.IBLL.XCGame.IParametersService parametersService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IParametersService>(storeModel.StoreDBName);
                var paramDateValidityModel = parametersService.GetModels(p => p.System.Equals("rbnBackDateValidity", StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_parameters>();
                if (paramDateValidityModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "返分卡有效期参数未设置,不能兑换"));
                }

                DateTime dateTime = Convert.ToDateTime(lotteryModel.PrintTime).AddDays(Convert.ToInt32(paramDateValidityModel.ParameterValue));
                if (System.DateTime.Now > dateTime)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "已过期,不能兑换"));
                }

                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        lotteryModel.State       = 1;
                        lotteryModel.RealTime    = System.DateTime.Now;
                        lotteryModel.ICCardID    = int.Parse(icCardId);
                        lotteryModel.UserID      = userTokenModel.XCGameUserId;
                        lotteryModel.ScheduleID  = scheduleModel.ID;
                        lotteryModel.WorkStation = userTokenModel.Mobile;

                        memberModel.Lottery = Convert.ToInt32(memberModel.Lottery) + lotteryModel.LotteryCount;
                        memberModel.ModTime = System.DateTime.Now;

                        lotteryService.Update(lotteryModel);
                        memberService.Update(memberModel);
                        ts.Complete();

                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                //发送彩票操作
                if (DataFactory.SendDataLotteryOperate(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, barCode, icCardId, "0", mobileName, userTokenModel.Mobile, out radarToken, out errMsg))
                {
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                answerModel = null;
                int whileCount = 0;
                while (answerModel == null && whileCount <= 25)
                {
                    //获取应答缓存数据
                    whileCount++;
                    System.Threading.Thread.Sleep(1000);
                    answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                }

                if (answerModel != null)
                {
                    LotteryOperateResultNotifyRequestModel model = (LotteryOperateResultNotifyRequestModel)(answerModel.Result);
                    //移除应答缓存数据
                    UDPSocketCommonQueryAnswerBusiness.Remove(sn);

                    if (model.Result_Code == "1")
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                }
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, "门店配置无效"));
            }
        }
示例#28
0
        public static void CreateICCard(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string sRepeatCode   = (new Random()).Next(0, 255).ToString();
            string receiveIP     = string.Empty;
            string dogId         = string.Empty;
            string storePassword = string.Empty;
            string newICCardId   = string.Empty;
            string errMsg        = string.Empty;
            string answerMsgType = Convert.ToInt32(TCPMessageType.办理新IC卡).ToString();
            //解析消息对象
            SocketDataModel <UserSendObject, MemberRegisterModel> socketDataModel = Utils.DataContractJsonDeserializer <SocketDataModel <UserSendObject, MemberRegisterModel> >(msg);
            UserSendObject      sendObj             = socketDataModel.SendObject;
            MemberRegisterModel memberRegisterModel = (MemberRegisterModel)(socketDataModel.Data);

            newICCardId = memberRegisterModel.ICCardId;
            //接受信息方是否存在
            if (!GetIP(sessionPool, sendObj.UserToken, out receiveIP))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "用户未注册");
                return;
            }
            //获取店密码接口
            string userToken = sendObj.UserToken;

            if (!StoreBusiness.GetStorePassword(userToken, out storePassword, out errMsg))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取门店信息出错");
                return;
            }
            //验证是否可以办卡
            if (ICCardUtility.CheckNullCard(storePassword))
            {
                if (MemberBusiness.CheckMemberCanRegister(userToken, memberRegisterModel.StoreId, memberRegisterModel.Mobile, out errMsg))
                {
                    //办理新卡
                    if (ICCardUtility.CreateICCard(newICCardId, sRepeatCode, storePassword, out errMsg, true))
                    {
                        memberRegisterModel.RepeatCode = sRepeatCode;
                        object result_data = null;
                        int    repeatCode  = 0;
                        if (MemberBusiness.MemberRegister(memberRegisterModel, out repeatCode, out errMsg, ref result_data))
                        {
                            SendSuccessData(answerMsgType, sessionPool, sendIP, "会员卡开通成功", result_data);
                        }
                        else
                        {
                            SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                        }
                    }
                    else
                    {
                        SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                    }
                }
                else
                {
                    SendFailData(answerMsgType, sessionPool, sendIP, errMsg);
                }
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "本卡已使用,请插入空卡");
            }
        }
示例#29
0
        public object getLotteryInfo(Dictionary <string, object> dicParas)
        {
            string gameName = string.Empty;
            string headInfo = string.Empty;
            string barCode  = dicParas.ContainsKey("barCode") ? dicParas["barCode"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(barCode))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入条码编号"));
            }

            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);
            StoreBusiness             store          = new StoreBusiness();
            string          errMsg        = string.Empty;
            StoreCacheModel storeModel    = null;
            StoreBusiness   storeBusiness = new StoreBusiness();

            if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            if (storeModel.StoreDBDeployType == 0)
            {
                XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService lotteryService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService>(storeModel.StoreDBName);
                XCCloudService.BLL.IBLL.XCGame.IHeadService       headService    = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IHeadService>(storeModel.StoreDBName);
                XCCloudService.BLL.IBLL.XCGame.IGameService       gameService    = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameService>(storeModel.StoreDBName);

                var lotteryModel = lotteryService.GetModels(p => p.Barcode.Equals(barCode)).FirstOrDefault <flw_lottery>();
                if (lotteryModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "彩票信息不存在"));
                }

                if (!string.IsNullOrEmpty(lotteryModel.HeadID))
                {
                    //var headModel = headService.GetModels(p => p.HeadAddress.Equals(lotteryModel.HeadID)).FirstOrDefault<t_head>();
                    headInfo = lotteryModel.HeadID;
                }
                else
                {
                    headInfo = lotteryModel.WorkStation;
                }

                if (!string.IsNullOrEmpty(lotteryModel.GameID))
                {
                    var gameModel = gameService.GetModels(p => p.GameID.Equals(lotteryModel.GameID)).FirstOrDefault <t_game>();
                    if (gameModel != null)
                    {
                        gameName = gameModel.GameName;
                    }
                    else
                    {
                        gameName = string.Empty;
                    }
                }
                else
                {
                    gameName = string.Empty;
                }

                XCCloudService.BLL.IBLL.XCGame.IParametersService parametersService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IParametersService>(storeModel.StoreDBName);
                var paramDateValidityModel = parametersService.GetModels(p => p.System.Equals("rbnBackDateValidity", StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_parameters>();
                if (paramDateValidityModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "返分卡有效期参数未设置,不能兑换"));
                }

                int    state     = Convert.ToInt32(lotteryModel.State);
                string stateName = lotteryModel.State == 1 ? "已兑" : "未兑";
                if (state != 1)
                {
                    DateTime dateTime = Convert.ToDateTime(lotteryModel.PrintTime).AddDays(Convert.ToDouble(paramDateValidityModel.ParameterValue));
                    if (System.DateTime.Now > dateTime)
                    {
                        state     = 2;
                        stateName = "已过期";
                    }
                }

                string printTime = Convert.ToDateTime(lotteryModel.PrintTime).ToString("yyyy-MM-dd HH:mm:ss");
                string realTime  = Convert.ToDateTime(lotteryModel.RealTime).ToString("yyyy-MM-dd HH:mm:ss");

                var obj = new {
                    id       = lotteryModel.id,
                    lottery  = lotteryModel.LotteryCount,                                   //彩票数
                    gameName = gameName,                                                    //游戏机名
                    headInfo = headInfo,                                                    //出票位置
                    state    = stateName,                                                   //小票状态
                    makeTime = printTime.Substring(0, 10) == "0001-01-01" ? "" : printTime, //出票时间
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                //string storeId, string storePassword, string barCode,string icCardId,string mobileName, string phone, string operate, out string errMsg
                if (DataFactory.SendDataLotteryQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, barCode, out radarToken, out errMsg))
                {
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                answerModel = null;
                int whileCount = 0;
                while (answerModel == null && whileCount <= 25)
                {
                    //获取应答缓存数据
                    whileCount++;
                    System.Threading.Thread.Sleep(1000);
                    answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                }

                if (answerModel != null)
                {
                    LotteryQueryResultNotifyRequestModel model = (LotteryQueryResultNotifyRequestModel)(answerModel.Result);
                    //移除应答缓存数据
                    UDPSocketCommonQueryAnswerBusiness.Remove(sn);

                    if (model.Result_Code == "1")
                    {
                        var obj = new
                        {
                            id       = model.Result_Data.Id,
                            lottery  = model.Result_Data.Lottery,  //彩票数
                            gameName = model.Result_Data.GameName, //游戏机名
                            headInfo = model.Result_Data.HeadInfo, //出票位置
                            state    = model.Result_Data.State,    //小票状态
                            makeTime = model.Result_Data.PrintDate //出票时间
                        };

                        return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                }
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店配置无效"));
            }
        }
示例#30
0
        public object getMemberToken(Dictionary <string, object> dicParas)
        {
            bool   isMember = false;
            string errMsg   = string.Empty;
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

            try
            {
                MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);
                //获取终端号是否存在
                StoreCacheModel storeModel    = null;
                StoreBusiness   storeBusiness = new StoreBusiness();
                if (!storeBusiness.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                //是否注册会员
                MemberResponseModel memberResponseModel = null;
                System.Data.DataSet ds = null;
                if (storeModel.StoreType == 0)
                {
                    XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName);
                    var count = memberService.GetModels(p => p.Mobile.Equals(mobileTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCGame.t_member>();
                    if (count == 0)
                    {
                        string         sql        = " exec RegisterMember @Mobile,@MemberPassword,@WXOpenID,@Return output ";
                        SqlParameter[] parameters = new SqlParameter[4];
                        parameters[0]           = new SqlParameter("@Mobile", mobileTokenModel.Mobile);
                        parameters[1]           = new SqlParameter("@MemberPassword", "888888");
                        parameters[2]           = new SqlParameter("@WXOpenID", "");
                        parameters[3]           = new SqlParameter("@Return", 0);
                        parameters[3].Direction = System.Data.ParameterDirection.Output;
                        ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                    }
                    else
                    {
                        string         sql        = " exec GetMember @Mobile,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[2];
                        parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile);
                        parameters[1] = new SqlParameter("@ICCardID", "0");
                        ds            = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                    }
                    memberResponseModel             = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                    memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                    isMember = true;
                }
                else if (storeModel.StoreType == 1)
                {
                    XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>();
                    var count = memberService.GetModels(p => p.Mobile.Equals(mobileTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCCloudRS232.t_member>();
                    if (count == 0)
                    {
                        string         sql        = " exec RegisterMember @Mobile,@MerchId,@MemberPassword,@WXOpenID,@Return output ";
                        SqlParameter[] parameters = new SqlParameter[5];
                        parameters[0]           = new SqlParameter("@Mobile", mobileTokenModel.Mobile);
                        parameters[1]           = new SqlParameter("@MerchId", storeId);
                        parameters[2]           = new SqlParameter("@MemberPassword", "888888");
                        parameters[3]           = new SqlParameter("@WXOpenID", "");
                        parameters[4]           = new SqlParameter("@Return", 0);
                        parameters[4].Direction = System.Data.ParameterDirection.Output;
                        ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
                    }
                    else
                    {
                        string         sql        = " exec GetMember @Mobile,@MerchId,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[3];
                        parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile);
                        parameters[1] = new SqlParameter("@MerchId", storeId);
                        parameters[2] = new SqlParameter("@ICCardID", "0");
                        ds            = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
                    }
                    memberResponseModel             = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                    memberResponseModel.MemberState = "有效";
                    isMember = true;
                }
                else
                {
                    isMember = false;
                }

                //设置会员token
                string token = string.Empty;
                if (isMember)
                {
                    token = MemberTokenBusiness.SetMemberToken(storeId, mobileTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                }

                MemberTokenResponseModel memberTokenModel = new MemberTokenResponseModel(storeId, storeModel.StoreName, token, isMember, memberResponseModel);
                return(ResponseModelFactory <MemberTokenResponseModel> .CreateModel(isSignKeyReturn, memberTokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }