/// <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); }
/// <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); }