Esempio n. 1
0
 /**
  * 留言列表
  *
  * @param pageIndex
  * @return
  * @throws AppException
  */
 public MessageList getMessageList(int pageIndex, boolean isRefresh) throws AppException {
   MessageList list = null;
   String key = "messagelist_" + loginUid + "_" + pageIndex + "_" + PAGE_SIZE;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       list = ApiClient.getMessageList(this, 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 = (MessageList) readObject(key);
       if (list == null) throw e;
     }
   } else {
     list = (MessageList) readObject(key);
     if (list == null) list = new MessageList();
   }
   return list;
 }