public ActionResult AppList(string tagId, string keyword = "", int page = 0) { string lcd = GetLCD(string.Empty); ViewData["tagGroupId"] = TempData["tagGroupId"]; TempData["tagGroupId"] = ViewData["tagGroupId"]; ViewData["tagId"] = tagId; ViewData["keyword"] = keyword; int totalCount = 0; var webTagList = new WapTagListItem(); if (tagId.IsNullOrEmpty()) { if (!string.IsNullOrWhiteSpace(keyword)) { webTagList = AppStoresWapUISerivces.SearchAndroidAppListByName(lcd, (PAGESIZE * page), PAGESIZE, out totalCount, keyword); } } else { webTagList = AppStoresWapUISerivces.GetAppList(lcd, tagId, (PAGESIZE * page), PAGESIZE); } ViewData["isAppListAndhasRecord"] = webTagList.TagAppList != null ? webTagList.TagAppList.Count > 0 ? true : false : false; return View(webTagList); }
public ContentResult GetMoreAppList(string tagId, int askTimes = 1, string keyword = "") { string lcd = GetLCD(string.Empty); var startNum = askTimes * PAGESIZE + 1; var ismore = "1"; int totalCount = 0; var webTagList = new WapTagListItem(); if (tagId.IsNullOrEmpty()) { webTagList = AppStoresWapUISerivces.SearchAndroidAppListByName(lcd, startNum, PAGESIZE, out totalCount, keyword); } else { webTagList = AppStoresWapUISerivces.GetAppList(lcd, tagId, startNum, PAGESIZE); } if (!webTagList.IsMore) { ismore = "0"; } var htmlData = this.GetHtmlHelper("_AppList").Partial("_WapProgramListitem", webTagList.TagAppList); return Content(ismore + htmlData.ToString()); }
public WapTagListItem GetAppList(string lcd,string tagId, int startNum = 0, int num = 0) { var wapTagList = new WapTagListItem(); var tag = RedisService.Get<Tag>(tagId); if (tag != null) { wapTagList.TagName = tag.Name; wapTagList.TagId = tagId; wapTagList.LogoUrl = tag.LogoUrl; wapTagList.IsMore = false; var appIds = AppStoreUIService.GetAppIdsByTag(tag.Id).ToIdsWithNoPrefix<App>(); //var liveAppIds = AppStoreUIService.GetAppIdsByTagNames(string.Format("{0};{1}", TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Live_Publish_Tag, STATUS_VALID).Split(';', ';').ToList()).ToIdsWithNewPrefix<App>(); //appIds = RedisService.GetIntersectIdsByPropertyFromSets(appIds, liveAppIds); appIds = CheckOutAppIds(lcd, appIds).ToList(); var resultAppIds = RedisService2.GetSortedIdsByProperty<App>(appIds, "DownloadTimes", 0, 0); if (!string.IsNullOrEmpty(tagId)) { var appOrder = AppStoreUIService.GetAppOrderByTag(tagId); var appOrderWithPrefix = new Dictionary<int, string>(); if (appOrder != null) { foreach (var key in appOrder.Keys) { appOrderWithPrefix[key] = "App:" + appOrder[key]; } resultAppIds = ApplySortOrder(resultAppIds, appOrderWithPrefix); } } resultAppIds = resultAppIds.Skip(startNum - 1).Take(num).ToList(); var apps = new List<App>(); if (resultAppIds != null && resultAppIds.Count > 0) { apps = RedisService.GetValuesByIds<App>(resultAppIds); wapTagList.TagAppList = ConvertAppsToAppList(apps); var more = RedisService2.GetSortedIdsByProperty<App>(appIds, "DownloadTimes", startNum + num, num); if (more != null && more.Count > 0) { wapTagList.IsMore = true; } } } return wapTagList; }
private void SetWapAppList(WapTagListItem wapTagListItem, List<App> apps,bool IsMore) { wapTagListItem.TagId = string.Empty; wapTagListItem.TagName = string.Empty; wapTagListItem.TagAppList = ConvertAppsToAppList(apps); wapTagListItem.IsMore = IsMore; }
public WapTagListItem SearchAndroidAppListByName(string lcd, int startnum, int num, out int totalCount, string SearchKeyWord) { WapTagListItem wapTagListItem = new WapTagListItem(); var idsByAppName = CheckOutAppIds(lcd, AppStoreUIService.SearchAndroidAppIdsListByAppName(SearchKeyWord)); var idsByTag = CheckOutAppIds(lcd, AppStoreUIService.SearchAndroidAppIdsListByTag(SearchKeyWord)); var idsByAppDesc = CheckOutAppIds(lcd, FullTextSearchService.SearchAppIdsByDesc(SearchKeyWord)); var idsByAppKeyword = CheckOutAppIds(lcd, AppStoreUIService.GetAppIdsByKeyword(SearchKeyWord)); List<string> appIds = MergeAppSearchResults(idsByAppKeyword, idsByAppName, idsByTag, idsByAppDesc); if (appIds != null) { totalCount = appIds.Count; var more = appIds.Skip(startnum+num).Take(num).ToList(); bool IsMore = false; if (more != null && more.Count > 0) { IsMore = true; } appIds = (appIds.Skip(startnum).Take(num)).ToList();//RedisService2.GetSortedIdsByProperty<App>(appIds, string.Empty, startnum, num); var apps = RedisService.GetValuesByIds<App>( appIds); SetWapAppList(wapTagListItem, apps, IsMore); } else { totalCount = 0; } return wapTagListItem; }
public List<WapTagListItem> GetTagList(string lcd,string tagGroupId) { List<WapTagListItem> tagGroupList = new List<WapTagListItem>(); var tagIds = RedisService.GetAllSubModelIdsByType<TagCategory, TagInTagCategory>(tagGroupId).ToIdsWithNewPrefix<TagInTagCategory, Tag>(); tagIds = RedisService2.GetSortedIdsByProperty<Tag>(tagIds, "OrderNumber", 0, 0); var tags = RedisService.GetValuesByIds<Tag>(tagIds); foreach (var tag in tags) { var tagList = new WapTagListItem(); tagList.TagId = tag.Id; tagList.TagName = tag.Name; tagList.LogoUrl = tag.LogoUrl; tagList.TagAppList = new List<WapAppListItem>(); tagList.IsMore = false; var appIds = AppStoreUIService.GetAppIdsByTag(tag.Id).ToIdsWithNoPrefix<App>(); //var liveAppIds = AppStoreUIService.GetAppIdsByTagNames(string.Format("{0};{1}", TYD.Mobile.Infrastructure.Domain.Services.AppStoreUIService.Live_Publish_Tag, STATUS_VALID).Split(';', ';').ToList()).ToIdsWithNewPrefix<App>(); //appIds = RedisService.GetIntersectIdsByPropertyFromSets(appIds, liveAppIds); appIds = CheckOutAppIds(lcd,appIds).ToList(); var topThreeAppIds = RedisService2.GetSortedIdsByProperty<App>(appIds, "DownloadTimes", 1, 3); var topThreeApps = new List<App>(); if (topThreeAppIds != null && topThreeAppIds.Count > 0) { topThreeApps = RedisService.GetValuesByIds<App>(topThreeAppIds); tagList.TagAppList = ConvertAppsToAppList(topThreeApps); var more = RedisService2.GetSortedIdsByProperty<App>(appIds, "DownloadTimes", 4, 1); if (more != null && more.Count > 0) { tagList.IsMore = true; } } tagGroupList.Add(tagList); } return tagGroupList; }