Exemple #1
0
 def get(self):
     articles = ArticleModel.getAllData()
     archive = []
     for article in articles:
         data = {
             'id': str(article.get('_id')),
             'aid': article.get('aid', ''),
             'title': article.get('title', ''),
             'createDate': article.get('createDate', ''),
             'time': article.get('time', '')
         }
         archive.append(data)
     resp = {'list': archive}
     return resp
Exemple #2
0
 def allData(self):
     articles = ArticleModel.getAllData()
     list = []
     for article in articles:
         data = {
             'id': str(article.get('_id', '')),
             'mk': article.get('mk', ''),
             'title': article.get('title', ''),
             'content': article.get('content', ''),
             'summary': article.get('summary', ''),
             'createYear': article.get('createDate', '')[:4],
             'createDay': article.get('createDate', '')[5:10],
             'createDate': article.get('createDate', ''),
             'updateDate': article.get('updateDate', ''),
             'category': article.get('category', ''),
             'tag': article.get('tag', '')
         }
         list.append(data)
     resp = {'list': list}
     return resp