示例#1
0
 /// <summary>
 /// 热门活动
 /// </summary>
 /// <returns></returns>
 public ActionResult GetActivityCatalogue()
 {
     try
     {
         string appid    = CheckAPPID();
         string cacheKey = "ActivityCatalogue";
         List <ActivityCatalogueItem> activityCatalogueItems = redisCache.Read <List <ActivityCatalogueItem> >(cacheKey, 7L);
         if (activityCatalogueItems == 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_Activity_CatalogueRequest dTK_Activity_CatalogueRequest = new DTK_Activity_CatalogueRequest();
             dTK_Activity_CatalogueRequest.version = "v1.1.0";
             DTK_Activity_CatalogueResponse dTK_Activity_CatalogueResponse = dTK_ApiManage.GetActivityCatalogueList(dTK_Activity_CatalogueRequest);
             if (dTK_Activity_CatalogueResponse.code != 0)
             {
                 return(Fail(dTK_Activity_CatalogueResponse.msg));
             }
             activityCatalogueItems = dTK_Activity_CatalogueResponse.data;
             redisCache.Write(cacheKey, activityCatalogueItems, DateTime.Now.AddDays(1.0), 7L);
         }
         return(SuccessList("获取成功!", activityCatalogueItems));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
示例#2
0
        /// <summary>
        /// 获取热门活动
        /// </summary>
        /// <param name="dTK_Activity_CatalogueRequest"></param>
        /// <returns></returns>
        public DTK_Activity_CatalogueResponse GetActivityCatalogueList(DTK_Activity_CatalogueRequest dTK_Activity_CatalogueRequest)
        {
            DTK_Activity_CatalogueResponse dTK_Activity_CatalogueResponse = null;

            try
            {
                string resultContent = GeneralApiParam(api_activity_catalogue, dTK_Activity_CatalogueRequest.ModelToUriParam());
                dTK_Activity_CatalogueResponse = resultContent.ToJsonObject <DTK_Activity_CatalogueResponse>();
            }
            catch (Exception ex)
            {
                LogHelper.WriteException("GetSearchSuggestion", ex);
            }
            return(dTK_Activity_CatalogueResponse);
        }