コード例 #1
0
 /**
  * 用户�客列表
  *
  * @param authoruid
  * @param pageIndex
  * @return
  * @throws AppException
  */
 public BlogList getUserBlogList(
     int authoruid, String authorname, int pageIndex, boolean isRefresh) throws AppException {
   BlogList list = null;
   String key =
       "userbloglist_"
           + authoruid
           + "_"
           + (URLEncoder.encode(authorname))
           + "_"
           + loginUid
           + "_"
           + pageIndex
           + "_"
           + PAGE_SIZE;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       list =
           ApiClient.getUserBlogList(this, authoruid, authorname, loginUid, pageIndex, PAGE_SIZE);
       if (list != null && pageIndex == 0) {
         Notice notice = list.getNotice();
         list.setNotice(null);
         list.setCacheKey(key);
         saveObject(list, key);
         list.setNotice(notice);
       }
     } catch (AppException e) {
       list = (BlogList) readObject(key);
       if (list == null) throw e;
     }
   } else {
     list = (BlogList) readObject(key);
     if (list == null) list = new BlogList();
   }
   return list;
 }
コード例 #2
0
 /**
  * �客列表
  *
  * @param type 推è��:recommend æœ?–°ï¼šlatest
  * @param pageIndex
  * @return
  * @throws AppException
  */
 public BlogList getBlogList(String type, int pageIndex, boolean isRefresh) throws AppException {
   BlogList list = null;
   String key = "bloglist_" + type + "_" + pageIndex + "_" + PAGE_SIZE;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       list = ApiClient.getBlogList(this, type, pageIndex, PAGE_SIZE);
       if (list != null && pageIndex == 0) {
         Notice notice = list.getNotice();
         list.setNotice(null);
         list.setCacheKey(key);
         saveObject(list, key);
         list.setNotice(notice);
       }
     } catch (AppException e) {
       list = (BlogList) readObject(key);
       if (list == null) throw e;
     }
   } else {
     list = (BlogList) readObject(key);
     if (list == null) list = new BlogList();
   }
   return list;
 }