public IList <WallPaperCategoryView> GetCategoryViewList(MobileParam mobileParams, int cver, out int sver) { var categorylist = new WallPaperCategory().ReturnThemeInstance <WallPaperCategory>(cver, out sver); categorylist.GetCompleteInstance <WallPaperCategory>(); return(categorylist.To <IList <WallPaperCategoryView> >()); }
public IList <NewsCategoryView> GetCategoryViewList(MobileParam mobileParams, int cver, out int sver) { #region instance var category = new NewsCategory() { Id = 1, Name = "热点", Status = 1, CreateDateTime = DateTime.Now }; var category2 = new NewsCategory() { Id = 2, Name = "财经", Status = 1, CreateDateTime = DateTime.Now }; #endregion var categorylist = new List <NewsCategory>() { category, category2 }; sver = 1; var result = categorylist.To <IList <NewsCategoryView> >(); return(result); }
public IList <OlderNewsExtraAppView> GetOlderExtraAppViewList(MobileParam mobileParams, int cver, out int sver) { var ratio = 0; var extraappviewlist = GetExtraAppViewList(mobileParams, cver, out sver, out ratio); return(extraappviewlist.To <IList <OlderNewsExtraAppView> >()); }
public IList <NewsContentView> GetContentViewList(MobileParam mobileParams, List <int> categoryIds, long stamp, bool action) { var contentViewList = new List <NewsContentView>(); var extraAppList = NewsServiceHelper.GetNewsExtraAppList().ToList(); var imageType = NewsServiceHelper.GetImageURLTypeByResolution(mobileParams); var stampTime = stamp.UTCStamp(); var endDateTime = stampTime.AddDays(-3); switch (action) { case false: contentViewList = NewsServiceHelper.GetOldestNewsContentView(categoryIds, extraAppList, imageType, endDateTime, stampTime).ToList(); break; default: contentViewList = NewsServiceHelper.GetLatestNewsContentView(categoryIds, extraAppList, imageType, stampTime).ToList(); break; } var localContentList = NewsServiceHelper.GetLocalContentViewList(extraAppList, imageType); contentViewList = InsertRange(contentViewList, localContentList); return(contentViewList); }
public IList <NewsExtraAppView> GetExtraAppViewList(MobileParam mobileParams, int cver, out int sver, out int ratio) { ratio = NewsServiceHelper.GetExtraRatioByChannel(mobileParams); var extraAppList = new NewsExtraApp().ReturnNewsInstance <NewsExtraApp>(cver, out sver); return(extraAppList.To <IList <NewsExtraAppView> >()); }
public void Communicate(MobileParam param, IRequestRepository requestRepo, int? actionId, int? resultCode, long logId, string actionName, string controllerName, string productCode) { var log = EntityMapping.Auto<MobileParam, TYD.Logging.Model.CommunicationLog>(param); log.ActionId = actionId; log.ActionName = actionName; log.ControllerName = controllerName; log.Url = requestRepo.RawUrl.ToString(); log.ProductCode = productCode; log.Host = requestRepo.UserHostName; log.ResultCode = resultCode; log.IPAddress = requestRepo.ClientIP; log.ChildID = logId; if (!param.SMSCode.IsNullOrEmpty()) { var smscInfo = _commonService.GetSMSCInfoBySMCCode(param.SMSCode); if (smscInfo != null) { log.ProvinceId = smscInfo.ProvinceId; log.CityId = smscInfo.CityId; } } RedisLogger.Add<TYD.Logging.Model.CommunicationLog>(log); }
public void map_from_mobile_param() { var mt = new MobileParamTest(); var headerMock = new Mock<IRequestRepository>(); headerMock.Setup<NameValueCollection>(s => s.QueryString).Returns(mt.PrepareHeaderRepository()); var mobileParam = new MobileParam(headerMock.Object); mobileParam.RequestBody = "11"; var log = EntityMapping.Auto<MobileParam, CommunicationLog>(mobileParam); Assert.Equal(MobileParamTest.imei, log.IMEI); Assert.Equal(MobileParamTest.imsi, log.IMSI); Assert.Equal(MobileParamTest.smsc.ToInt64(), log.SMSCode); Assert.Equal(0, log.BatchId); Assert.Equal(0, log.DesignHouseId); Assert.Equal(0, log.ChannelId); Assert.Equal(0, log.BrandModelId); Assert.Equal(0, log.MachineTypeId); Assert.Equal(0, log.AndroidVersionId); Assert.Equal(MobileParamTest.lbs, log.LBS); Assert.Equal(0, log.FromAppId); Assert.Equal(0, log.AppVersionId); Assert.Equal(0, log.NetworkTypeId); Assert.Equal(0, log.ReservedId1); Assert.Equal(0, log.ReservedId2); Assert.Equal(0, log.ReservedId3); Assert.Equal(0, log.UserId); Assert.Equal(0, log.TargetAppId); Assert.Equal(0, log.CityId); Assert.Equal(0, log.ProvinceId); Assert.Equal(null, log.IPAddress); Assert.Equal("11", log.RequestBody); }
protected internal bool WillSkipCommunicationLogging(MobileParam mobileParam, ActionDescriptor actionDescriptor, out string controllerName, out string actionName) { var controllerDescriptor = default(ControllerDescriptor); controllerName = string.Empty; actionName = string.Empty; var skipLog = mobileParam.IsTest.GetValueOrDefault(); if (!skipLog) { if (actionDescriptor != null) { actionName = actionDescriptor.ActionName; if (actionDescriptor.ControllerDescriptor != null) { controllerName = actionDescriptor.ControllerDescriptor.ControllerName; controllerDescriptor = actionDescriptor.ControllerDescriptor; skipLog = HasNoCommunicationLogAttribute(actionDescriptor, controllerDescriptor); } } } return(skipLog); }
public IList <NewsSourceView> GetSourceViewList(MobileParam mobileParams, int cver, out int sver) { #region instance var source = new NewsSource() { Id = 1, Name = "今日头条", NameLowCase = "toutiao", PackageName = "com.ss.android.article.news", Status = 1, CreateDateTime = DateTime.Now }; var source2 = new NewsSource() { Id = 2, Name = "腾讯新闻", NameLowCase = "tentcent", PackageName = "com.tencent.news", Status = 1, CreateDateTime = DateTime.Now }; #endregion var sourcelist = new List <NewsSource>() { source, source2 }; sver = 1; var result = sourcelist.To <IList <NewsSourceView> >(); return(result); }
public OTAUpdateInfoView GetOTAUpdateInfo(MobileParam requestParams) { // get client Version and App No from MobileParam.Batch // Match App branch by client Version // Get the latest version of the app , compare it with client Version // return OTA update info OTAUpdateInfoView otaInfo = new OTAUpdateInfoView { HasNewVersion = true, NextCheckTime = DateTime.Now.AddDays(6).AddMilliseconds(OTARandom.Next(86300000)), IsShowOTAInfo = true, ReleaseNotes =new List<OTAVersionView>{ new OTAVersionView{ VersionName = "1.0.5", PublishTime = DateTime.Now.AddDays(-10), ReleaseNote = "1. 更新了经常死机的问题\r\n2. 更新了通讯录不能同步的问题" }}, PushInfo = "push information", FileSize = 12312, IsAutoDownload = true, Version = "v10001", Id = "10001" }; return otaInfo; }
protected virtual MobileParam GetMobileParam() { var param = new MobileParam(this.RequestRepository); param.RequestBody = RequestRepository.PostedDataString; return(param); }
public NewsCollectionView GetNewsCollectionView(MobileParam mobileParams, long stamp, int extracver, bool action, string categoryIds, int startnum, int num, out int extrasver, out int ratio, out int totalCount) { var collection = new NewsCollectionView(); collection.NewsExtraResult = NewsServiceHelper.GetNewsExtraResult(mobileParams, extracver, out extrasver, out ratio); collection.NewsContentResult = NewsServiceHelper.GetNewsContentResult(mobileParams, stamp, action, categoryIds, startnum, num, out totalCount); return(collection); }
public string GetOTADownloadUrl(string id, MobileParam requestParams) { // find app by id // Get latest version of that app , return its download url return "http://www.dsource.org/projects/rulesplayer/browser/downloads/rulesplayer.zip?format=raw"; }
public IList <NewsRadarView> GetNewsRadarViewList(MobileParam mobileParams, int cver, out int sver) { var imageType = NewsServiceHelper.GetImageURLTypeByResolution(mobileParams); var radarlist = new RadarCategory().ReturnRadarInstance <RadarCategory>(cver, out sver); var subradarlist = new RadarElement().ReturnRadarInstance <RadarElement>(cver, out sver); return(ConvertByRadar(imageType, radarlist, subradarlist)); }
public static string GetCompleteThumbnailUrl(this string thumbnailName, MobileParam mobileParams) { var resolution = mobileParams.Resolution.ToLower(); if (string.IsNullOrEmpty(resolution)) { return(string.Format("{0}{1}", ConfigKeys.TYD_WALLPAPER_THUMBNAIL_IMAGE_PREFIX.ConfigValue(), thumbnailName)); } return(string.Format("{0}{1}_{2}", ConfigKeys.TYD_WALLPAPER_THUMBNAIL_IMAGE_PREFIX.ConfigValue(), resolution, thumbnailName)); }
public WallPaperView GetWallPaperViewDetail(MobileParam mobileParams, int wallPaperId) { var wallpaperlist = FakeWallPaperList(); var wallpaper = wallpaperlist.Single <WallPaper>(x => x.Id == wallPaperId); var result = wallpaper.To <WallPaperView>(); return(result); }
public static string GetCompleteOriginalUrl(this string originalName, MobileParam mobileParams) { var resolution = mobileParams.Resolution.ToLower(); if (string.IsNullOrEmpty(resolution)) { return(string.Format("{0}{1}", ConfigKeys.TYD_WALLPAPER_ORIGINAL_IMAGE_PREFIX.ConfigValue(), originalName)); } return(string.Format("{0}{1}_{2}", ConfigKeys.TYD_WALLPAPER_ORIGINAL_IMAGE_PREFIX.ConfigValue(), resolution, originalName)); }
public ClientPushView PushToClient(MobileParam mobileParams) { Random random = new Random(); var result = new ClientPushView { Items = UserInteractUIService.GetAllPushItems(), NextRequestTime = DateTime.Now.AddSeconds((double)ConfigKeys.DEFAULT_NEXT_USER_UPLOAD_TIMESPAN.ConfigValue().ToInt32()).AddMilliseconds(random.Next(86300000)), ReceivedTime = DateTime.Now }; return result; }
public IList <WallPaperSubCategoryView> GetSubCategoryViewList(MobileParam mobileParams, int cver, out int sver) { #region instance var subcate1 = new WallPaperSubCategory() { Id = 1, Name = "美女之家", CategoryId = 1, SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1123.jpg", Summary = string.Empty, OrderNumber = 1, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; var subcate2 = new WallPaperSubCategory() { Id = 2, Name = "模特", CategoryId = 1, SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1124.jpg", Summary = string.Empty, OrderNumber = 3, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; var subcate3 = new WallPaperSubCategory() { Id = 3, Name = "动漫1", CategoryId = 2, SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1112.jpg", Summary = string.Empty, OrderNumber = 2, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; #endregion var subcategorylist = new List <WallPaperSubCategory>() { subcate1, subcate2, subcate3 }; var result = subcategorylist.To <IList <WallPaperSubCategoryView> >(); sver = 1; return(result); }
public TYD_CommunicationLogTest() { Bootstrapper.Start(); var requestRepository = new Mock<IRequestRepository>(); ObjectFactory.Inject<IRequestRepository>(requestRepository.Object); requestRepository.Setup<NameValueCollection>(s => s.Header).Returns(new NameValueCollection()); _mockParam = new Mock<MobileParam>(); _param = _mockParam.Object; }
public IList <NewsContentView> GetNewsContentViewList(MobileParam mobileParams, long stamp, bool action, string categoryIds, int startnum, int num, out int totalCount) { var contentlist = new List <NewsContentView>(); totalCount = 0; var categoryIdList = categoryIds.Split(';', ';').ToList().ToInt32List(); contentlist = this.GetContentViewList(mobileParams, categoryIdList, stamp, action).ToList(); totalCount = contentlist.Count; return(contentlist.Skip(startnum - 1).Take(num).ToList()); }
public NewsContentResult GetNewsContentResult(MobileParam mobileParams, long stamp, bool action, string categoryIds, int startnum, int num, out int totalCount) { var contentlist = NewsService.GetNewsContentViewList(mobileParams, stamp, action, categoryIds, startnum, num, out totalCount); var result = new NewsContentResult() { NewsContentList = contentlist.ToList(), Total = totalCount, Count = contentlist.Count }; return(result); }
public IList <WallPaperCategoryView> GetCategoryViewList(MobileParam mobileParams, int cver, out int sver) { #region instance var cate0 = new WallPaperCategory() { Id = 0, Name = "全部", CategoryLogoUrl = "", Summary = string.Empty, OrderNumber = 0, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; var cate1 = new WallPaperCategory() { Id = 1, Name = "美女", CategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1123.jpg", Summary = string.Empty, OrderNumber = 1, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; var cate2 = new WallPaperCategory() { Id = 2, Name = "动漫", CategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1111.jpg", Summary = string.Empty, OrderNumber = 2, CreateDateTime = DateTime.Now, Comment = "", Status = 1 }; #endregion var categorylist = new List <WallPaperCategory>() { cate0, cate1, cate2 }; var result = categorylist.To <IList <WallPaperCategoryView> >(); sver = 1; return(result); }
private List <NewsContentView> GetTouTiaoContentViewList(MobileParam mobileParams, string categoryIds, long stamp, bool action, int startnum, int num, out int totalCont) { var response1 = string.Empty; var response2 = string.Empty; var response3 = string.Empty; var response4 = string.Empty; using (var sr = new StreamReader(string.Format("{0}{1}", DIR_PREFIX, "\\TouTiaoContent_hot.txt"))) { response1 = sr.ReadToEnd(); } using (var sr = new StreamReader(string.Format("{0}{1}", DIR_PREFIX, "\\TouTiaoContent_focus.txt"))) { response2 = sr.ReadToEnd(); } using (var sr = new StreamReader(string.Format("{0}{1}", DIR_PREFIX, "\\TouTiaoContent_finance.txt"))) { response3 = sr.ReadToEnd(); } using (var sr = new StreamReader(string.Format("{0}{1}", DIR_PREFIX, "\\TouTiaoContent_today_finance.txt"))) { response4 = sr.ReadToEnd(); } var toutiaoresult1 = GetTouTiaoContentViewList(GetTouTiaoContentList(response1, 1)); var toutiaoresult2 = GetTouTiaoContentViewList(GetTouTiaoContentList(response2, 2)); var toutiaoresult3 = GetTouTiaoContentViewList(GetTouTiaoContentList(response3, 3)); var toutiaoresult4 = GetTouTiaoContentViewList(GetTouTiaoContentList(response4, 4)); totalCont = 0; var categoryList = categoryIds.Split(';', ';').ToList(); var result = new List <NewsContentView>(); foreach (var categoryId in categoryList) { switch (categoryId.ToInt32()) { case 1: result = toutiaoresult1.Union(toutiaoresult2).ToList(); break; case 2: result = toutiaoresult3.Union(toutiaoresult4).ToList(); break; default: break; } result = result.Union(result).ToList(); totalCont = totalCont + result.Count; } foreach (var item in result) { var r = new Random(); item.ImageURL = GetFakeImageURLByResolution(mobileParams); item.ExtraAppId = r.Next(1, 3); } return(result.Skip(startnum - 1).Take(num).ToList()); }
public NewsExtraResult GetNewsExtraResult(MobileParam mobileParams, int extracver, out int extrasver, out int ratio) { var extralist = NewsService.GetExtraAppViewList(mobileParams, extracver, out extrasver, out ratio); var result = new NewsExtraResult() { NewsExtraList = extralist.ToList(), Count = extralist.Count, ServerViersion = extrasver, Ratio = ratio }; return(result); }
private string GetFakeImageURLByResolution(MobileParam mobileParams) { var HD_ImageURL = string.Format("{0}/720/2750762044_origin_283_6383591116.jpg", ConfigKeys.TYD_NEWS_IMAGE_FILE_URL.ConfigValue()); var Normal_ImageURL = string.Format("{0}/480/2748447810_origin_281_8233220044.jpg", ConfigKeys.TYD_NEWS_IMAGE_FILE_URL.ConfigValue()); var resolutionArray = mobileParams.Resolution.ToLower().Split('x'); var width = resolutionArray[0].ToInt32(); var height = resolutionArray[1].ToInt32(); if (width > 720) { return(HD_ImageURL); } return(Normal_ImageURL); }
protected void DynamicStat(string action, string appNo, string from ,MobileParam mobileParams) { if (ConfigKeys.DO_DYNAMIC_LOG.ConfigValue().ToBoolean()) { if (mobileParams == null) { mobileParams = new MobileParam(); } if (from.EqualsOrdinalIgnoreCase("wap") || mobileParams.OS.EqualsOrdinalIgnoreCase("android")) { string statKey = string.Format("{0}%{1}%{2}%{3}%{4}", appNo, DateTime.Now.ToString(DateTimeFormat.yyyyMMdd), mobileParams.FirmwareMode.MakeSureNotNull(), mobileParams.Manufacturer.MakeSureNotNull(), from); RedisService.IncrementValueInHash("stat:" + action, statKey); } } }
public int GetExtraRatioByChannel(MobileParam mobileParams) { var channel = mobileParams.Channel; var ratio = ConfigKeys.TYD_AD_EXTRA_RATIO_DEFAULT_VALUE.ConfigValue().ToInt32(); if (!string.IsNullOrEmpty(channel)) { var mobilechannel = MobileUIService.GetMobileChannel(channel); if (mobilechannel != null) { var extraratio = dbContextService.Single <NewsExtraRatio>(x => x.Status == 1 && x.ChannelId == mobilechannel.Id).MakeSureNotNull() as NewsExtraRatio; ratio = extraratio.Ratio; } } return(ratio); }
public int GetImageURLTypeByResolution(MobileParam mobileParams) { var resolution = mobileParams.Resolution; if (string.IsNullOrEmpty(resolution)) { return(0); } var width = resolution.GetResolutionWidth(); if (width >= Const.NEWS_HD_RESOLUTION_WIDTH) { return(2); } return(1); }
public IList <ThemeConfigView> GetConfigViewList(MobileParam mobileParams, int type) { #region instance var config = new ThemeConfig() { Id = 1, Name = "壁纸分类", NameLowCase = "themecategory", Type = 1, Version = 1, Status = 1, CreateDateTime = DateTime.Now }; var config2 = new ThemeConfig() { Id = 2, Name = "壁纸子分类", NameLowCase = "themesubcategory", Type = 1, Version = 2, Status = 0, CreateDateTime = DateTime.Now }; var config3 = new ThemeConfig() { Id = 3, Name = "壁纸专题", NameLowCase = "themetopic", Version = 1, Type = 1, Status = 1, CreateDateTime = DateTime.Now }; #endregion var configlist = new List <ThemeConfig>() { config, config2, config3 }; var result = configlist.To <IList <ThemeConfigView> >(); return(result); }
public void AppList() { var mobileParam = new MobileParam(MockRequstheader.Object); var namevalues = new NameValueCollection(); namevalues[MobileParam.Key_Batch] = "mtk_6252a_11b"; namevalues[MobileParam.Key_CInfo] = "1-yl1001-24m"; namevalues[MobileParam.Key_Resolution] = "240x320"; MockRequstheader.Setup<NameValueCollection>(s => s.Header).Returns(namevalues); var service = new AppStoreServiceFake(null); string slver = string.Empty; int totalCount = 0; var list = service.AppList(mobileParam, (int)SectionViewType.Game_Recommend, 0, 0, 10, "", out slver, out totalCount); Assert.Equal(2, list.Count); }
public ClientUploadResult UserInfoUploadForAndroid(MobileParam mobileParams, ClientData clientData) { Random random = new Random(); var result = new ClientUploadResult { NextUserUploadTime = DateTime.Now.AddSeconds((double)ConfigKeys.DEFAULT_NEXT_USER_UPLOAD_TIMESPAN.ConfigValue().ToInt32()).AddMilliseconds(random.Next(86300000)) }; if (string.IsNullOrWhiteSpace(mobileParams.IMSI) || clientData == null) { return result; } var userUploadInfo = GetUserUploadInfo(clientData, mobileParams.IMSI); SaveUserUploadInfos(mobileParams, userUploadInfo); return result; }
public void full_convert() { var mt = new MobileParamTest(); var headerMock = new Mock<IRequestRepository>(); headerMock.Setup<NameValueCollection>(s => s.QueryString).Returns(mt.PrepareHeaderRepository()); var mobileParam = new MobileParam(headerMock.Object); var log = EntityMapping.Auto<MobileParam, CommunicationLog>(mobileParam); Assert.Equal(MobileParamTest.imei, log.IMEI); Assert.Equal(MobileParamTest.imsi, log.IMSI); Assert.Equal(MobileParamTest.smsc, log.SMSCode); Assert.Equal(MobileParamTest.batch, log.Batch); Assert.Equal(MobileParamTest.dh, log.DesignHouse); Assert.Equal(MobileParamTest.pf, log.Manufacturer); Assert.Equal(MobileParamTest.mpm, log.BrandModel); Assert.Equal(MobileParamTest.mod, log.FirmwareMode); Assert.Equal(MobileParamTest.lbyver, log.LobbyVersion); Assert.Equal(MobileParamTest.tm, log.DateOfProduction); Assert.Equal(MobileParamTest.lcd, log.Resolution); Assert.Equal(MobileParamTest.mcode, log.MCode); Assert.Equal(MobileParamTest.sim, log.SIMNo); Assert.Equal(false, log.HasTCard); Assert.Equal(true, log.IsTouch); Assert.Equal(true, log.HasKeyboard); Assert.Equal(false, log.HasGravity); Assert.Equal(false, log.HasCapacitive); Assert.Equal("2.0", log.JavaInfo); Assert.Equal("2.0", log.CInfo); Assert.Equal("6.0", log.LuaInfo); Assert.Equal(MobileParamTest.lbs, log.LBS); Assert.Equal(MobileParamTest.no, log.FromAppNo); Assert.Equal(MobileParamTest.ver, log.AppVersion); Assert.Equal("12111", log.ClientReleaseVersion); Assert.Equal(MobileParamTest.payver, log.BillingConfigVersion); Assert.Equal(MobileParamTest.pht, log.PhoneType); Assert.Equal(MobileParamTest.os, log.OS); Assert.Equal(MobileParamTest.nt, log.NetworkType); Assert.Equal(MobileParamTest.pver, log.SoftwareVersion); Assert.Equal(MobileParamTest.encoding, log.Encoding); Assert.Equal(MobileParamTest.ram, log.RAM); Assert.Equal(MobileParamTest.rom, log.ROM); }
public WallPaperView GetWallPaperViewDetail(MobileParam mobileParams, int wallPaperId) { var property = CommonServiceHelper.GetMobileProperty(mobileParams); var wallpaper = from p in dbContextService.Find <WallPaper>(x => x.Id == wallPaperId) join pm in dbContextService.Find <WallPaperRelateMobileProperty>(x => x.MobilePropertyId == property.Id) on p.Id equals pm.WallPaperId select new WallPaper { Id = p.Id, Title = p.Title, ThumbnailName = p.ThumbnailName, OriginalName = p.OriginalName, DownloadNumber = p.DownloadNumber, Rating = p.Status, PublishTime = p.PublishTime }; return(wallpaper.To <WallPaperView>()); }
public IList <NewsConfigView> GetConfigViewList(MobileParam mobileParams) { #region instance var config = new NewsConfig() { Id = 1, Name = "提供商", NameLowCase = "newssource", Version = 1, Status = 1, CreateDateTime = DateTime.Now }; var config2 = new NewsConfig() { Id = 2, Name = "分类", NameLowCase = "newscategory", Version = 2, Status = 1, CreateDateTime = DateTime.Now }; var config3 = new NewsConfig() { Id = 3, Name = "外推应用", NameLowCase = "newsextraapp", Version = 1, Status = 1, CreateDateTime = DateTime.Now }; #endregion var configlist = new List <NewsConfig>() { config, config2, config3 }; var result = configlist.To <IList <NewsConfigView> >(); return(result); }
public ActionResult AppStoreBatchDownload(int count = 20) { const string queryString = "os=android&imsi=9999&imei=9999&istest=1&lcd=480x800"; var mobileParam = new MobileParam(new UtilRequestRepository(queryString)); var tags = new Dictionary<int, string> { }; tags[59] = "首页专题"; tags[34] = "首页热门推荐"; tags[33] = "首页最新上线"; tags[29] = "软件排行榜"; tags[28] = "游戏排行榜"; var groupIds = new List<int> { 1, 2 }; groupIds.ForEach(s => { var tagsFromGroup = _appStoreService.GetTags(s.ToString()); var groupName = ""; if (s == 1) groupName = "游戏"; if (s == 2) groupName = "应用"; if (tagsFromGroup != null) { for (int i = 0; i < tagsFromGroup.Count; i++) { tags[tagsFromGroup[i].Id.ToInt32()] = groupName + tagsFromGroup[i].Name; } } }); var total = 0; var ret = new Dictionary<int, IList<ApplistItemView>>(); foreach (var item in tags) { var apps = _appStoreService.GetAppListByTagIds(mobileParam, 0, count, out total, item.Key.ToString()); ret[item.Key] = apps; } ViewBag.Group = tags; ViewBag.Total = count; return View(ret); }
public IList <WallPaperView> GetWallPaperViewList(MobileParam mobileParams, int screenType, int categoryId, int topicId, int subcategoryId, int sort, int startnum, int num, out int totalCount) { var property = CommonServiceHelper.GetMobileProperty(mobileParams); var result = new List <WallPaperView>(); totalCount = 0; switch (sort) { case 1: result = WallPaperServiceHelper.GetLatestWallPaperViewList(mobileParams, property, screenType, categoryId, topicId, subcategoryId, out totalCount).ToList(); break; default: result = WallPaperServiceHelper.GetHottestWallPaperViewList(mobileParams, property, screenType, categoryId, topicId, subcategoryId, out totalCount).ToList(); break; } return(result.Skip(startnum - 1).Take(num).ToList()); }
private void WriteDebugLog(IRequestRepository request, MobileParam mobileParam, string controllerName, string actionName) { var mode = RegistryModeFactory.GetCurrentMode(); if (mode == RegistryMode.Debug || mode == RegistryMode.Release) { LogHelper.WriteInfo(string.Format("/{0}/{1}:URL: {2}", controllerName, actionName, request.RawUrl)); if (request.Header != null && request.Header.Count > 0) { var sb = new StringBuilder(); foreach (var item in request.Header.AllKeys) { sb.AppendFormat("{0}={1}", item, request.Header[item]); } LogHelper.WriteInfo(string.Format("/{0}/{1}:HeaderInfo: {2}", controllerName, actionName, sb.ToString())); } //LogHelper.WriteInfo(string.Format("/{0}/{1}:MobileParam: {2}", controllerName, actionName, mobileParam.ToString(true))); } }
public void Flush_test() { var mt = new MobileParamTest(); var headerMock = new Mock<IRequestRepository>(); headerMock.Setup<NameValueCollection>(s => s.QueryString).Returns(mt.PrepareHeaderRepository()); var sqlLoaderLogger = new Logger(); var mobileParam = new MobileParam(headerMock.Object); var log = EntityMapping.Auto<MobileParam, CommunicationLog>(mobileParam); log.DomainNameId = 11; log.Url = "211.151.64.236/asdfsd/asd/f/sad/f/sd/f/sa/df/s/df?dfdsfsd=中文"; log.RequestBody = "{\"pid\":100,\"version\":{\"reserved\":2,\"minor\":8,\"major\":1},\"imei\":\"356516040152451\",\"imsi\":\"460001511666063\"}"; log.ActionId = 10012; log.ResultCode = 0; log.ProvinceId = 26; log.CityId = 10012; log.IPAddress = "101.222.33.258,25.36.556.89"; sqlLoaderLogger.Write<CommunicationLog>(log); sqlLoaderLogger.FlushAll(); }
public IList <NewsInfAddressView> GetInfAddressViewList(MobileParam mobileParams, int cver, out int sver) { #region instance var mode1 = new NewsInfAddress() { Id = 1, Name = "腾讯热门", SourceId = 2, CategoryId = 1, SubCategoryId = 0, IsStamp = 0, InfAddress = "http://openapi.inews.qq.com/getNewsByChlidVerify?chlid=news&refer=openapi_for_tianyida&appkey=3XfMefMGRHJMpKZHKbKxFWvsFgO4FV&n=10", Status = 1, CreateDateTime = DateTime.Now }; var mode2 = new NewsInfAddress() { Id = 2, Name = "腾讯科技", SourceId = 2, CategoryId = 2, SubCategoryId = 0, IsStamp = 0, InfAddress = "http://openapi.inews.qq.com/getNewsByChlidVerify?chlid=tech&refer=openapi_for_tianyida&appkey=3XfMefMGRHJMpKZHKbKxFWvsFgO4FV&n=10", Status = 1, CreateDateTime = DateTime.Now }; #endregion var modelist = new List <NewsInfAddress>() { mode1, mode2 }; sver = 1; var result = modelist.To <IList <NewsInfAddressView> >(); return(result); }
public IList <NewsExtraAppView> GetExtraAppViewList(MobileParam mobileParams, int cver, out int sver, out int ratio) { #region instance var pkgName_TouTiao = "com.ss.android.article.news"; var pkgName_QQBrower = " com.tencent.mtt"; var mode1 = new NewsExtraApp() { Id = 1, Name = "今日头条", PackageName = pkgName_TouTiao, ExtraLinkUrl = string.Format(APK_DOWNLOAD_PREFIX_URL, pkgName_TouTiao), IsBrower = 0, Status = 1, CreateDateTime = DateTime.Now }; var mode2 = new NewsExtraApp() { Id = 2, Name = "QQ浏览器", PackageName = pkgName_QQBrower, ExtraLinkUrl = string.Format(APK_DOWNLOAD_PREFIX_URL, pkgName_QQBrower), IsBrower = 1, Status = 1, CreateDateTime = DateTime.Now }; #endregion var modelist = new List <NewsExtraApp>() { mode1, mode2 }; sver = 1; ratio = 0; var result = modelist.To <IList <NewsExtraAppView> >(); return(result); }
protected internal Encoding GetClientInterfaceEnconding(MobileParam param) { var encoding = default(Encoding); if (!param.Encoding.IsNullOrEmpty()) { var name = param.Encoding.ToUpper(); switch (name) { case EncodingNames.UTF8: case "UTF8": encoding = Encoding.UTF8; break; } } if (encoding == null) { encoding = this.DefaultEncoding; } return(encoding); }
public string WriteDownloadSuccessLog(string appNo, string pkgName, int typeId, long logId, MobileParam mobileParams, string downloadUrl) { //if (mobileParams.IsTest == null && logId > 0) //{ // var Log = new DownloadedLog(); // Log.APKName = pkgName; // Log.AppNo = appNo; // Log.DownLoadUrl = downloadUrl; // Log.ActionType = GetDownLoadDestinationType(typeId); // Log.LogId = logId; // LogService.Add<DownloadedLog>(Log); // DynamicStat("DD", appNo, mobileParams.AppNo.EqualsOrdinalIgnoreCase("wap") ? "wap" : "if", mobileParams); //} return string.Empty; }
public IList<AppUpdateListItemView> UpdateList(string data, MobileParam mobileParam) { var appInfos = data.Split(ASCII.SEMICOLON_CHAR); List<AppUpdateListItemView> appUpdateListItems = new List<AppUpdateListItemView>(); foreach (var appInfo in appInfos) { var appTemp = appInfo.Split(ASCII.WAVYLINE_CHAR); if (appTemp.Length >= 2) { var appNo = appTemp[0]; var appVer = appTemp[1]; if (!string.IsNullOrWhiteSpace(appNo) && !string.IsNullOrWhiteSpace(appVer)) { Func<AppProject> getAppProjectAction = () => AppStoreUIService.GetAppProjectByAppNo(appNo); UpdateListInternal(appVer, appUpdateListItems, mobileParam, getAppProjectAction); } } } return appUpdateListItems; }
public string Startup(MobileParam mobileParams, string verCode, string verName, long logID) { //if (mobileParams.IsTest == null && logID > 0) //{ // StartupLog startupLog = new StartupLog // { // LogId = logID, // VersionCode = verCode, // VersionName = verName // }; // LogService.Add<StartupLog>(startupLog); //} return string.Empty; }
public IList<ApplistItemView> SearchGameByName(MobileParam mobileParams, int startnum, int num, out int totalCount, string keyword) { List<ApplistItemView> appListItems = new List<ApplistItemView>(); var appIds = new List<string>(); //search var idsByAppName = FuzzySearchedByAppName(mobileParams, keyword); var idsByTag = FuzzySearchedByTagName(mobileParams, keyword); var idsByAppDesc = FuzzySearchedByAppDesc(mobileParams, keyword); var idsByKeyword = SearchAppByKeyword(mobileParams, keyword); var idsByGameTag = AppStoreUIService.GetAppIdsByTagNames(new List<string> { GameCenterTags.NAME_GAME_CENTER }) .ToIdsWithNewPrefix<App>(); appIds = MergeAppSearchResults(idsByKeyword, idsByAppName, idsByTag, idsByAppDesc); appIds = appIds.Intersect(idsByGameTag).ToList(); if (appIds != null) { totalCount = appIds.Count; appIds = (appIds.Skip(startnum - 1).Take(num)).ToList(); var apps = RedisService.GetValuesByIds<App>(appIds); SetAppInAppList(mobileParams, appListItems, null, apps); } else { totalCount = 0; } return appListItems; }
private List<string> FuzzySearchedByAppDesc(MobileParam mobileParams, string SearchKeyWord) { var appIds = new List<string>(); appIds = FullTextSearchService.SearchAppIdsByDesc(SearchKeyWord).ToIdsWithNoPrefix<App>(); appIds = ConditionFiltered(mobileParams, appIds); appIds = RedisService2.GetSortedIdsByProperty<App>(appIds, "DownloadTimes", 1, 0); return appIds; }
private List<string> ConditionFiltered(MobileParam mobileParams, List<string> appIds) { if (IsInAppStoreGlobalWhiteList(mobileParams))//whitelist {//publish status var liveAppIds = AppStoreUIService.GetAppIdsByTagNames(string.Format("{0};{1}", TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Live_Publish_Tag, STATUS_VALID).Split(';', ';').ToList()); var betaAppIds = AppStoreUIService.GetAppIdsByTagNames(string.Format("{0};{1}", TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Beta_Publish_Tag, STATUS_VALID).Split(';', ';').ToList()); var publishFilteredAppIds = liveAppIds.Union(betaAppIds).ToList(); appIds = RedisService2.GetIntersectIdsByPropertyFromSets(appIds, publishFilteredAppIds).ToIdsWithNewPrefix<App>(); } else { var tagNames = string.Format("{0};{1}", TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Live_Publish_Tag, STATUS_VALID); var publishFilteredAppIds = AppStoreUIService.GetAppIdsByTagNames(tagNames.Split(';', ';').ToList()); appIds = appIds.Intersect(publishFilteredAppIds).ToList().ToIdsWithNewPrefix<App>(); } //os var AllElement = RedisService.GetValuesByIds<Element>(RedisService.GetAllActiveModelIds<Element>()); var OSId = "4"; foreach (var item in AllElement) { if (item.Name.EqualsOrdinalIgnoreCase("OS")) { OSId = item.Id; break; } } appIds = RedisService2.GetIntersectIdsByPropertyFromSets<App>(appIds, OSId + ":Android"); //appIds = FilterAppIdsByManufacturer(mobileParams, appIds, AllElement); //Appstore appIds = RedisService2.GetFilteredIdsByPropertyFromSets<App>(appIds, "ModuleName:" + "OTA"); return appIds; }
public IList<ApplistItemView> GetAppListByTags(MobileParam mobileParams, int startnum, int num, out int totalCount, string tagNames) { List<ApplistItemView> appListItems = new List<ApplistItemView>(); if (string.IsNullOrEmpty(tagNames)) { totalCount = 0; return appListItems; } var appIds = new List<string>(); var internalProjectTags = MatchedTagNamesByMobileParams(mobileParams); var liveTagList = string.Format("{0};{1};{2}", tagNames, TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Live_Publish_Tag, STATUS_VALID).Split(';', ';').ToList(); if (internalProjectTags.Count > 0) { liveTagList.AddRange(internalProjectTags); } if (IsInAppStoreGlobalWhiteList(mobileParams)) { var betaTagList = string.Format("{0};{1};{2}", tagNames, TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Beta_Publish_Tag, STATUS_VALID).Split(';', ';').ToList(); if (internalProjectTags.Count > 0) { betaTagList.AddRange(internalProjectTags); } var liveAppIds = AppStoreUIService.GetAppIdsByTagNames(liveTagList); var betaAppIds = AppStoreUIService.GetAppIdsByTagNames(betaTagList); appIds = liveAppIds.Union(betaAppIds).ToList(); } else { appIds = AppStoreUIService.GetAppIdsByTagNames(liveTagList); } if (appIds != null) { totalCount = appIds.Count; appIds = RedisService2.GetSortedIdsByProperty<App>(appIds.ToIdsWithNewPrefix<App>(), "DownloadTimes", 0, 0); if (!tagNames.Contains(";")) { var tagId = AppStoreUIService.GetTagIdByName(tagNames); if (!string.IsNullOrEmpty(tagId)) { var appOrder = AppStoreUIService.GetAppOrderByTag(tagId); if (appOrder != null) { var appOrderWithPrefix = new Dictionary<int, string>(); foreach (var key in appOrder.Keys) { appOrderWithPrefix[key] = "App:" + appOrder[key]; } appIds = ApplySortOrder(appIds, appOrderWithPrefix); } } } appIds = appIds.Skip(startnum - 1).Take(num).ToList(); var apps = RedisService.GetValuesByIds<App>(appIds); SetAppInAppList(mobileParams, appListItems, null, apps); } else { totalCount = 0; } return appListItems; }
public IList<ApplistItemView> GetAppListByTagIds(MobileParam mobileParams, int startnum, int num, out int totalCount, string tagIds) { var tagNames = new StringBuilder(); var tagIdsList = tagIds.Split(';', ';').ToList(); foreach (var id in tagIdsList) { var tag = RedisService.Get<Tag>(id); if (tag != null) { tagNames.Append(tag.Name); tagNames.Append(ASCII.SEMICOLON); } } if (tagNames.Length > 0) { tagNames.Remove(tagNames.Length - 1, 1); } return this.GetAppListByTags(mobileParams, startnum, num, out totalCount, tagNames.ToString()); }
public string GetAppDownloadUrlForAndroid(string pkgName, MobileParam mobileParams, long logID) { Func<AppProject> getAppProjectAction = () => AppStoreUIService.GetAppProjectByPKGName(pkgName); return GetAppDownloadUrlInternal(getAppProjectAction, mobileParams, logID).ToFileServerUrlAPP(); }
public string GetAppDownloadUrl(string appNo, MobileParam mobileParams, long logID) { Func<AppProject> getAppProjectAction = () => AppStoreUIService.GetAppProjectByAppNo(appNo); return GetAppDownloadUrlInternal(getAppProjectAction, mobileParams, logID).ToFileServerUrlAPP(); }
public void DynamicStatistic(string action, string appNo, string from, MobileParam mobileParams) { base.DynamicStat(action, appNo, from, mobileParams); }
public void WriteLandlordsLog(MobileParam mobileParam, long logId, MobileOperatingSystemType type) { //if (mobileParam.IsTest == null && logId > 0) //{ // LandlordLog log = new LandlordLog() // { // IMEI = mobileParam.IMEI, // IMSI = mobileParam.IMSI, // Channel = mobileParam.Manufacturer, // LogId = logId, // OSType = type // }; // LogService.Add<LandlordLog>(log); //} }
private AppView AppDetailInternal(MobileParam mobileParams, Func<AppProject> getAppProjectAction) { var appView = default(AppView); var appProject = getAppProjectAction(); if (appProject != null) { var app = AppStoreUIService.GetMatchedAppByRequest<AppProject>(appProject.Id, mobileParams); if (!IsPublishableApp(app, mobileParams)) return null; appView = EntityMapping.Auto<App, AppView>(app); appView.AppNo = app.AppNo; appView.Company = appProject.Creator; //image var imgInfos = app.ScreenShot; appView.ImageCount = imgInfos.Count; appView.ImageList = new List<string>(); appView.ImageUrls = new List<string>(); imgInfos.ForEach(i => { appView.ImageList.Add(i.Id + i.Extension); if (!i.FileUrl.IsNullOrEmpty()) { appView.ImageUrls.Add(i.FileUrl.GetImageRelativeUrlByAbsoluteUrl().ToFileServerUrlAPP()); } }); appView.LogoFileName = GetSingleAppImageUrl(app.Logo.Id); appView.ScreenShots = new List<string>(); appView.DownloadTimes = app.DownloadTimes; appView.ApkName = appProject.PackageName; appView.ReviewCount = appProject.ReviewCount; appView.Rate = appProject.Rate.ToString(); var logoInfo = new List<AppLogo>(); foreach (var l in app.ClientLogos) { var logo = new AppLogo { Type = l.TypeId }; if (!string.IsNullOrWhiteSpace(l.TypeId)) { logo.Id = string.Format("C{0}{1}", l.Id, l.Extension); if (!l.FileUrl.IsNullOrEmpty()) logo.Url = l.FileUrl.GetImageRelativeUrlByAbsoluteUrl().ToFileServerUrlAPP(); logoInfo.Add(logo); } } appView.Icon = logoInfo; foreach (var i in appView.ImageList) { appView.ScreenShots.Add(GetSingleAppImageUrl(i)); } appView.ScreenShots = appView.ScreenShots.Take(3).ToList(); var appVersion = default(AppVersion); if (HasTestableVersionForAppStore(app, mobileParams)) { appView.Version = app.CurrentTestVersion; appVersion = AppStoreUIService.GetCurrentTestVersionForApp(app.Id); } else if (HasPublishableVersion(app)) { appView.Version = app.CurrentVer; appVersion = AppStoreUIService.GetCurrentVersionForApp(app.Id); } else { appView = null; } if (appVersion != null && appView != null) { var pkgInfo = AppStoreUIService.GetApkInfoForApp(app.Id, appVersion.Id, false); if (pkgInfo != null) { appView.MinSDKVersion = GetMiniSDKByAPILevel(pkgInfo.MinSDKVersion); appView.MD5 = pkgInfo.MD5; } SetVersionInfoForApp(appView, appVersion, mobileParams); } } return appView; }
public IList<TagView> GetColumnList(MobileParam mobileParam) { var deviceModel = AppStoreUIService.GetDeviceModelByRequest(mobileParam); if (deviceModel == null) return new List<TagView>(); List<TagView> allTags = new List<TagView>(); var columns = RedisService.GetValuesByIds<AppColumn>(deviceModel.Columns.Values.ToList(), true); if (columns != null) { var parentIdDisc = new Dictionary<int, int>(); var parentOriginIds = columns.Select(x => x.ParentId.ToInt32()).Distinct().ToList(); parentOriginIds.ForEach(x => parentIdDisc[x] = x == 0 ? 0 : RedisService.Get<AppColumn>(x.ToString()).ClientId); foreach (var c in columns) { allTags.Add(new TagView() { Id = c.ClientId, ParentId = parentIdDisc[c.ParentId.ToInt32()], ParentName = c.ParentName, Name = c.Name }); } } return allTags; }
public AppView AndroidAppDetail(string pkgName, MobileParam mobileParams) { Func<AppProject> getAppProjectAction = () => AppStoreUIService.GetAppProjectByPKGName(pkgName); return AppDetailInternal(mobileParams, getAppProjectAction); }
/// <summary> /// AddUser, ActiveUser statistics for market 3.0 and market 3.1. /// </summary> /// <param name="type">3.0 or 3.1</param> /// <param name="date">Some day</param> /// <param name="mobileParams"></param> public void MarketStatistic(MarketStatisticType type, DateTime date, MobileParam mobileParams) { if (mobileParams != null && ConfigKeys.DO_MARKET_LOG.ConfigValue().ToBoolean()) { var dateString = date.ToString(DateTimeFormat.yyyyMMdd); switch (type) { case MarketStatisticType.Market30: Market30Statistic(dateString, mobileParams); break; case MarketStatisticType.Market31: Market31Statistic(dateString, mobileParams); break; } } }
public MobileParamTest() { _param = new MobileParam(_headerRepositoryMock.Object); }
public IList<ApplistItemView> SearchAndroidAppListByName(MobileParam mobileParams, int startnum, int num, out int totalCount, string SearchKeyWord) { List<ApplistItemView> appListItems = new List<ApplistItemView>(); var appIds = new List<string>(); if (!SearchKeyWord.IsNullOrEmpty()) { SearchKeyWord = SearchKeyWord.Replace(ASCII.COLON, string.Empty); } //search //var idsByAppName = FuzzySearchedByAppName(mobileParams, SearchKeyWord); //var idsByTag = FuzzySearchedByTagName(mobileParams, SearchKeyWord); var idsByAppDesc = FuzzySearchedByAppDesc(mobileParams, SearchKeyWord); var idsByKeyword = SearchAppByKeyword(mobileParams, SearchKeyWord); appIds = MergeAppSearchResults(idsByKeyword, new List<string>(), new List<string>(), idsByAppDesc); if (appIds != null) { totalCount = appIds.Count; //appIds = RedisService2.GetSortedIdsByProperty<App>(appIds, "OrderNumber", startnum, num); appIds = (appIds.Skip(startnum - 1).Take(num)).ToList(); var apps = RedisService.GetValuesByIds<App>(appIds); SetAppInAppList(mobileParams, appListItems, null, apps); } else { totalCount = 0; } return appListItems; }