Esempio n. 1
0
        /// <summary>
        /// 检查通道信息
        /// </summary>
        /// <param name="brandChannelDto"></param>
        /// <param name="channelDto"></param>
        /// <param name="retMsg"></param>
        /// <returns></returns>
        public bool CheckChannel(long id, out ChannelDto channelDto, out string retMsg)
        {
            var val = _pushChannelService;

            retMsg     = "";
            channelDto = CourseCacheLogic <string, ChannelDto> .Get("Channel_" + id,
                                                                    () =>
            {
                PushChannelDomainModel pushChannel = _pushChannelService.GetChannelByIdAsync(id).Result;
                return(_mapper.Map <ChannelDto>(pushChannel));
            });

            if (channelDto == null)
            {
                retMsg = string.Format("ChannelId:{0},未匹配到Push_Channel", id);
                return(false);
            }
            //通道是否有效
            if (!channelDto.IsActive)
            {
                retMsg = string.Format("ChannelId:{0},通道{1}状态无效", channelDto.Id, channelDto.ChannelName);
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
 public ConfigDto GetConfig(string config)
 {
     return(CourseCacheLogic <string, ConfigDto> .Get(config, () => {
         PushConfigDomainModel domainModel = _pushConfigService.GetConfigByKeyAsync(config).Result;
         return _mapper.Map <ConfigDto>(domainModel);
     }));
 }
Esempio n. 3
0
        /// <summary>
        /// 通过Id,检查TokenBrand
        /// </summary>
        /// <param name="rzTokenBrandDto"></param>
        /// <param name="channelDto"></param>
        /// <param name="appChannelDto"></param>
        /// <param name="retMsg"></param>
        /// <returns></returns>
        public bool CheckRzTokenBrand(long id, out TokenBrandDto rzTokenBrandDto)
        {
            rzTokenBrandDto = CourseCacheLogic <long, TokenBrandDto> .Get(id,
                                                                          () =>
            {
                PushTokenBrandDomainModel model = _pushTokenBrandService.GetTokenBrandByIdAsync(id).Result;
                return(_mapper.Map <TokenBrandDto>(model));
            });

            if (rzTokenBrandDto == null)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        /// <summary>
        /// 检查AppChannel
        /// </summary>
        /// <param name="rzTokenBrandDto"></param>
        /// <param name="channelDto"></param>
        /// <param name="appChannelDto"></param>
        /// <param name="retMsg"></param>
        /// <returns></returns>
        public bool CheckAppChannel(int appId, int systemType, long channelId, out AppChannelDto appChannelDto, out string retMsg)
        {
            retMsg        = "";
            appChannelDto = CourseCacheLogic <string, AppChannelDto> .Get(string.Format("AppChannel_AppId_{0}_SystemType_{1}_ChannelId_{2}", appId, systemType, channelId),
                                                                          () =>
            {
                PushAppChannelDomainModel domainModel = _appChannelService.GetAppChannelByAppInfoAsync(appId, systemType, channelId).Result;
                return(_mapper.Map <AppChannelDto>(domainModel));
            });

            if (appChannelDto == null)
            {
                retMsg = string.Format("通过AppId:{0}、SystemType:{1}、ChannelId:{2},未匹配到Push_App_Channel", appId, systemType, channelId);
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// 检查AppId是否存在
        /// </summary>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public bool CheckAppId(int appId, out string retMsg)
        {
            retMsg = "";
            InfraDicDto infraDicDto = CourseCacheLogic <string, InfraDicDto> .Get("AppId_" + appId,
                                                                                  () =>
            {
                InfraDicDomainModel model = _infraDicService.GetDicByTypeAndKeyAsync("AppId", appId.ToString()).Result;
                return(_mapper.Map <InfraDicDto>(model));
            });

            if (infraDicDto == null)
            {
                retMsg = string.Format("AppId:{0}不存在", appId);
                //LogHelper.Error.Write("CheckAppId", retMsg);
                return(false);
            }
            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// 匹配品牌编号
        /// </summary>
        /// <param name="brand"></param>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public bool MatchBrandId(string brand, out int brandId)
        {
            string defaultBrand = "default";

            brandId = 0;
            brand   = brand.ToLower();
            InfraDicDto infraDicDto = CourseCacheLogic <string, InfraDicDto> .Get("Brand_" + brand,
                                                                                  () =>
            {
                InfraDicDomainModel model = _infraDicService.GetDicByTypeAndValueAsync("BrandId", brand).Result;
                return(_mapper.Map <InfraDicDto>(model));
            });

            if (infraDicDto == null)
            {
                if (brand != defaultBrand)
                {
                    return(MatchBrandId(defaultBrand, out brandId));
                }
                return(false);
            }
            brandId = infraDicDto.Key;
            return(true);
        }