Exemplo n.º 1
0
        public AppListWithTag GetAppList(string tagId, string sortKey = DEFAULT_SORT, int startNum = 0, int num = 0)
        {
            var appListWithTag = new AppListWithTag();

            var tag = RedisService.Get<Tag>(tagId);
            if (tag != null)
            {
                var liveAppIds = GetLiveAndriodAppIdsByTag(tagId);

                appListWithTag = GetSortedAppListWithTag(liveAppIds, startNum, num, sortKey, tagId);
            }
            return appListWithTag;
        }
Exemplo n.º 2
0
        protected AppListWithTag GetSortedAppListWithTag(List<string> liveAppIds, int startNum, int num, string sortKey,string tagId)
        {
            var appListWithTag = new AppListWithTag();

            var tag = RedisService.Get<Tag>(tagId);

            //add tagInfo
            appListWithTag.TagName = tag.Name;
            appListWithTag.TagId = tagId;
            appListWithTag.LogoUrl = tag.LogoUrl;

            appListWithTag.IsMore = false;

            var resultAppIds = RedisService2.GetSortedIdsByProperty<App>(liveAppIds, sortKey, startNum, num);

            resultAppIds = ApplyAppOrderByTag(tagId, resultAppIds);

            var apps = new List<App>();

            if (resultAppIds != null && resultAppIds.Count > 0)
            {
                apps = RedisService.GetValuesByIds<App>(resultAppIds);
                appListWithTag.TagAppList = ConvertAppsToAppList(apps);
                var more = RedisService2.GetSortedIdsByProperty<App>(liveAppIds, sortKey, startNum + num, num);

                if (more != null && more.Count > 0)
                {
                    appListWithTag.IsMore = true;
                }
            }

            return appListWithTag;
        }