Ejemplo n.º 1
0
        /// <summary>
        /// 精选专辑
        /// </summary>
        /// <returns></returns>
        public DTK_Topic_CatalogueResponse GetTopicCatalogue(DTK_Topic_CatalogueRequest dTK_Topic_CatalogueRequest)
        {
            DTK_Topic_CatalogueResponse dTK_Topic_CatalogueResponse = null;

            try
            {
                string resultContent = GeneralApiParam(api_topic_catalogue, dTK_Topic_CatalogueRequest.ModelToUriParam());
                dTK_Topic_CatalogueResponse = resultContent.ToJsonObject <DTK_Topic_CatalogueResponse>();

                return(dTK_Topic_CatalogueResponse);
            }
            catch (Exception ex)
            {
                LogHelper.WriteException("GetTopicCatalogue", ex);
            }
            return(dTK_Topic_CatalogueResponse);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 精选专辑
 /// </summary>
 /// <returns></returns>
 public ActionResult GetTopicCatalogue()
 {
     try
     {
         string            appid               = CheckAPPID();
         string            cacheKey            = "TopicCatalogue";
         List <BannerInfo> topicCatalogueItems = redisCache.Read <List <BannerInfo> >(cacheKey, 7L);
         if (topicCatalogueItems == null)
         {
             dm_basesettingEntity       dm_BasesettingEntity       = dM_BaseSettingIBLL.GetEntityByCache(appid);
             DTK_ApiManage              dTK_ApiManage              = new DTK_ApiManage(dm_BasesettingEntity.dtk_appkey, dm_BasesettingEntity.dtk_appsecret);
             DTK_Topic_CatalogueRequest dTK_Topic_CatalogueRequest = new DTK_Topic_CatalogueRequest();
             dTK_Topic_CatalogueRequest.version = "v1.1.0";
             DTK_Topic_CatalogueResponse dTK_Topic_CatalogueResponse = dTK_ApiManage.GetTopicCatalogue(dTK_Topic_CatalogueRequest);
             if (dTK_Topic_CatalogueResponse.code != 0)
             {
                 return(Fail(dTK_Topic_CatalogueResponse.msg));
             }
             topicCatalogueItems = new List <BannerInfo>();
             foreach (TopicCatalogueItem item in dTK_Topic_CatalogueResponse.data)
             {
                 if (item.banner.Count > 0)
                 {
                     topicCatalogueItems.Add(new BannerInfo
                     {
                         banner    = item.banner[0],
                         topicId   = item.topicId,
                         topicName = item.topicName
                     });
                 }
             }
             redisCache.Write(cacheKey, topicCatalogueItems, DateTime.Now.AddDays(1.0), 7L);
         }
         return(SuccessList("获取成功!", topicCatalogueItems));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }