public static bool GetUserTokenModel(string mobile, ref List <XCCloudManaUserTokenResultModel> storeList)
        {
            storeList = new List <XCCloudManaUserTokenResultModel>();
            var query = from item in XCCloudManaUserTokenCache.UserTokenHTDic
                        where ((XCCloudManaUserTokenModel)(item.Value)).Mobile.Equals(mobile)
                        select item.Key.ToString();

            if (query.Count() == 0)
            {
                return(false);
            }
            else
            {
                List <string> tmpList   = query.ToList <string>();
                string        storeName = string.Empty;
                for (int i = 0; i < tmpList.Count; i++)
                {
                    XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(XCCloudManaUserTokenCache.UserTokenHTDic[tmpList[i]]);
                    XCCloudService.Model.CustomModel.XCGameManager.StoreCacheModel storeModel = null;
                    string        errMsg        = string.Empty;
                    StoreBusiness storeBusiness = new StoreBusiness();
                    if (storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg))
                    {
                        if (storeModel == null)
                        {
                            storeName = string.Empty;
                        }
                        else
                        {
                            storeName = storeModel.StoreName;
                        }
                    }

                    XCCloudManaUserTokenResultModel userTokenResultModel = new XCCloudManaUserTokenResultModel(userTokenModel.StoreId, storeName, tmpList[i].ToString());
                    storeList.Add(userTokenResultModel);
                }
                return(true);
            }
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 验证门店设备信息
        /// </summary>
        /// <param name="deviceStoreType"></param>
        /// <param name="storeId"></param>
        /// <param name="deviceId"></param>
        /// <param name="segment"></param>
        /// <param name="mcuId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static bool checkStoreDeviceInfo(XCGameManaDeviceStoreType deviceStoreType, string storeId, string deviceId, out string segment, out string mcuId, out string xcGameDBName, out int deviceIdentityId, out string storePassword, out string storeName, out string errMsg)
        {
            errMsg           = string.Empty;
            segment          = string.Empty;
            storeName        = string.Empty;
            mcuId            = string.Empty;
            xcGameDBName     = string.Empty;
            deviceIdentityId = 0;
            storePassword    = string.Empty;
            if (deviceStoreType == XCGameManaDeviceStoreType.Store)
            {
                StoreBusiness   store      = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    errMsg = "门店不存在";
                    return(false);
                }
                storePassword = storeModel.StorePassword;
                xcGameDBName  = storeModel.StoreDBName;
                storeName     = storeModel.StoreName;

                XCCloudService.BLL.IBLL.XCGame.IDeviceService xcGameDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(xcGameDBName);
                var xcGameDeviceModel = xcGameDeviceService.GetModels(p => p.MCUID.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();
                if (xcGameDeviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (xcGameDeviceModel.state != "启用")
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        segment          = xcGameDeviceModel.segment;
                        mcuId            = xcGameDeviceModel.MCUID;
                        deviceIdentityId = (int)(xcGameDeviceModel.id);
                        return(true);
                    }
                }
            }
            else if (deviceStoreType == XCGameManaDeviceStoreType.Merch)
            {
                XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService>();
                var deviceModel = deviceService.GetModels(p => p.SN.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.Base_DeviceInfo>();
                if (deviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (deviceModel.Status != 1)
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        mcuId            = deviceModel.SN;
                        deviceIdentityId = deviceModel.ID;
                        return(true);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 验证门店设备信息
        /// </summary>
        /// <param name="deviceStoreType"></param>
        /// <param name="storeId"></param>
        /// <param name="deviceId"></param>
        /// <param name="segment"></param>
        /// <param name="mcuId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static bool checkStoreGameDeviceInfo(XCGameManaDeviceStoreType deviceStoreType, string storeId, string deviceId, out string segment, out string mcuId, out string headId, out string gameId, out string xcGameDBName, out string storePassword, out string storeName, out string errMsg)
        {
            errMsg        = string.Empty;
            segment       = string.Empty;
            storeName     = string.Empty;
            mcuId         = string.Empty;
            headId        = string.Empty;
            gameId        = string.Empty;
            xcGameDBName  = string.Empty;
            storePassword = string.Empty;

            if (deviceStoreType == XCGameManaDeviceStoreType.Store)
            {
                StoreBusiness   store      = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    errMsg = "门店不存在";
                    return(false);
                }
                storePassword = storeModel.StorePassword;
                xcGameDBName  = storeModel.StoreDBName;
                storeName     = storeModel.StoreName;

                //验证头信息
                XCCloudService.BLL.IBLL.XCGame.IHeadService headService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IHeadService>(xcGameDBName);
                var headModel = headService.GetModels(p => p.MCUID.Equals(deviceId) && p.State.Equals("1")).FirstOrDefault <XCCloudService.Model.XCGame.t_head>();
                if (headModel == null)
                {
                    errMsg = "设备门店头部信息不存在";
                    return(false);
                }
                //验证游戏机信息
                XCCloudService.BLL.IBLL.XCGame.IGameService gameService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameService>(xcGameDBName);
                var gameModel = gameService.GetModels(p => p.GameID.Equals(headModel.GameID) && p.State.Equals("1")).FirstOrDefault <XCCloudService.Model.XCGame.t_game>();
                if (gameModel == null)
                {
                    errMsg = "设备门店头部信息不存在";
                    return(false);
                }

                segment = headModel.Segment;
                mcuId   = headModel.MCUID;
                headId  = headModel.HeadID;
                gameId  = headModel.GameID;
                return(true);
            }
            else if (deviceStoreType == XCGameManaDeviceStoreType.Merch)
            {
                XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService>();
                var deviceModel = deviceService.GetModels(p => p.SN.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.Base_DeviceInfo>();
                if (deviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (deviceModel.Status != 1)
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        mcuId = deviceModel.SN;
                        //deviceIdentityId = deviceModel.ID;
                        return(true);
                    }
                }
            }
            else
            {
                return(false);
            }
        }