Exemple #1
0
        public object GetMemberDic(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string merchId = userTokenKeyModel.DataModel.MerchID;

                IBase_StoreInfoService         base_StoreInfoService         = BLLContainer.Resolve <IBase_StoreInfoService>(resolveNew: true);
                IBase_MemberInfoService        base_MemberInfoService        = BLLContainer.Resolve <IBase_MemberInfoService>(resolveNew: true);
                IData_Member_CardService       data_Member_CardService       = BLLContainer.Resolve <IData_Member_CardService>(resolveNew: true);
                IData_Member_Card_StoreService data_Member_Card_StoreService = BLLContainer.Resolve <IData_Member_Card_StoreService>(resolveNew: true);
                var linq = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase))
                           join b in data_Member_Card_StoreService.GetModels() on a.StoreID equals b.StoreID
                           join c in data_Member_CardService.GetModels() on b.CardID equals c.ID
                           join d in base_MemberInfoService.GetModels() on c.MemberID equals d.ID
                           select new
                {
                    MemberID   = d.ID,
                    MemberName = d.UserName
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #2
0
        public object login(Dictionary <string, object> dicParas)
        {
            string userMobile = dicParas.ContainsKey("userMobile") ? dicParas["userMobile"].ToString() : string.Empty;
            string password   = dicParas.ContainsKey("password") ? dicParas["password"].ToString() : string.Empty;
            string imgCode    = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty;

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

            IAdminUserService adminUserService = BLLContainer.Resolve <IAdminUserService>();
            var model = adminUserService.GetModels(p => p.Mobile.Equals(userMobile)).FirstOrDefault <t_AdminUser>();

            if (model == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户不存在"));
            }
            else
            {
                if (model.Password.Equals(password))
                {
                    string token = XCGameManaAdminUserTokenBusiness.SetToken(model.Mobile, model.Id);
                    var    obj   = new { token = token };
                    return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "密码不正确"));
                }
            }
        }
        public object deviceControl(Dictionary <string, object> dicParas)
        {
            string errMsg   = string.Empty;
            string token    = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;
            string mcuid    = dicParas.ContainsKey("mcuid") ? dicParas["mcuid"].ToString() : string.Empty;
            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string action   = dicParas.ContainsKey("controlAction") ? dicParas["controlAction"].ToString() : string.Empty;
            string coins    = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;

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

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

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

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

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

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

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

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

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

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

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

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

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
Exemple #4
0
        public object GetGoodsInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string id     = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    errMsg = "商品ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int iId = Convert.ToInt32(id);
                IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>();
                if (!base_GoodsInfoService.Any(a => a.ID == iId))
                {
                    errMsg = "该商品信息不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var result = from a in base_GoodsInfoService.GetModels(p => p.ID == iId).FirstOrDefault().AsDictionary()
                             select new
                {
                    name  = a.Key,
                    value = a.Value
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #5
0
        public object getStore(Dictionary <string, object> dicParas)
        {
            string        storeId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            IStoreService storeService = BLLContainer.Resolve <IStoreService>();
            var           store        = storeService.GetModels(p => p.id.ToString().Equals(storeId)).FirstOrDefault <t_store>();

            if (store == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
            }
            else
            {
                var obj = new {
                    id             = store.id,
                    companyname    = store.companyname,
                    province       = store.province,
                    address        = store.address,
                    boss           = store.boss,
                    phone          = store.phone,
                    telphone       = store.telphone,
                    client_level   = store.client_level,
                    createtime     = Convert.ToDateTime(store.createtime).ToString("yyyy-MM-dd HH:mm:ss"),
                    updatetime     = Convert.ToDateTime(store.updatetime).ToString("yyyy-MM-dd HH:mm:ss"),
                    power_due_date = Convert.ToDateTime(store.power_due_date).ToString("yyyy-MM-dd"),
                    note           = store.note,
                    parentid       = store.parentid,
                    developer      = store.developer,
                    store_password = store.store_password,
                    store_dbname   = store.store_dbname,
                    wxfee          = store.wxfee * 1000
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
        }
Exemple #6
0
        public object getStores(Dictionary <string, object> dicParas)
        {
            try
            {
                string openId = dicParas.ContainsKey("openId") ? dicParas["openId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "openId参数不能为空"));
                }

                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                var           linq         = from a in storeService.GetModels(p => p.openId.Equals(openId, StringComparison.OrdinalIgnoreCase))
                                             select new
                {
                    storeId     = a.id,
                    companyname = a.companyname,
                    address     = a.address
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq.ToList()));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #7
0
        public object getSAppUserSession(Dictionary <string, object> dicParas)
        {
            WeiXinSAppSessionModel sessionModel = null;
            string errMsg           = string.Empty;
            string serverSessionKey = string.Empty;
            string code             = Utils.GetDictionaryValue <string>(dicParas, "code").ToString();

            if (WeiXinUserMana.GetWeiXinSAppUserSession(code, ref sessionModel, out serverSessionKey, out errMsg))
            {
                var dataObj = new {
                    serverSessionKey = serverSessionKey
                };

                //openId写入t_mobileToken
                try
                {
                    MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);
                    MobileTokenBusiness.UpdateOpenId(mobileTokenModel.Mobile, sessionModel.OpenId);
                }
                catch
                {
                }
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, dataObj));
            }
            else
            {
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, errMsg));
            }
        }
        public object radarHeat(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            string token  = dicParas.ContainsKey("token") ? dicParas["token"].ToString() : string.Empty;

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

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

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

            ClientService service = new ClientService();

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

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

            var obj = new { token = token };

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
Exemple #9
0
        public object GetStoreSales(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string storeId    = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string date       = dicParas.ContainsKey("date") ? dicParas["date"].ToString() : string.Empty;
            string icCardId   = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string searchType = dicParas.ContainsKey("searchType") ? dicParas["searchType"].ToString() : string.Empty;

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

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

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

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

            int whileCount = 0;
            UDPSocketStoreQueryAnswerModel answerModel = null;

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

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

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

            if (list == null || list.Count == 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else if (list[0].Key.Equals("查询结果") && list[0].Value.Equals("无此营业日期"))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "营业数据不存在"));
            }
            else
            {
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, list));
            }
        }
Exemple #10
0
        public object QueryFreeRule(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select c.ID, b.GameID, b.GameName, d.MemberLevelName as MemberLevelName, (case c.RuleType when 0 then '模拟机' when 1 then '博彩机' else '' end) as RuleTypeStr, " +
                             " c.NeedCoin, c.FreeCoin, c.ExitCoin, c.StartTime as ST, c.EndTime as ET, c.State from Data_GameFreeRule_List a " +
                             " inner join Data_GameInfo b on a.GameIndexID=b.ID " +
                             " inner join Data_GameFreeRule c on a.RuleID=c.ID " +
                             " left join Data_MemberLevel d on c.MemberLevelID=d.MemberLevelID" +
                             " where b.StoreID='" + storeId + "'";
                sql = sql + sqlWhere;
                IData_GameFreeRuleService data_GameFreeRuleService = BLLContainer.Resolve <IData_GameFreeRuleService>();
                var data_GameFreeRule = data_GameFreeRuleService.SqlQuery <Data_GameFreeRuleList>(sql, parameters).ToList();
                var linq = from a in data_GameFreeRule
                           group a by new { ID = a.ID } into g
                    select new {
                    g.Key.ID,
                    GameID          = string.Join("|", g.Select(p => p.GameID)),
                    GameName        = string.Join("|", g.Select(p => p.GameName)),
                    MemberLevelName = g.Max(p => p.MemberLevelName),
                    RuleTypeStr     = g.Max(p => p.RuleTypeStr),
                    NeedCoin        = g.Max(p => p.NeedCoin),
                    FreeCoin        = g.Max(p => p.FreeCoin),
                    ExitCoin        = g.Max(p => p.ExitCoin),
                    StartTime       = g.Max(p => p.StartTime),
                    EndTime         = g.Max(p => p.EndTime),
                    State           = g.Max(p => p.State)
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #11
0
        public object GetJackpotInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string id     = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    errMsg = "规则ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int iId = Convert.ToInt32(id);
                IData_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>();
                var data_JackpotInfo = data_JackpotInfoService.GetModels(p => p.ID == iId).FirstOrDefault();
                if (data_JackpotInfo == null)
                {
                    errMsg = "该抽奖规则不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IData_Jackpot_LevelService data_Jackpot_LevelService = BLLContainer.Resolve <IData_Jackpot_LevelService>(resolveNew: true);
                IBase_GoodsInfoService     base_GoodsInfoService     = BLLContainer.Resolve <IBase_GoodsInfoService>(resolveNew: true);
                var JackpotLevels = from a in data_Jackpot_LevelService.GetModels(p => p.ActiveID == iId)
                                    join b in base_GoodsInfoService.GetModels() on a.GoodID equals b.ID
                                    select new
                {
                    LevelName   = a.LevelName,
                    GoodCount   = a.GoodCount,
                    Probability = a.Probability,
                    GoodID      = a.GoodID,
                    GoodName    = b.GoodName
                };

                var result = new
                {
                    ID            = data_JackpotInfo.ID,
                    ActiveName    = data_JackpotInfo.ActiveName,
                    Threshold     = data_JackpotInfo.Threshold,
                    Concerned     = data_JackpotInfo.Concerned,
                    StartTime     = data_JackpotInfo.StartTime,
                    EndTime       = data_JackpotInfo.EndTime,
                    JackpotLevels = JackpotLevels
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object radarRegister(Dictionary <string, object> dicParas)
        {
            string errMsg  = string.Empty;
            string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string segment = dicParas.ContainsKey("segment") ? dicParas["segment"].ToString() : string.Empty;

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

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

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

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

            ClientService service = new ClientService();

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

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

            System.Threading.Thread.Sleep(5000);

            int count = 0;

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

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

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

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
        }
Exemple #13
0
        public object getDeviceState(Dictionary <string, object> dicParas)
        {
            string storeId      = string.Empty;
            string state        = string.Empty;
            string stateName    = string.Empty;
            string mcuId        = string.Empty;
            string segment      = string.Empty;
            string xcGameDBName = string.Empty;
            int    deviceIdentityId;
            string storePassword = string.Empty;
            string storeName     = string.Empty;
            string errMsg        = string.Empty;
            string deviceId      = string.Empty;
            string deviceToken   = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;

            XCGameManaDeviceStoreType deviceStoreType;

            if (!ExtendBusiness.checkXCGameManaDeviceInfo(deviceToken, out deviceStoreType, out storeId, out deviceId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号不存在"));
            }

            if (deviceStoreType == XCGameManaDeviceStoreType.Store)
            {
                //验证门店信息和设备状态是否为启用状态
                if (!ExtendBusiness.checkStoreDeviceInfo(deviceStoreType, storeId, deviceId, out segment, out mcuId, out xcGameDBName, out deviceIdentityId, out storePassword, out storeName, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }
                //验证雷达设备缓存状态
                if (!ExtendBusiness.checkRadarDeviceState(deviceStoreType, storeId, deviceId, out state, out stateName, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                var obj = new {
                    deviceToken = deviceToken,
                    deviceId    = deviceId,
                    mcuId       = mcuId,
                    segment     = segment,
                    storeName   = storeName
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "终端号无效"));
            }
        }
Exemple #14
0
        public object getMemberRepeatCode(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号不能为空"));
            }

            StoreInfoCacheModel storeInfo = null;

            if (!XCCloudStoreBusiness.IsEffectiveStore(storeId, ref storeInfo))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            if (string.IsNullOrEmpty(icCardId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号无效"));
            }
            //获取会员信息
            string storedProcedure = "GetMemberRepeatCode";

            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0]           = new SqlParameter("@ICCardID", icCardId);
            parameters[1]           = new SqlParameter("@StoreID", storeId);
            parameters[2]           = new SqlParameter("@RepeatCode", SqlDbType.Int);
            parameters[2].Direction = System.Data.ParameterDirection.Output;
            parameters[3]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            parameters[3].Direction = System.Data.ParameterDirection.Output;
            parameters[4]           = new SqlParameter("@Return", SqlDbType.Int);
            parameters[4].Direction = System.Data.ParameterDirection.ReturnValue;
            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, parameters);
            if (parameters[4].Value.ToString() == "1")
            {
                var obj = new {
                    repeatCode = parameters[2].Value.ToString()
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡无效"));
            }
        }
Exemple #15
0
        public object UploadPicture(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;

                #region 验证参数

                var file = HttpContext.Current.Request.Files[0];
                if (file == null)
                {
                    errMsg = "未找到图片";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }
                if (file.ContentLength > int.Parse(System.Configuration.ConfigurationManager.AppSettings["MaxImageSize"].ToString()))
                {
                    errMsg = "超过图片的最大限制为1M";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                #endregion

                string picturePath = System.Configuration.ConfigurationManager.AppSettings["UploadImageUrl"].ToString() + "/XCCloud/Bill/";
                string path        = System.Web.HttpContext.Current.Server.MapPath(picturePath);
                //如果不存在就创建file文件夹
                if (Directory.Exists(path) == false)
                {
                    Directory.CreateDirectory(path);
                }

                string fileName = Path.GetFileNameWithoutExtension(file.FileName) + Utils.ConvertDateTimeToLong(DateTime.Now) + Path.GetExtension(file.FileName);
                if (File.Exists(path + fileName))
                {
                    errMsg = "图片名称已存在,请重命名后上传";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                file.SaveAs(path + fileName);

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, new { PicturePath = (picturePath + fileName) }));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #16
0
        public object getStoreList(Dictionary <string, object> dicParas)
        {
            List <object> objList      = new List <object>();
            IStoreService storeService = BLLContainer.Resolve <IStoreService>();

            string storeId     = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string companyname = dicParas.ContainsKey("companyname") ? dicParas["companyname"].ToString() : string.Empty;
            string phone       = dicParas.ContainsKey("phone") ? dicParas["phone"].ToString() : string.Empty;

            string sql = " select * from t_store where id like '%' + @storeId + '%' and companyname like '%' + @companyname + '%' and phone like '%' + @phone + '%' ";

            SqlParameter[] parameters = new SqlParameter[3];
            parameters[0] = new SqlParameter("@storeId", storeId);
            parameters[1] = new SqlParameter("@companyname", companyname);
            parameters[2] = new SqlParameter("@phone", phone);

            var storeList = storeService.SqlQuery <t_store>(sql, parameters).ToList <t_store>();

            for (int i = 0; i < storeList.Count; i++)
            {
                var store = storeList[i];
                var obj   = new
                {
                    id             = store.id,
                    companyname    = store.companyname,
                    province       = store.province,
                    address        = store.address,
                    boss           = store.boss,
                    phone          = store.phone,
                    telphone       = store.telphone,
                    client_level   = store.client_level,
                    createtime     = Convert.ToDateTime(store.createtime).ToString("yyyy-MM-dd HH:mm:ss"),
                    updatetime     = Convert.ToDateTime(store.updatetime).ToString("yyyy-MM-dd HH:mm:ss"),
                    power_due_date = Convert.ToDateTime(store.power_due_date).ToString("yyyy-MM-dd"),
                    note           = store.note,
                    parentid       = store.parentid,
                    developer      = store.developer,
                    store_password = store.store_password,
                    store_dbname   = store.store_dbname,
                    wxfee          = store.wxfee * 1000
                };
                objList.Add(obj);
            }
            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, objList));
        }
Exemple #17
0
        public object getStoreParam(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            ParamQueryResultModel     paramQueryResultModel = null;
            XCCloudManaUserTokenModel userTokenModel        = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);

            if (UDPApiService.GetParam(userTokenModel.StoreId, "0", ref paramQueryResultModel, out errMsg))
            {
                var obj = new {
                    txtCoinPrice  = paramQueryResultModel.TxtCoinPrice,
                    txtTicketDate = paramQueryResultModel.TxtTicketDate
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
        }
Exemple #18
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;
            }
        }
Exemple #19
0
        public object register(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string mcuId   = dicParas.ContainsKey("mcuId") ? dicParas["mcuId"].ToString() : string.Empty;
                XCCloudService.Model.CustomModel.XCGameManager.StoreCacheModel storeCacheModel = null;
                string errMsg      = string.Empty;
                string deviceToken = string.Empty;
                //验证门店信息
                XCCloudService.Business.XCGameMana.StoreBusiness xcGameManaStoreBusiness = new XCCloudService.Business.XCGameMana.StoreBusiness();
                if (!xcGameManaStoreBusiness.IsEffectiveStore(storeId, ref storeCacheModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在"));
                }
                //获取子库中是否存在mcuId
                XCCloudService.BLL.IBLL.XCGame.IDeviceService xcGameDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(storeCacheModel.StoreDBName);
                var xcGameDeviceModel = xcGameDeviceService.GetModels(p => p.MCUID.Equals(mcuId)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();
                if (xcGameDeviceModel == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在"));
                }
                //获取总库中是否存在
                XCCloudService.BLL.IBLL.XCGameManager.IDeviceService xcGameManaDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IDeviceService>();
                var xcGameManaDeviceModel = xcGameManaDeviceService.GetModels(p => p.StoreType == (int)(XCGameManaDeviceStoreType.Store) && p.DeviceId.Equals(mcuId)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_device>();
                if (xcGameManaDeviceModel != null)
                {
                    if (!xcGameManaDeviceModel.DeviceName.Equals(xcGameDeviceModel.name) || !xcGameManaDeviceModel.DeviceType.Equals(xcGameDeviceModel.type))
                    {
                        xcGameManaDeviceModel.DeviceType = xcGameDeviceModel.type;
                        xcGameManaDeviceModel.DeviceName = xcGameDeviceModel.name;
                        xcGameManaDeviceService.Update(xcGameManaDeviceModel);
                    }
                    deviceToken = xcGameManaDeviceModel.TerminalNo;
                }
                else
                {
                    deviceToken = DeviceManaBusiness.GetDeviceToken();
                    bool isExist = false;
                    while (isExist == false)
                    {
                        if (xcGameManaDeviceService.GetCount(p => p.TerminalNo.Equals(deviceToken)) == 0)
                        {
                            isExist = true;
                        }
                        else
                        {
                            deviceToken = DeviceManaBusiness.GetDeviceToken();
                        }
                        System.Threading.Thread.Sleep(100);
                    }
                    xcGameManaDeviceModel            = new XCCloudService.Model.XCGameManager.t_device();
                    xcGameManaDeviceModel.DeviceId   = xcGameDeviceModel.MCUID;
                    xcGameManaDeviceModel.TerminalNo = deviceToken;
                    xcGameManaDeviceModel.DeviceName = xcGameDeviceModel.name;
                    xcGameManaDeviceModel.DeviceType = xcGameDeviceModel.type;
                    xcGameManaDeviceModel.StoreId    = storeId;
                    xcGameManaDeviceModel.Note       = xcGameDeviceModel.note;
                    xcGameManaDeviceModel.StoreType  = (int)(XCGameManaDeviceStoreType.Store);
                    xcGameManaDeviceService.Add(xcGameManaDeviceModel);
                }

                var obj = new { deviceToken = deviceToken };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #20
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, "门店配置无效"));
            }
        }
Exemple #21
0
        public object getMobileToken(Dictionary <string, object> dicParas)
        {
            try
            {
                string token   = dicParas.ContainsKey("token") ? dicParas["token"].ToString().Trim() : "";
                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString().Trim() : "";
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString().Trim() : "";
                string openId  = dicParas.ContainsKey("openId") ? dicParas["openId"].ToString().Trim() : "";

                //获取手机号码
                string mobile = string.Empty;
                if (!MobileTokenBusiness.ExistToken(token, out mobile))
                {
                    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);
                }

                //绑定openId
                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "storeId参数不能为空"));
                }

                if (!Utils.isNumber(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "店号的格式不正确"));
                }

                if (string.IsNullOrEmpty(openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "openId参数不能为空"));
                }

                int           iStoreId     = Convert.ToInt32(storeId);
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                if (!storeService.Any(a => a.id == iStoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该门店不存在"));
                }

                var storeModel = storeService.GetModels(p => p.id == iStoreId).FirstOrDefault();
                if (!string.IsNullOrEmpty(storeModel.openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店已绑定微信,不能重复绑定"));
                }

                storeModel.openId = openId;
                if (!storeService.Update(storeModel))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "绑定openId失败"));
                }

                token = MobileTokenBusiness.SetMobileToken(mobile);
                var tokenModel = new
                {
                    mobileToken = token
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, tokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #22
0
        public object checkStoreImgCode(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg  = string.Empty;
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string code    = dicParas.ContainsKey("code") ? dicParas["code"].ToString() : string.Empty;
                string sysId   = dicParas.ContainsKey("sysId") ? dicParas["sysId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(storeId))
                {
                    errMsg = "storeId参数不能为空";
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                if (!Utils.isNumber(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "店号的格式不正确"));
                }

                if (string.IsNullOrEmpty(code))
                {
                    errMsg = "code参数不能为空";
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                int           iStoreId     = Convert.ToInt32(storeId);
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                if (!storeService.Any(a => a.id == iStoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该门店不存在"));
                }

                var    storeModel = storeService.GetModels(p => p.id == iStoreId).FirstOrDefault();
                string mobile     = storeModel.phone;
                if (string.IsNullOrEmpty(mobile))
                {
                    errMsg = "该门店手机号为空";
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }
                if (!Utils.CheckMobile(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机格式不正确"));
                }

                //验证请求次数
                if (!RequestTotalCache.CanRequest(mobile, ApiRequestType.CheckImgCode))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "已超过单日最大请求次数"));
                }
                else
                {
                    RequestTotalCache.Add(mobile, ApiRequestType.CheckImgCode);
                }

                //如果用户未获取验证码
                if (!ValidateImgCache.Exist(code.ToUpper()))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码已过期"));
                }

                string key = mobile + "_" + code;
                SMSTempTokenCache.Add(key, mobile, CacheExpires.SMSTempTokenExpires);
                ValidateImgCache.Remove(code.ToUpper());

                string token      = MobileTokenBusiness.SetMobileToken(mobile);
                var    tokenModel = new {
                    token  = token,
                    mobile = mobile.Substring(0, 3) + "****" + mobile.Substring(7), //屏蔽中间4位手机号码
                    code   = code
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, tokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #23
0
        public object GetGameInfo(Dictionary <string, object> dicParas)
        {
            //获取token模式
            XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]);
            string        deviceToken  = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty;
            StoreBusiness store        = new StoreBusiness();
            string        xcGameDBName = string.Empty;
            string        password     = string.Empty;
            string        errMsg       = string.Empty;
            string        storeId      = string.Empty;

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

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

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

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

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

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

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

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

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

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

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

            return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj2));
        }
        public object SetSub(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg    = string.Empty;
                string id        = dicParas.ContainsKey("id") ? dicParas["id"].ToString() : string.Empty;
                string dictKey   = dicParas.ContainsKey("dictKey") ? dicParas["dictKey"].ToString() : string.Empty;
                string dictValue = dicParas.ContainsKey("dictValue") ? dicParas["dictValue"].ToString() : string.Empty;
                string comment   = dicParas.ContainsKey("comment") ? dicParas["comment"].ToString() : string.Empty;
                string enabled   = dicParas.ContainsKey("enabled") ? dicParas["enabled"].ToString() : string.Empty;
                string merchId   = dicParas.ContainsKey("merchId") ? dicParas["merchId"].ToString() : string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                if (userTokenKeyModel.LogType == (int)RoleType.MerchUser)
                {
                    merchId = userTokenKeyModel.DataModel.MerchID;
                }

                if (string.IsNullOrWhiteSpace(id))
                {
                    errMsg = "选中节点id不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                try
                {
                    Convert.ToInt32(id);
                }
                catch (Exception ex)
                {
                    return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, ex.Message));
                }

                //验证参数信息
                if (!checkParams(dicParas, out errMsg))
                {
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>();
                int iId = Convert.ToInt32(id);
                if (!dict_SystemService.Any(p => p.ID == iId))
                {
                    errMsg = "选中节点数据库不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                Dict_System dict_System = dict_SystemService.GetModels(p => p.ID == iId).FirstOrDefault <Dict_System>();
                if (dict_System.PID == null || !dict_SystemService.Any(p => p.ID == dict_System.PID))
                {
                    errMsg = "主节点不可修改";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int pId = Convert.ToInt32(dict_System.PID.Value);
                if (dict_SystemService.Any(p => p.ID != iId && p.PID.Value == pId && p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase)))
                {
                    errMsg = "同一级别下存在重名的节点";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!string.IsNullOrWhiteSpace(merchId))
                {
                    if (dict_SystemService.Any(p => p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase) && (p.MerchID == null || p.MerchID.Trim() == string.Empty)))
                    {
                        errMsg = "不能与公有节点重名";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                dict_System.DictKey   = dictKey;
                dict_System.DictValue = dictValue;
                dict_System.Comment   = comment;
                dict_System.Enabled   = Convert.ToInt32(enabled);
                if (dicParas.ContainsKey("merchId"))
                {
                    dict_System.MerchID = dicParas["merchId"].ToString();
                }

                if (!dict_SystemService.Update(dict_System))
                {
                    errMsg = "修改子节点失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, default(Dict_System)));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object getWXRepareId(Dictionary <string, object> dicParas)
        {
            try
            {
                int    coins            = 0;
                string orderNo          = string.Empty;
                string errMsg           = string.Empty;
                string mobileToken      = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string storeId          = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string productName      = dicParas.ContainsKey("productName") ? dicParas["productName"].ToString() : string.Empty;
                string payPriceStr      = dicParas.ContainsKey("payPrice") ? dicParas["payPrice"].ToString() : string.Empty;
                string buyType          = dicParas.ContainsKey("buyType") ? dicParas["buyType"].ToString() : string.Empty;
                string coinsStr         = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;
                string serverSessionKey = dicParas.ContainsKey("serverSessionKey") ? dicParas["serverSessionKey"].ToString() : string.Empty;

                decimal payPrice = 0;
                if (!decimal.TryParse(payPriceStr, out payPrice))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "支付金额不正确"));
                }

                if (!int.TryParse(coinsStr, out coins))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "购买币数不正确"));
                }
                MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]);

                //验证用户session,获取openId
                if (!WeiXinSAppSessionBussiness.Exist(serverSessionKey))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户Session失效"));
                }

                WeiXinSAppSessionModel sessionModel = null;
                WeiXinSAppSessionBussiness.GetSession(serverSessionKey, ref sessionModel);

                //生成服务器订单号
                orderNo = PayOrderHelper.CreateXCGameOrderNo(storeId, payPrice, 0, (int)(OrderType.WeiXin), productName, mobileTokenModel.Mobile, buyType, coins);

                JsApiPay jsApiPay = new JsApiPay();
                jsApiPay.openid       = sessionModel.OpenId;
                jsApiPay.total_fee    = (int)(payPrice * 100);
                jsApiPay.body         = productName;
                jsApiPay.out_trade_no = orderNo;
                jsApiPay.device_info  = storeId;


                //微信下单接口
                WxPayData wxPayData = null;
                try
                {
                    wxPayData = jsApiPay.GetUnifiedOrderResult();
                }
                catch (Exception e)
                {
                    LogHelper.SaveLog(TxtLogType.WeiXinPay, TxtLogContentType.Exception, TxtLogFileType.Day, e.Message);
                    return(ResponseModelFactory.CreateAnonymousModelByFail(isSignKeyReturn, "小程序下单失败"));
                }

                string result_code = wxPayData.GetValue("result_code") != null?wxPayData.GetValue("result_code").ToString() : "";

                string return_code = wxPayData.GetValue("return_code") != null?wxPayData.GetValue("return_code").ToString() : "";

                //根据微信下单结果判断
                if (result_code.Equals("SUCCESS") && return_code.Equals("SUCCESS"))
                {
                    //返回微信预处理订单信息
                    string prepay_id = wxPayData.GetValue("prepay_id").ToString();
                    string timeStamp = Utils.ConvertDateTimeToLong(System.DateTime.Now, 1).ToString();
                    string nonceStr  = System.Guid.NewGuid().ToString("N");

                    var dataObj = new
                    {
                        prepay_id = prepay_id,
                        timeStamp = timeStamp,
                        nonceStr  = nonceStr,
                        signType  = "MD5",
                        paySign   = WeiXinPaySignHelper.GetSAppPaySignKey(nonceStr, prepay_id, "MD5", timeStamp),
                        orderNo   = orderNo
                    };

                    return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, dataObj));
                }
                else
                {
                    return(ResponseModelFactory.CreateAnonymousModelByFail(isSignKeyReturn, "微信端响应出错"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #26
0
        public object addOrder(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            if (!CheckAddOrderParams(dicParas, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            string buyDetailsJson = dicParas.ContainsKey("buyDetails") ? dicParas["buyDetails"].ToString() : string.Empty;
            List <OrderBuyDetailModel> buyDetailList = Utils.DataContractJsonDeserializer <List <OrderBuyDetailModel> >(buyDetailsJson);
            string customerType  = dicParas.ContainsKey("customerType") ? dicParas["customerType"].ToString() : string.Empty;
            string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty;
            //string foodCount = dicParas.ContainsKey("foodCount") ? dicParas["foodCount"].ToString() : string.Empty;
            //string goodCount = dicParas.ContainsKey("goodCount") ? dicParas["goodCount"].ToString() : string.Empty;
            string icCardId     = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string payCount     = dicParas.ContainsKey("payCount") ? dicParas["payCount"].ToString() : string.Empty;
            string freePay      = dicParas.ContainsKey("freePay") ? dicParas["freePay"].ToString() : string.Empty;
            string realPay      = dicParas.ContainsKey("realPay") ? dicParas["realPay"].ToString() : string.Empty;
            string scheduleId   = dicParas.ContainsKey("scheduleId") ? dicParas["scheduleId"].ToString() : string.Empty;
            string workStation  = dicParas.ContainsKey("workStation") ? dicParas["workStation"].ToString() : string.Empty;
            string authorId     = dicParas.ContainsKey("authorId") ? dicParas["authorId"].ToString() : string.Empty;
            string note         = dicParas.ContainsKey("note") ? dicParas["note"].ToString() : string.Empty;
            string orderSource  = dicParas.ContainsKey("orderSource") ? dicParas["orderSource"].ToString() : string.Empty;
            string saleCoinType = dicParas.ContainsKey("saleCoinType") ? dicParas["saleCoinType"].ToString() : string.Empty;
            string mobile       = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;

            string storedProcedure = "CreateOrder";

            String[] Ary = new String[] { "数据0", "数据1", "数据2", "数据3" };

            List <SqlDataRecord> listSqlDataRecord = new List <SqlDataRecord>();

            SqlMetaData[] MetaDataArr = new SqlMetaData[] {
                new SqlMetaData("foodId", SqlDbType.Int),
                new SqlMetaData("foodCount", SqlDbType.Int),
                new SqlMetaData("payType", SqlDbType.Int),
                new SqlMetaData("payNum", SqlDbType.Decimal)
            };


            for (int i = 0; i < buyDetailList.Count; i++)
            {
                List <object> listParas = new List <object>();
                listParas.Add(buyDetailList[i].FoodId);
                listParas.Add(buyDetailList[i].FoodCount);
                listParas.Add(buyDetailList[i].PayType);
                listParas.Add(buyDetailList[i].PayNum);

                var record = new SqlDataRecord(MetaDataArr);
                for (int j = 0; j < Ary.Length; j++)
                {
                    record.SetValue(j, listParas[j]);
                }
                listSqlDataRecord.Add(record);
            }



            SqlParameter[] sqlParameter = new SqlParameter[18];
            sqlParameter[0]       = new SqlParameter("@FoodDetail", SqlDbType.Structured);
            sqlParameter[0].Value = listSqlDataRecord;

            sqlParameter[1]       = new SqlParameter("@StoreID", SqlDbType.VarChar);
            sqlParameter[1].Value = userTokenDataModel.StoreId;

            sqlParameter[2]       = new SqlParameter("@ICCardID", SqlDbType.Int);
            sqlParameter[2].Value = icCardId;

            sqlParameter[3]       = new SqlParameter("@PayCount", SqlDbType.Decimal);
            sqlParameter[3].Value = payCount;

            sqlParameter[4]       = new SqlParameter("@FreePay", SqlDbType.Decimal);
            sqlParameter[4].Value = freePay;

            sqlParameter[5]       = new SqlParameter("@RealPay", SqlDbType.Decimal);
            sqlParameter[5].Value = realPay;

            sqlParameter[6]       = new SqlParameter("@UserID", SqlDbType.Int);
            sqlParameter[6].Value = userTokenModel.LogId;

            sqlParameter[7]       = new SqlParameter("@MemberLevelId", SqlDbType.Int);
            sqlParameter[7].Value = memberLevelId;

            sqlParameter[8]       = new SqlParameter("@WorkStation", SqlDbType.VarChar);
            sqlParameter[8].Value = workStation;

            sqlParameter[9]       = new SqlParameter("@AuthorID", SqlDbType.Int);
            sqlParameter[9].Value = authorId;

            sqlParameter[10]       = new SqlParameter("@Note", SqlDbType.VarChar);
            sqlParameter[10].Value = note;

            sqlParameter[11]       = new SqlParameter("@OrderSource", SqlDbType.Int);
            sqlParameter[11].Value = orderSource;

            sqlParameter[12]       = new SqlParameter("@SaleCoinType", SqlDbType.Int);
            sqlParameter[12].Value = saleCoinType;

            sqlParameter[13]       = new SqlParameter("@CustomerType", SqlDbType.Int);
            sqlParameter[13].Value = customerType;

            sqlParameter[14]       = new SqlParameter("@Mobile", SqlDbType.VarChar);
            sqlParameter[14].Value = mobile;

            sqlParameter[15]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            sqlParameter[15].Direction = ParameterDirection.Output;

            sqlParameter[16]           = new SqlParameter("@OrderFlwID", SqlDbType.Int);
            sqlParameter[16].Direction = ParameterDirection.Output;

            sqlParameter[17]           = new SqlParameter("@Return", SqlDbType.Int);
            sqlParameter[17].Direction = ParameterDirection.ReturnValue;

            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, sqlParameter);
            if (sqlParameter[17].Value.ToString() == "1")
            {
                var obj = new {
                    orderFlwId = Convert.ToInt32(sqlParameter[16].Value)
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, sqlParameter[15].Value.ToString()));
            }
        }