示例#1
0
        public static string SetMemberCardQueryBusiness(string iccard, out string name)
        {
            IMemberTokenService memberToken = BLLContainer.Resolve <IMemberTokenService>();
            //根据iccard查询membertoken表strordID
            var menlist = memberToken.GetModels(p => p.ICCardID.Equals(iccard, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <T_MemberToken>();

            if (menlist != null)
            {
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                int           storeid      = Convert.ToInt32(menlist.StoreId);
                //根据stroid查询t_store的对应数据库的名称
                var storelist = storeService.GetModels(p => p.id == storeid).FirstOrDefault <t_store>();
                if (storelist != null)
                {
                    String sql             = String.Format("select row_number() over (order by RealTime) as No,CONVERT(varchar(100),f.RealTime , 20)as RealTimes,'{0}' as ICCardID,f.* from (SELECT f1.RealTime, ( CAST(f1.Balance AS decimal) - CAST(f1.Coins AS decimal) ) AS last_coins, f1.Coins AS save_coins, '0' AS used_coins, f1.Balance AS now_coins, '存币机存币' AS type,  f1.Segment+ ' | '+f1.HeadAddress  AS other_info FROM ( SELECT * FROM flw_485_savecoin WHERE ICCardID = {0} ) f1 UNION ALL SELECT f2.RealTime AS RealTime, ( CASE f2.CoinType WHEN '0' THEN '0' WHEN '3' THEN ( f2.Balance - f2.Coins ) ELSE ( f2.Balance + f2.Coins ) END ) AS last_coins, ( CASE f2.CoinType WHEN '3' THEN f2.Coins ELSE '0' END ) AS save_coins, ( CASE f2.CoinType WHEN '1' THEN f2.Coins WHEN '4' THEN f2.Coins ELSE '0' END ) AS used_coins, f2.Balance AS now_coins, ( CASE f2.CoinType WHEN '0' THEN '实物投币' WHEN '1' THEN '刷卡投币' WHEN '2' THEN '实物退币' WHEN '3' THEN 'IC卡出币' WHEN '4' THEN '数字币投币' END ) AS type,  g.GameName+ ' | '+ h.HeadID + case when DeivceName='' then '' else ' | ' + DeivceName end AS other_info FROM ( SELECT s1.*,ISNULL( s2.DeivceName,'') as DeivceName FROM flw_485_coin s1 left join flw_Push_Coin s2 on s1.ID=s2.FlwID WHERE ICCardID = {0} ) f2 LEFT JOIN t_head h ON f2.HeadAddress = h.HeadAddress AND f2.Segment = h.Segment LEFT JOIN t_game g ON h.GameID = g.GameID UNION ALL SELECT f3.RealTime, ( f3.Balance + f3.Coins ) AS last_coins, '0' AS save_coins, f3.Coins AS used_coins, f3.Balance AS now_coins, ( CASE f3.FlowType WHEN '0' THEN '退币' WHEN '1' THEN '退卡' END ) AS type,  CONVERT(varchar(20),f3.UserID)+ ' | '+ f3.WorkStation  AS other_info FROM ( SELECT * FROM flw_coin_exit WHERE ICCardID = {0} ) f3 UNION ALL SELECT f4.RealTime, ( CASE f4.WorkType WHEN '3' THEN ( f4.Balance + f4.Coins ) WHEN '7' THEN ( f4.Balance + f4.Coins ) WHEN '6' THEN ( f4.Balance + f4.Coins ) ELSE ( f4.Balance - f4.Coins ) END ) AS last_coins, ( CASE f4.WorkType WHEN '3' THEN '0' WHEN '7' THEN '0' ELSE f4.Coins END ) AS save_coins, ( CASE f4.WorkType WHEN '3' THEN f4.Coins WHEN '7' THEN f4.Coins ELSE '0' END ) AS used_coins, f4.Balance AS now_coins, ( CASE f4.WorkType WHEN '4' THEN '手工存币' WHEN '3' THEN '手工提币' WHEN '7' THEN '售币机提币' WHEN '6' THEN '自助机提币' WHEN '2' THEN '送币' WHEN '5' THEN '送币' WHEN '8' THEN '送币' END ) AS type,  f4.WorkStation + ' | ' + CONVERT(VARCHAR(20), f4.UserID) + ' | ' + MacAddress AS other_info FROM ( SELECT * FROM flw_coin_sale WHERE ICCardID = {0} ) f4 UNION ALL SELECT f5.RealTime, '0' AS last_coins, f5.CoinQuantity AS save_coins, '0' AS used_coins, f5.CoinQuantity AS now_coins, '数字币销售' AS type,  h5.FoodName+ ' | '+ g5.WorkStation AS other_info FROM ( SELECT * FROM flw_digite_coin_detial WHERE ICCardID = {0} ) f5 LEFT JOIN flw_digite_coin g5 ON f5.ID = g5.ID LEFT JOIN t_foods h5 ON h5.FoodID = g5.FoodID UNION ALL SELECT f6.RealTime, f6.Balance - f6.CoinQuantity AS last_coins, ( CASE f6.FlowType WHEN 'X' THEN '0' ELSE f6.CoinQuantity END ) AS save_coins, ( CASE f6.FlowType WHEN 'X' THEN f6.CoinQuantity ELSE '0' END ) AS used_coins, f6.Balance AS now_coins, ( CASE f6.FlowType WHEN '0' THEN '开户' WHEN '1' THEN '充值' WHEN 'X' THEN '退餐' END ) AS type,  fs6.FoodName+' | '+f6.WorkStation AS other_info FROM ( SELECT * FROM flw_food_sale WHERE ICCardID = {0} ) f6 LEFT JOIN t_foods fs6 ON f6.FoodID = fs6.FoodID UNION ALL SELECT f9.RealTime, ( f9.Balance + f9.Coins ) AS last_coins, '0' AS save_coins, f9.Coins AS used_coins, f9.Balance AS now_coins, '购买商品' AS type, '销售流水号:'+CONVERT(varchar(20),f9.GoodsID) AS other_info FROM ( SELECT * FROM flw_goods WHERE ICCardID = {0} AND PayType = '2' ) f9 UNION ALL SELECT f10.RealTime, ( f10.Balance - f10.PointCoin ) AS last_coins, f10.PointCoin AS save_coins, '0' AS used_coins, f10.Balance AS now_coins, '积分兑币' AS type, fs10.RebateRuleName AS other_info FROM ( SELECT * FROM flw_rebate WHERE ICCardID = {0} ) f10 LEFT JOIN t_rebate fs10 ON f10.RebateRuleID = fs10.RebateRuleID UNION ALL SELECT f11.RealTime, ( f11.BalanceOut + f11.Coins ) AS last_coins, '0' AS save_coins, f11.Coins AS used_coins, f11.BalanceOut AS now_coins, '转出' AS type, CONVERT(varchar(500),f11.ICCardIDIn) AS other_info FROM ( SELECT * FROM flw_transfer WHERE ICCardIDOut = {0} ) f11 UNION ALL SELECT f12.RealTime, ( f12.BalanceIn - f12.Coins ) AS last_coins, f12.Coins AS save_coins, '0' AS used_coins, f12.BalanceIn AS now_coins, '转入' AS type, CONVERT(varchar(500),f12.ICCardIDOut) AS other_info FROM ( select * from flw_transfer where ICCardIDIn = {0} ) f12 UNION ALL SELECT f13.RealTime, ( f13.Balance + f13.Coins ) AS last_coins, '0' AS save_coins, f13.Coins AS used_coins, f13.Balance AS now_coins, '购买门票' AS type, '无' AS other_info FROM ( select * from flw_project_buy where ICCardID = {0} ) f13) f", iccard);
                    System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storelist.store_dbname, null);
                    DataTable           dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        var list = Utils.GetModelList <MenberICCardModel>(ds.Tables[0]).ToList();
                        int time = CacheExpires.CommonPageQueryDataCacheTime;
                        MemberICICard.Add(iccard, list, time);
                        name = "1";
                        return(name);
                    }
                }
            }
            name = "";
            return(name);
        }
示例#2
0
        public static bool OpenSchedule(string dbName, int userId, string macAddress, string diskId, string workStation, out int currentSchedule, out string errMsg)
        {
            errMsg = string.Empty;
            string checkDate = System.DateTime.Now.ToString("yyyy-MM-dd");
            string sql       = "OpenSchedule";

            SqlParameter[] parameters = new SqlParameter[8];
            parameters[0]           = new SqlParameter("@CheckDate", checkDate);
            parameters[1]           = new SqlParameter("@UserId", userId);
            parameters[2]           = new SqlParameter("@macAddress", macAddress);
            parameters[3]           = new SqlParameter("@diskId", diskId);
            parameters[4]           = new SqlParameter("@workStation", workStation);
            parameters[5]           = new SqlParameter("@CurrentSchedule", 0);
            parameters[5].Direction = System.Data.ParameterDirection.Output;
            parameters[6]           = new SqlParameter("@OffLineUserId", 0);
            parameters[6].Direction = System.Data.ParameterDirection.Output;
            parameters[7]           = new SqlParameter("@ReturnValue", 0);
            parameters[7].Direction = System.Data.ParameterDirection.ReturnValue;
            XCGameBLL.ExecuteStoredProcedureSentence(sql, dbName, parameters);

            int result = Convert.ToInt32(parameters[6].Value);

            if (result >= 1)
            {
                currentSchedule = Convert.ToInt32(parameters[5].Value);
                return(true);
            }
            else
            {
                errMsg          = "开班出现错误";
                currentSchedule = 0;
                return(false);
            }
        }
示例#3
0
        public object addDevice(Dictionary <string, object> dicParas)
        {
            string storeId     = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string mcuId       = dicParas.ContainsKey("mcuId") ? dicParas["mcuId"].ToString() : string.Empty;
            string deviceToken = string.Empty;

            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            if (string.IsNullOrEmpty(mcuId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备ID无效"));
            }

            int           storeids     = int.Parse(storeId);
            IStoreService storeService = BLLContainer.Resolve <IStoreService>();
            var           menlist      = storeService.GetModels(x => x.id == storeids).FirstOrDefault <t_store>();

            if (menlist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "门店号无效"));
            }
            deviceToken = DeviceManaBusiness.GetDeviceToken();
            int    StoreType = 1;
            string dbname    = menlist.store_dbname;

            if (dbname == "XCCloudRS232")
            {
                StoreType = 0;
            }
            IDeviceService device     = BLLContainer.Resolve <IDeviceService>();
            var            devicelist = device.GetModels(x => x.DeviceId == mcuId && x.StoreId == storeId).FirstOrDefault <t_device>();

            if (devicelist != null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该店号已经存在该设备信息!"));
            }
            string sql = @"select a.MCUID,b.GameName,b.GameType from t_head a inner join t_game b on a.GameID = b.GameID where MCUID = '" + mcuId + "'";

            System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, dbname, null);
            if (ds.Tables[0].Rows.Count > 0)
            {
                DeviceModel deviceModel = Utils.GetModelList <DeviceModel>(ds.Tables[0])[0];
                t_device    device1     = new t_device();
                device1.TerminalNo = deviceToken;
                device1.StoreId    = storeId;
                device1.StoreType  = StoreType;
                device1.DeviceName = deviceModel.GameName;
                device1.DeviceType = deviceModel.GameType;
                device1.DeviceId   = deviceModel.MCUID;
                device.Add(device1);
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到相关数据"));
        }
示例#4
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));
        }
示例#5
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;
            }
        }
示例#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, "查询数据出错"));
            }
        }
示例#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;
            }
        }
示例#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, "门店设置错误"));
            }
        }
示例#9
0
        public object getInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                string              errMsg     = string.Empty;
                StoreCacheModel     storeModel = null;
                System.Data.DataSet ds         = null;
                //获取token模式
                XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);

                //验证门店
                StoreBusiness storeBusiness = new StoreBusiness();
                if (!storeBusiness.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.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName);
                    var count = memberService.GetModels(p => p.Mobile.Equals(memberTokenModel.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", memberTokenModel.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);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                        string meberToken = MemberTokenBusiness.SetMemberToken(memberTokenModel.StoreId, memberTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(memberTokenModel.StoreId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                    else
                    {
                        string         sql        = " exec GetMember @Mobile,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[2];
                        parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile);
                        parameters[1] = new SqlParameter("@ICCardID", "0");
                        ds            = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                        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 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(memberTokenModel.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", memberTokenModel.Mobile);
                        parameters[1]           = new SqlParameter("@MerchId", storeModel.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);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                        string meberToken = MemberTokenBusiness.SetMemberToken(memberTokenModel.StoreId, memberTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(memberTokenModel.StoreId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                    else
                    {
                        string         sql        = " exec GetMember @Mobile,@MerchId,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[3];
                        parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile);
                        parameters[1] = new SqlParameter("@MerchId", memberTokenModel.StoreId);
                        parameters[2] = new SqlParameter("@ICCardID", "0");
                        ds            = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
                        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, "门店类型无效"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#10
0
        public object register(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string mobile = string.Empty;
                XCGameManaDeviceStoreType deviceStoreType;
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                //验证手机token
                MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);
                mobile = mobileTokenModel.Mobile;
                //验证门店
                StoreCacheModel storeModel = null;
                StoreBusiness   store      = new StoreBusiness();
                if (!store.IsEffectiveStore(storeId, out deviceStoreType, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                string meberToken = string.Empty;
                if (deviceStoreType == XCGameManaDeviceStoreType.Store)
                {
                    XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName);
                    //获取手机号是否存在注册记录
                    var count = memberService.GetModels(p => p.Mobile.Equals(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", 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;
                        System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                        meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                    else
                    {
                        //如果已注册,返回会员主要信息
                        string         sql        = " exec GetMember @Mobile,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[2];
                        parameters[0] = new SqlParameter("@Mobile", mobile);
                        parameters[1] = new SqlParameter("@ICCardID", "0");
                        System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                        meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                }
                else if (deviceStoreType == XCGameManaDeviceStoreType.Merch)
                {
                    XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>();
                    //获取手机号是否存在注册记录
                    var count = memberService.GetModels(p => p.Mobile.Equals(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", 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;
                        System.Data.DataSet ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState);
                        meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                    else
                    {
                        //如果已注册,返回会员主要信息
                        string         sql        = " exec GetMember @Mobile,@MerchId,@ICCardID";
                        SqlParameter[] parameters = new SqlParameter[3];
                        parameters[0] = new SqlParameter("@Mobile", mobile);
                        parameters[1] = new SqlParameter("@MerchId", storeId);
                        parameters[2] = new SqlParameter("@ICCardID", "0");
                        System.Data.DataSet ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters);
                        MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0];
                        memberResponseModel.MemberState = "使用中";
                        meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate);
                        RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel);
                        return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, "店号无效"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }