Ejemplo n.º 1
0
        public static void LotteryOperateNotify(string requestDataJson, UDPClientItemBusiness.ClientItem item)
        {
            string routeDeivceToken = string.Empty;
            string password         = string.Empty;
            string errMsg           = string.Empty;

            //获取雷达通知请求数据模式
            LotteryOperateResultNotifyRequestModel requestDataModel = JsonHelper.DataContractJsonDeserializer <LotteryOperateResultNotifyRequestModel>(requestDataJson);
            UDPSocketCommonQueryAnswerModel        asnwerModel      = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(requestDataModel.SN);

            if (requestDataModel.Result_Data == null)
            {
                requestDataModel.Result_Data = "";
            }
            //验证MD5
            if (!SignKeyHelper.CheckSignKey(requestDataModel, asnwerModel.StorePassword))
            {
                errMsg = "签名不正确";
                return;
            }

            asnwerModel.Status = 1;
            asnwerModel.Result = requestDataModel;

            SignalrServerToClient.BroadcastMessage(Convert.ToInt32(TransmiteEnum.远程门店彩票操作请求响应), "远程门店彩票操作请求响应", asnwerModel.RadarToken, requestDataJson);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        public static void CattleMemberCardQueryNotify(string requestDataJson, UDPClientItemBusiness.ClientItem item)
        {
            string errMsg = string.Empty;

            //获取雷达通知请求数据模式
            CattleMemberCardQueryResultNotifyRequestModel requestDataModel = JsonHelper.DataContractJsonDeserializer <CattleMemberCardQueryResultNotifyRequestModel>(requestDataJson);
            UDPSocketCommonQueryAnswerModel asnwerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(requestDataModel.SN);

            //验证MD5
            if (!SignKeyHelper.CheckSignKey(requestDataModel, asnwerModel.StorePassword))
            {
                errMsg = "签名不正确";
                return;
            }

            asnwerModel.Status = 1;
            asnwerModel.Result = requestDataModel;

            SignalrServerToClient.BroadcastMessage(Convert.ToInt32(TransmiteEnum.黄牛卡信息查询请求响应), "黄牛卡信息查询请求响应", asnwerModel.RadarToken, requestDataJson);
        }
Ejemplo n.º 4
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, "门店配置无效"));
            }
        }
Ejemplo n.º 5
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, "门店配置无效"));
            }
        }
Ejemplo n.º 6
0
        public object getCustomCardInfo(Dictionary <string, object> dicParas)
        {
            string          errMsg     = string.Empty;
            StoreCacheModel storeModel = null;

            System.Data.DataSet ds = null;

            //获取token模式
            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);
            //验证门店
            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)
            {
                string sql = @" select ICCardID,MemberName,Gender,convert(char(10),Birthday,120) as Birthday,CertificalID,Mobile,Balance,Point,a.Deposit,MemberState,Lottery,Note,convert(char(10),EndDate,120) as EndDate,MemberLevelName from t_member a left join t_memberlevel b on a.MemberLevelID = b.MemberLevelID 
                                where MemberLevelName = '黄牛卡' or  MemberLevelName = '收分卡' ";

                //如果是门店模式
                ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, null);
                List <CattleMemberCardDetailModel> list = new List <CattleMemberCardDetailModel>();
                if (ds != null && ds.Tables.Count >= 1)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        CattleMemberCardDetailModel cattleMemberCardDetailModel = Utils.GetModelList <CattleMemberCardDetailModel>(ds.Tables[0])[i];
                        cattleMemberCardDetailModel.MemberState = MemberBusiness.GetMemberStateName(cattleMemberCardDetailModel.MemberState);
                        list.Add(cattleMemberCardDetailModel);
                    }
                    CattleMemberCardModel cardModel = new CattleMemberCardModel(storeModel.StoreID.ToString(), storeModel.StoreName, list);
                    return(ResponseModelFactory <CattleMemberCardModel> .CreateModel(isSignKeyReturn, cardModel));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, ""));
                }
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                if (DataFactory.SendDataCattleMemberCardQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, "0", out radarToken, out errMsg))
                {
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

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

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

                    if (model1.Result_Code == "1")
                    {
                        List <CattleMemberCardDetailModel> list = new List <CattleMemberCardDetailModel>();
                        for (int i = 0; i < model1.Result_Data.Count; i++)
                        {
                            CattleMemberCardDetailModel detailModel = new CattleMemberCardDetailModel();
                            detailModel.ICCardID    = int.Parse(model1.Result_Data[i].ICCardId);
                            detailModel.MemberName  = model1.Result_Data[i].Name;
                            detailModel.MemberState = model1.Result_Data[i].MemberState;
                            detailModel.Mobile      = model1.Result_Data[i].Phone;
                            list.Add(detailModel);
                        }
                        CattleMemberCardModel cardModel = new CattleMemberCardModel(storeModel.StoreID.ToString(), storeModel.StoreName, list);
                        return(ResponseModelFactory <CattleMemberCardModel> .CreateModel(isSignKeyReturn, cardModel));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "查询数据出错"));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "查询数据出错"));
                }
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "查询数据出错"));
            }
        }
Ejemplo n.º 7
0
        public object getInfo2(Dictionary <string, object> dicParas)
        {
            try
            {
                string              errMsg     = string.Empty;
                StoreCacheModel     storeModel = null;
                System.Data.DataSet ds         = null;

                //获取token模式
                XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);
                string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;

                //验证门店
                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)
                {
                    //如果是门店模式
                    string         sql        = " exec GetMember @Mobile,@ICCardID";
                    SqlParameter[] parameters = new SqlParameter[2];
                    parameters[0] = new SqlParameter("@Mobile", "");
                    parameters[1] = new SqlParameter("@ICCardID", icCardId);
                    ds            = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                    if (ds != null && ds.Tables.Count >= 1)
                    {
                        RegisterMemberResponseModel registerMemberResponseModel = Utils.GetModelList <RegisterMemberResponseModel>(ds.Tables[0])[0];
                        registerMemberResponseModel.StoreId     = storeModel.StoreID.ToString();
                        registerMemberResponseModel.StoreName   = storeModel.StoreName;
                        registerMemberResponseModel.MemberState = MemberBusiness.GetMemberStateName(registerMemberResponseModel.MemberState);
                        return(ResponseModelFactory <RegisterMemberResponseModel> .CreateModel(isSignKeyReturn, registerMemberResponseModel));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, ""));
                    }
                }
                else if (storeModel.StoreDBDeployType == 1)
                {
                    string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                    UDPSocketCommonQueryAnswerModel answerModel = null;
                    string radarToken = string.Empty;
                    if (DataFactory.SendDataMemberQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, icCardId, out radarToken, out errMsg))
                    {
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }

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

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

                        if (model.Result_Code == "1")
                        {
                            RegisterMemberResponseModel registerMemberResponseModel = new RegisterMemberResponseModel();
                            registerMemberResponseModel.ICCardID        = int.Parse(model.Result_Data.ICCardID);
                            registerMemberResponseModel.MemberName      = model.Result_Data.MemberName;
                            registerMemberResponseModel.Gender          = model.Result_Data.Gender;
                            registerMemberResponseModel.Birthday        = model.Result_Data.Birthday;
                            registerMemberResponseModel.CertificalID    = model.Result_Data.CertificalID;
                            registerMemberResponseModel.Mobile          = model.Result_Data.Mobile;
                            registerMemberResponseModel.Balance         = Convert.ToInt32(model.Result_Data.Balance);
                            registerMemberResponseModel.Point           = Convert.ToInt32(model.Result_Data.Point);
                            registerMemberResponseModel.Deposit         = model.Result_Data.Deposit;
                            registerMemberResponseModel.MemberState     = model.Result_Data.MemberState;
                            registerMemberResponseModel.Lottery         = Convert.ToInt32(model.Result_Data.Lottery);
                            registerMemberResponseModel.Note            = model.Result_Data.Note;
                            registerMemberResponseModel.EndDate         = model.Result_Data.EndDate;
                            registerMemberResponseModel.MemberLevelName = model.Result_Data.MemberLevelName;
                            registerMemberResponseModel.StoreId         = storeModel.StoreID.ToString();
                            registerMemberResponseModel.StoreName       = storeModel.StoreName;
                            registerMemberResponseModel.MemberState     = MemberBusiness.GetMemberStateName(registerMemberResponseModel.MemberState);
                            return(ResponseModelFactory <RegisterMemberResponseModel> .CreateModel(isSignKeyReturn, registerMemberResponseModel));
                        }
                        else
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "查询数据出错"));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "查询数据出错"));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店设置错误"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 8
0
        public object transICCardCoins(Dictionary <string, object> dicParas)
        {
            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);

            string cardIdOut         = dicParas.ContainsKey("cardIdOut") ? dicParas["cardIdOut"].ToString() : string.Empty;
            string cardIdOutPassword = dicParas.ContainsKey("cardIdOutPassword") ? dicParas["cardIdOutPassword"].ToString() : string.Empty;
            string cardIdIn          = dicParas.ContainsKey("cardIdIn") ? dicParas["cardIdIn"].ToString() : string.Empty;
            string coins             = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;
            string mobileName        = dicParas.ContainsKey("mobileName") ? dicParas["mobileName"].ToString() : string.Empty;

            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)
            {
                string         storeProc  = "TransICCardCoins";
                SqlParameter[] parameters = new SqlParameter[8];
                parameters[0]           = new SqlParameter("@CardIdOut", cardIdOut);
                parameters[1]           = new SqlParameter("@CardIdOutPassword", cardIdOutPassword);
                parameters[2]           = new SqlParameter("@CardIdIn", cardIdIn);
                parameters[3]           = new SqlParameter("@Coins", coins);
                parameters[4]           = new SqlParameter("@UserId", userTokenModel.XCGameUserId);
                parameters[5]           = new SqlParameter("@Mobile", userTokenModel.Mobile);
                parameters[6]           = new SqlParameter("@ErrMsg", System.Data.SqlDbType.VarChar, 200);
                parameters[6].Direction = System.Data.ParameterDirection.Output;
                parameters[7]           = new SqlParameter("@Return", 0);
                parameters[7].Direction = System.Data.ParameterDirection.ReturnValue;

                XCGameBLL.ExecuteStoredProcedureSentence(storeProc, storeModel.StoreDBName, parameters);
                if (Convert.ToInt32(parameters[7].Value) == 1)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, parameters[6].Value.ToString()));
                }
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                if (DataFactory.SendMemberTransOperate(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, mobileName, userTokenModel.Mobile, cardIdIn, cardIdOut, int.Parse(coins), 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)
                {
                    MemberTransOperateResultNotifyRequestModel model = (MemberTransOperateResultNotifyRequestModel)(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.T, "", Result_Code.F, "门店设置错误"));
            }
        }
Ejemplo n.º 9
0
        public object getRegisterSMSCode(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
                string imgCode = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty;
                string errMsg  = string.Empty;

                //验证码
                if (!ValidateImgCache.Exist(imgCode.ToUpper()))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
                }
                ValidateImgCache.Remove(imgCode.ToUpper());

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号码不正确"));
                }
                if (string.IsNullOrEmpty(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码不正确"));
                }

                bool isSMSTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["isSMSTest"].ToString());

                StoreBusiness   sb         = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!sb.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }


                if (storeModel.StoreDBDeployType == 0)
                {
                    //验证用户在分库是否存在
                    XCCloudService.BLL.IBLL.XCGame.IUserService userService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IUserService>(storeModel.StoreDBName);
                    var gameUserModel = userService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.u_users>();
                    if (gameUserModel == null)
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                    }
                }
                else if (storeModel.StoreDBDeployType == 1)
                {
                    string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                    UDPSocketCommonQueryAnswerModel answerModel = null;
                    string radarToken = string.Empty;
                    if (DataFactory.SendDataUserPhoneQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, 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)
                    {
                        UserPhoneQueryResultNotifyRequestModel model = (UserPhoneQueryResultNotifyRequestModel)(answerModel.Result);
                        //移除应答缓存数据
                        UDPSocketCommonQueryAnswerBusiness.Remove(sn);
                        if (model.Result_Code == "0")
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店设置不正确"));
                }

                string templateId = "2";

                string key = string.Empty;
                if (!isSMSTest && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    string smsCode = string.Empty;
                    if (SMSBusiness.GetSMSCode(out smsCode))
                    {
                        key = mobile + "_" + smsCode;
                        SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);

                        if (SMSBusiness.SendSMSCode(templateId, mobile, smsCode, out errMsg))
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                        }
                        else
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "发送验证码出错"));
                    }
                }
                else
                {
                    key = mobile + "_" + "123456";
                    SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 10
0
        public object registerUser(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
                string errMsg  = string.Empty;
                int    userId  = 0;

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号码不正确"));
                }
                if (string.IsNullOrEmpty(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码不正确"));
                }
                if (string.IsNullOrEmpty(smsCode))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码"));
                }

                //验证短信验证码
                string key = mobile + "_" + smsCode;
                if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    if (!SMSCodeCache.IsExist(key))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                    }
                }

                if (SMSCodeCache.IsExist(key))
                {
                    SMSCodeCache.Remove(key);
                }

                //验证门店是否有效
                StoreBusiness   sb         = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!sb.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                if (storeModel.StoreDBDeployType == 0)
                {
                    //验证用户在分库是否存在
                    XCCloudService.BLL.IBLL.XCGame.IUserService userService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IUserService>(storeModel.StoreDBName);
                    var gameUserModel = userService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.u_users>();
                    if (gameUserModel == null)
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                    }
                    userId = gameUserModel.UserID;
                }
                else if (storeModel.StoreDBDeployType == 1)
                {
                    string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                    UDPSocketCommonQueryAnswerModel answerModel = null;
                    string radarToken = string.Empty;
                    if (DataFactory.SendDataUserPhoneQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, 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)
                    {
                        UserPhoneQueryResultNotifyRequestModel model = (UserPhoneQueryResultNotifyRequestModel)(answerModel.Result);
                        //移除应答缓存数据
                        UDPSocketCommonQueryAnswerBusiness.Remove(sn);
                        if (model.Result_Code == "0")
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                    }
                    userId = 0;//本地库用0
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店配置无效"));
                }

                //验证用户在总库是否已注册
                XCCloudService.BLL.IBLL.XCGameManager.IUserService userServiceManager = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IUserService>();
                var userRegisterModel = userServiceManager.GetModels(p => p.Mobile.Equals(mobile) && p.StoreId.Equals(storeId)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_user>();

                if (userRegisterModel == null)
                {
                    //添加注册用户
                    XCCloudService.Model.XCGameManager.t_user t_user = new XCCloudService.Model.XCGameManager.t_user();
                    t_user.Mobile     = mobile;
                    t_user.StoreId    = storeId;
                    t_user.CreateTime = System.DateTime.Now;
                    t_user.OpenId     = "";

                    if (!userServiceManager.Add(t_user))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "添加注册用户失败"));
                    }
                }

                //获取用户token
                //云库不用userId
                string token = XCCloudManaUserTokenBusiness.SetToken(mobile, storeId, storeModel.StoreName, userId);
                List <XCCloudManaUserTokenResultModel> list = null;
                XCCloudManaUserTokenBusiness.GetUserTokenModel(mobile, ref list);
                var obj = new
                {
                    userToken = token,
                    storeList = list
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            catch (Exception e)
            {
                throw e;
            }
        }