public DTK_TB_Topic_ListResponse GettTBTopicList(DTK_TB_Topic_ListRequest dTK_TB_Topic_ListRequest) { DTK_TB_Topic_ListResponse dTK_TB_Topic_ListResponse = null; try { string resultContent = GeneralApiParam(api_tb_topic_list, dTK_TB_Topic_ListRequest.ModelToUriParam()); dTK_TB_Topic_ListResponse = resultContent.ToJsonObject <DTK_TB_Topic_ListResponse>(); } catch (Exception ex) { LogHelper.WriteException("GettTBTopicList", ex); } return(dTK_TB_Topic_ListResponse); }
public ActionResult GetTBTopicList(int userid, int type = 0, string pageId = "1", int pageSize = 20) { try { string appid = CheckAPPID(); string cacheKey = Md5Helper.Hash("TBTopicList" + type + pageId + pageSize); List <TB_TopicItem> tB_TopicItems = redisCache.Read <List <TB_TopicItem> >(cacheKey, 7L); if (tB_TopicItems == null) { dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(userid); if (dm_UserEntity.tb_relationid.IsEmpty()) { return(NoRelationID("渠道未备案!")); } dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid); DTK_ApiManage dTK_ApiManage = new DTK_ApiManage(dm_BasesettingEntity.dtk_appkey, dm_BasesettingEntity.dtk_appsecret); DTK_TB_Topic_ListRequest dTK_TB_Topic_ListRequest = new DTK_TB_Topic_ListRequest(); dTK_TB_Topic_ListRequest.version = "v1.2.0"; dTK_TB_Topic_ListRequest.type = type; dTK_TB_Topic_ListRequest.pageId = pageId; dTK_TB_Topic_ListRequest.pageSize = pageSize; dTK_TB_Topic_ListRequest.channelID = long.Parse(dm_UserEntity.tb_relationid.ToString()); DTK_TB_Topic_ListResponse dTK_TB_Topic_ListResponse = dTK_ApiManage.GettTBTopicList(dTK_TB_Topic_ListRequest); if (dTK_TB_Topic_ListResponse.code != 0) { return(Fail(dTK_TB_Topic_ListResponse.msg)); } tB_TopicItems = dTK_TB_Topic_ListResponse.data; redisCache.Write(cacheKey, tB_TopicItems, DateTime.Now.AddDays(1.0), 7L); } return(SuccessList("获取成功!", tB_TopicItems)); } catch (Exception ex) { return(FailException(ex)); } }