def get_article(): form = json.loads(request.get_data(as_text=True)) article = Article.find_by(chapter_id=form["chapter_id"]) if article == None: article = Article() article.title = "空" article.content = "当前章节没有文章,请直接刷题" return Response(json.dumps(article.__dict__, ensure_ascii=False), content_type='application/json') else: return Response(json_util.dumps(article.__dict__, ensure_ascii=False), content_type='application/json')