INNER CODE UNIT · Python

update_question

kingname/SourceCodeofMongoRedis · chapter_12/QASystem/main.py:156

def update_question(info):
    if 'doc_id' not in info or 'title' not in info or 'text' not in info:
        return {'success': False, 'reason': '字段不全,必要字段:doc_id, title, text'}
    mongo.update_question(info['doc_id'], info['title'], info['text'])
    return {'success': True}


def update_answer(info):
    if 'doc_id' not in info or 'text' not in info:
        return {'success': False, 'reason': '字段不全,必要字段:doc_id, text'}
    mongo.update_answer(info['doc_id'], info['text'])
    return {'success': True}


@app.route('/update', methods=['POST'])
def update():
    session_data = redis.fetch_session(request.cookies.get('session'))
    if not session_data:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…