示例#1
0
文件: api.py 项目: guateam/LabGuide
def delete_tag():
    """
    清除tag
    :return:
    """
    token = request.form['token']
    db = Database()
    user = db.get({'token': token, 'group': 0}, 'user')
    if user:
        tag_id = request.form['tag_id']
        flag = db.delete({'ID': tag_id}, 'tag')
        if flag:
            return jsonify({'code': 1, 'msg': 'success'})
        return jsonify({'code': -1, 'msg': 'unknown error'})
    return jsonify({'code': 0, 'msg': 'permission denied'})
示例#2
0
文件: api.py 项目: guateam/LabGuide
def delete_account():
    """
    删除账号
    :return:
    """
    token = request.form['token']
    db = Database()
    user = db.get({'token': token, 'group': 0}, 'user')
    if not user:
        return jsonify({'code': 0, 'msg': 'permission denied'})

    snum = request.form['snum']
    if user['Snum'] == snum:
        return jsonify({'code': -2, 'msg': 'cant delete self'})

    flag = db.delete({'Snum': snum}, 'user')
    if flag:
        return jsonify({'code': 1, 'msg': 'success'})

    return jsonify({'code': -1, 'msg': 'unknown error'})