OA远程维修网

南邮共享打印机

‘]

if(ch_mode==1):
if(len(data) == 0):
return render_template(‘print.html’, data=data, state=1, ch_mode=ch_mode, message=message)
return render_template(‘print.html’, data=data, state=0, ch_mode=ch_mode, message=message)
elif(ch_mode==2):
if(len(data2) == 0):
return render_template(‘print.html’, data2=data2, state=1, ch_mode=ch_mode, message=message)
return render_template(‘print.html’, data2=data2, state=0, ch_mode=ch_mode, message=message)

@main.route(‘/print/write/’, methods=[‘GET’, ‘POST’])
@login_required
def print_write(ch_mode):
if request.method == ‘POST’:
title = request.form.get(‘title’)
content = request.form.get(‘content’)
try:
if(len(title)==0 or len(content)==0):
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
if(ch_mode==1):
f = open(‘app/static/shared/shared_print.txt’, ‘a’)
f.write(title + ‘\n’)
f.write(content + ‘\n’)
f.close()
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
elif(ch_mode==2):
f2 = open(‘app/static/shared/shared_presell.txt’, ‘a’)
f2.write(title + ‘\n’)
f2.write(content + ‘\n’)
f2.close()
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
except Exception as e:
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
return

@main.route(‘/print/mod//’, methods=[‘GET’, ‘POST’])
@login_required
def print_mod(ch_mode, num):
if request.method == ‘POST’:
title = request.form.get(‘title’)
content = request.form.get(‘content’)
try:
if(len(title)==0 or len(content)==0):
if(ch_mode==1):
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
elif(ch_mode==2):
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
if(ch_mode==1):
ofile = open(‘app/static/shared/shared_print.txt’, ‘r’)
ReadFile = ofile.readlines()
ofile.close()

num2 = num * 2
del ReadFile[num2-1]
del ReadFile[num2-2]

ReadFile.insert(num2-2, title+’\n’)
ReadFile.insert(num2-1, content+’\n’)

nfile = open(‘app/static/shared/shared_print.txt’, ‘w’)
nfile.writelines(ReadFile)
nfile.close()
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))

elif(ch_mode==2):
ofile = open(‘app/static/shared/shared_presell.txt’, ‘r’)
ReadFile = ofile.readlines()
ofile.close()

num2 = num * 2
del ReadFile[num2-1]
del ReadFile[num2-2]

ReadFile.insert(num2-2, title+’\n’)
ReadFile.insert(num2-1, content+’\n’)

nfile = open(‘app/static/shared/shared_presell.txt’, ‘w’)
nfile.writelines(ReadFile)
nfile.close()
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
except Exception as e:
return redirect(url_for(‘main.print_show’, ch_mode=ch_mode))
return

@main.route(‘/presell/write/’, methods=[‘GET’, ‘POST’])
@login_required
def presell_write(ch_mode):
core_time

未经允许不得转载:远程打印机维修网 » 南邮共享打印机

置顶文章