def update_msg(): id = request.form.get('id') username = request.form.get('username') password = request.form.get('password') sex = request.form.get('sex') age = request.form.get('age') phone = request.form.get('phone') email = request.form.get('email') role = request.form.get('role') tup = (password, int(sex), int(age), int(phone), email, int(role), int(id)) print tup p = utils.update_db(tup) #user_list=['password','sex','agr','phone','email','role'] if p == 0: user_tup = utils.select_user(username) return render_template('user_show.html', user=user_tup)
def manager(): if request.method == "POST": username = request.form.get('user') password = request.form.get('pwd') print username, password d = utils.login(username, password) res = {'code': 0, 'msg': ''} print d if d == '1': res['code'] = 1 res['msg'] = 'user or password is error' return render_template('login.html', res=res) elif d == '0': return redirect("/admin/") else: admin = "user" user_tup = utils.select_user(username) return render_template('user_show.html', admin=admin, user=user_tup)
import json import re import sys from csu.apis import sso_redirect_with_channel, web_page_login from utils import select_user, get_sys_name_from_login_url session = web_page_login(select_user(sys.argv[1])) session = sso_redirect_with_channel(session, get_sys_name_from_login_url("http://ca.its.csu.edu.cn/Home/Login/215")) main_page = session.get("https://wxxy.csu.edu.cn/ncov/wap/default/index?from=history").text info = json.loads(re.search(r'var\sdef\s=(.*);', main_page).group(1).strip()) address_info = json.loads(info['geo_api_info'])['addressComponent'] info['szgj'] = address_info['country'] info['szcs'] = address_info['city'] info['szgjcs'] = "{} {}".format(address_info['country'], address_info['city']) info['area'] = "{} {} {}".format(address_info['province'], address_info['city'], address_info['district']) res = json.loads(session.post("https://wxxy.csu.edu.cn/ncov/wap/default/save", data=info).text) print("打卡结果:{},上次打卡地点:{}".format(res['m'], json.loads(info['geo_api_info'])['formattedAddress']))
global session while True: # zndxyjzfuzx 返校系统 try: print("-------") print("0:退出,1: 查询用户基本信息,2:登录,3:查询用户信息(需登录),4:扫码登录,5:就业信息, 6: 就业信息plus,7:登录三方系统") command = input() if command == "0": exit(0) if command == "1": for user in find_user(input("输入姓名:")): print(user) if command == "2": session = web_page_login(select_user()) session = sso_redirect_with_channel(session, "xsgzxt") cookie_str = "" for k, v in session.cookies.items(): cookie_str += "{}={}; ".format(k, v) print(cookie_str) if command == "3": print(session.post("http://202.197.71.125/a/workstudy/gXQZ0202/query_student", { "value": select_user() }).text) if command == "4": user_id = select_user() token_id = input("输入token id:") scan_qr_code_login(token_id, user_id)