Exemplo n.º 1
0
 def get(self, student_number):
     activities = query_someone_activity(student_number)
     if activities is None:
         return jsonify(true_data_Return("null", "null", "无数据"))
     data = []
     for i in activities:
         data.append(Activity.get_simple_activity(i))
     return jsonify(true_data_Return(data, "", "获取数据成功"))
Exemplo n.º 2
0
    def get(self, keyword):
        activities = Activity.query.filter(
            Activity.title.ilike('%' + keyword + '%')).all()
        articles = Article.query.filter(
            Article.title.ilike('%' + keyword + '%')).all()
        result = []
        for i in range(len(articles)):
            a = Article.get_simple_article(articles[i])
            result.append(a)

        for i in range(len(activities)):
            a = Activity.get_simple_activity(activities[i])
            result.append(a)
        result_number = len(activities) + len(articles)
        data = [result_number, result]
        print(data)
        return jsonify(true_data_Return(data, "", "获取数据成功"))