def addBook(): BookName = request.form.get('newbname') BookPress = request.form.get('newbpress') BookType = request.form.get('newbtype') update2json( add_book_sql(BookName.encode('utf8'), BookType.encode('utf8'), BookPress.encode('utf8'))) return redirect(url_for('main.dashboard'))
def addUser(): UserName = request.form.get('newuname') UserType = request.form.get('newutype') UserEmail = request.form.get('newuemail') update2json( add_user_sql(10086, UserName.encode('utf8'), int(UserType), UserEmail.encode('utf8'), 1, '备注')) return redirect(url_for('main.dashboard'))
def getBook(): bid = request.form.get('gbid') # update2json(delete_record_by_id_sql(session['uid'], bid)) # 增加图书借阅记录 # 修改图书状态 update2json(add_record_sql(bid, session['uid'])) update2json(set_book_status_sql(bid, 0)) # update2json() return redirect(url_for('main.dashboard'))
def resetPassword(): email = request.args.get('email') if update2json(reset_password_sql(email)) == 'ok': info = "reset " + str(email) + " account password 10086" return render_template('/reset.html', info=info) else: info = "重置失败" return render_template('/reset.html', info=info)
def lossBook(): bid = request.form.get('fbid') update2json(set_book_status_sql(bid, str(2))) # update2json(delete_record_by_id_sql(session['uid'], bid)) return redirect(url_for('main.dashboard'))
def deleteRecord(): bid = request.form.get('bid') update2json(set_book_status_sql(bid, 1)) update2json(delete_record_by_id_sql(session['uid'], bid)) return redirect(url_for('main.dashboard'))
def delBook(): delbid = request.form.get('delbid') update2json(del_book_sql(delbid.encode('utf8'))) return redirect(url_for('main.dashboard'))
def enableUser(): duid = request.form.get('duid') update2json(enable_User_sql(duid.encode('utf8'))) return redirect(url_for('main.dashboard'))