Ejemplo n.º 1
0
def replied_topic(user_id):
    # O(k)+O(m*n)
    rs = Replys.all(user_id=user_id)
    ts = []
    for r in rs:
        t = Topics.one(id=r.topic_id)
        ts.append(t)
    return ts
Ejemplo n.º 2
0
 def wrapper(*args, **kwargs):
     u = current_user()
     topic_id = request.args.get('id')
     t = Topics.one(id=topic_id)
     log('删除作者认证,文章作者id {}, 操作人id {}'.format(topic_id, u.id))
     if t.user_id == u.id:
         log('作者', u)
         return f(*args, **kwargs)
     else:
         log('非作者本人')
         abort(401)