def get(self): login_user = self.get_current_user() user = dao.get_user(login_user) transaction_type_dict = enums.TRANSACTION_TYPE_DICT if user.perm == enums.ACADEMY: status = 1 if user.perm == enums.BUSINESS: status = 2 if user.perm == enums.CLUSTER: status = 3 transaction_list = dao.get_transaction_list_by_user_status(status) result = [] for transaction in transaction_list: tmp = {} user = dao.get_user_by_user_id(transaction.user_id) tmp['id'] = str(transaction.id) tmp["user"] = user.username tmp["ttype"] = transaction.ttype tmp["title"] = transaction.title tmp["content"] = transaction.content result.append(tmp) transaction_list = result params = locals() params.pop("self") self.render("auth/review_list.html", **params)
def get(self): login_user = self.get_current_user() user = dao.get_user(login_user) sex_dict = enums.SEX_DICT params = locals() params.pop("self") self.render("auth/user_info.html", **params)
def get(self, action): if action == 'list': user = self.get_current_user() user_id = dao.get_user(user).oid transaction_list = dao.get_transaction_list_by_user_id(user_id) self.render('auth/transaction.html', transaction_list=transaction_list) elif action == 'add': self.render('auth/add_transaction.html')
def post(self): login_user = self.get_current_user() user = dao.get_user(login_user) mobile = self.get_argument("mobile", "") emergency_contact = self.get_argument("emergency_contact", "") dao.update_user_by_card_id(user.card_id, {"mobile": mobile, "emergency_contact": emergency_contact}) self.redirect("/member/")
def post(self): user = self.get_current_user() user = dao.get_user(user) mobile = self.get_argument('mobile') emergency_contact = self.get_argument('emergency_contact') dao.update_user_by_card_id(user.card_id, {'mobile': mobile, 'emergency_contact': emergency_contact}) self.redirect('/member/')
def post(self): username = self.get_argument("username", "") password = self.get_argument("password", "") user = dao.get_user(username) if not user or user.password != md5(password): self.write(json.dumps({"status": "fail"})) return self.set_secure_cookie("user", "888") self.write(json.dumps({"status": "ok"}))
def post(self): login_user = self.get_current_user() user = dao.get_user(login_user) mobile = self.get_argument("mobile", "") emergency_contact = self.get_argument("emergency_contact", "") dao.update_user_by_card_id(user.card_id, { "mobile": mobile, "emergency_contact": emergency_contact }) self.redirect("/member/")
def post(self): user = self.get_current_user() user = dao.get_user(user) mobile = self.get_argument('mobile') emergency_contact = self.get_argument('emergency_contact') dao.update_user_by_card_id(user.card_id, { 'mobile': mobile, 'emergency_contact': emergency_contact }) self.redirect('/member/')
def get(self, action): if action == "list": login_user = self.get_current_user() user_id = dao.get_user(login_user).oid transaction_list = dao.get_transaction_list_by_user_id(user_id) transaction_type_dict = enums.TRANSACTION_TYPE_DICT transaction_status_dict = enums.PROGRESS_DICT params = locals() params.pop("self") self.render("auth/transaction.html", **params) elif action == "add": self.render("auth/add_transaction.html")
def post(self): username = self.get_argument('username', '') password = self.get_argument('password', '') print username, password user = dao.get_user(username) if not user or user.password != md5(password): self.write(json.dumps({'status': 'fail'})) return self.set_cookie('user', '888') self.write(json.dumps({'status': 'ok'}))
def post(self): username = self.get_argument('username', '') password = self.get_argument('password', '') user = dao.get_user(username) err_msg = '' if not user or user.password != md5(password): err_msg = 'username does not match password' self.render('auth/login.html', err_msg=err_msg, username=username) return self.set_cookie('user', user.username) self.redirect('/')
def post(self): err_msg = "" username = self.get_argument("username", "") password = self.get_argument("password", "") admin_user = auth_dao.get_user(username) if not admin_user or admin_user.password != md5(password): err_msg = "user do not match password" self.render("admin/login.html", err_msg=err_msg, username=username) # 相对于templater_pat return self.set_secure_cookie("admin_user", admin_user.username) self.redirect("/admin/")
def post(self): card_id = self.get_argument("card_id", "") username = self.get_argument("username", "") password = self.get_argument("password", "") password1 = self.get_argument("password1", "") age = self.get_argument("age", "") sex = int(self.get_argument("sex", 1)) mobile = self.get_argument("mobile", "") emergency_contact = self.get_argument("emergency_contact", "") email = self.get_argument("email", "") department = self.get_argument("department", "") position = self.get_argument("position", "") perm = self.get_argument("perm", "") perm_list = auth_enums.ADMIN_USER_PERMISSION_LIST if not (username and password and sex and age and department and position and mobile and emergency_contact and email and perm): err_msg = "lack of arguments" params = locals() params.pop("self") self.render("admin/add_user.html", **params) return if password != password1: err_msg = "two times input password no match" params = locals() params.pop("self") self.render("admin/add_user.html", **params) return admin_user = auth_dao.get_user(username=username) if admin_user: err_msg = "user alreay exist" params = locals() params.pop("self") self.render("admin/add_user.html", **params) return auth_dao.add_user(username, password, age, sex, department, position, mobile, emergency_contact, email, perm=perm) self.redirect("/admin/user_list/")
def post(self): username = self.get_argument('username', '') password = self.get_argument('password', '') password1 = self.get_argument('password1', '') age = self.get_argument('age', '') sex = int(self.get_argument('sex', 0)) department = self.get_argument('department', '') position = self.get_argument('position', '') mobile = self.get_argument('mobile', '') emergency_contact = self.get_argument('emergency_contact', '') email = self.get_argument('email', '') perm = self.get_argument('perm', '') if not (username and password and password1 and age and sex and department and position and mobile and emergency_contact and email and perm): err_msg = 'lack of argument' params = locals() params.pop('self') self.render('admin/add_user.html', **params) return if password != password1: err_msg = 'password input do not match twice' params = locals() params.pop('self') self.render('admin/add_user.html', **params) return user = auth_dao.get_user(username=username) if user: err_msg = 'user already exist' params = locals() params.pop('self') self.render('auth/register.html', **params) return auth_dao.add_user(username, password, age, sex, department, position, mobile, emergency_contact, email, perm=perm) self.redirect('/admin/')
def get(self): login_user = self.get_current_user() user = auth_dao.get_user(login_user) if user.status != auth_enums.USER_STATUS_NORMAL: self.write("<h1>you account is checking!!!!</h1>") return perm = "" if user.perm == auth_enums.ACADEMY: perm = auth_enums.ACADEMY if user.perm == auth_enums.BUSINESS: perm = auth_enums.BUSINESS if user.perm == auth_enums.CLUSTER: perm = auth_enums.CLUSTER self.render("index.html", perm=perm)
def get(self): user = self.get_current_user() user = auth_dao.get_user(user) if user.status != auth_enums.USER_STATUS_NORMAL: self.write('your account is checking') return perm = '' if user.perm == auth_enums.ACADEMY: perm = auth_enums.ACADEMY if user.perm == auth_enums.BUSINESS: perm = auth_enums.BUSINESS if user.perm == auth_enums.CLUSTER: perm = auth_enums.CLUSTER self.render('index.html', perm=perm)
def post(self, action): if action == 'update': transaction_id = self.get_argument('transaction_id', '') title = self.get_argument('title', '') content = self.get_argument('content', '') status = 1 attr = {'title': title, 'content': content, 'status': status} dao.update_transaction_by_id(transaction_id, attr) self.write(json.dumps({'status': 'ok'})) else: user = self.get_current_user() user_id = dao.get_user(user).oid ttype = int(self.get_argument('ttype')) title = self.get_argument('title') content = self.get_argument('content') dao.add_transaction(user_id, ttype, title, content) self.redirect('/auth/transaction/list/')
def post(self, action): if action == "update": transaction_id = self.get_argument("transaction_id", "") title = self.get_argument("title", "") content = self.get_argument("content", "") status = enums.PROGRESS_CREATE attr = {"title": title, "content": content, "status": status} dao.update_transaction_by_id(transaction_id, attr) self.write({"status": "ok"}) else: login_user = self.get_current_user() user_id = dao.get_user(login_user).oid ttype = int(self.get_argument("ttype")) title = self.get_argument("title") content = self.get_argument("content") dao.add_transaction(user_id, ttype, title, content) self.redirect("/transaction/list/")
def post(self): err_msg = "" username = self.get_argument("username", "") password = self.get_argument("password", "") user = dao.get_user(username) if not user or user.password != md5(password): err_msg = "user do not match password" self.render("auth/login.html", err_msg=err_msg, username=username) # 相对于templater_pat return if user.status == enums.USER_STATUS_CHECK: self.write("<h1>your acount is checking!!</h1>") return self.set_secure_cookie("user", user.username) self.redirect("/")
def post(self): username = self.get_argument('username', '') password = self.get_argument('password', '') password1 = self.get_argument('password1', '') age = self.get_argument('age', '') sex = int(self.get_argument('sex', 0)) department = self.get_argument('department', '') position = self.get_argument('position', '') mobile = self.get_argument('mobile', '') emergency_contact = self.get_argument('emergency_contact', '') email = self.get_argument('email', '') print email if not (username and password and password1 and age and sex and department and position and mobile and emergency_contact and email): err_msg = 'lack of argument' params = locals() params.pop('self') self.render('auth/register.html', **params) return if password != password1: err_msg = 'password input do not match twice' params = locals() params.pop('self') self.render('auth/register.html', **params) return user = dao.get_user(username=username) if user: err_msg = 'user already exist' params = locals() params.pop('self') self.render('auth/register.html', **params) return print '8888' dao.add_user(username, password, age, sex, department, position, mobile, emergency_contact, email) self.redirect('/login/')
def post(self): card_id = self.get_argument("card_id", "") username = self.get_argument("username", "") password = self.get_argument("password", "") password1 = self.get_argument("password1", "") age = self.get_argument("age", "") sex = int(self.get_argument("sex", 1)) mobile = self.get_argument("mobile", "") emergency_contact = self.get_argument("emergency_contact", "") email = self.get_argument("email", "") department = self.get_argument("department", "") position = self.get_argument("position", "") if not (username and password and sex and age and department and position and mobile and emergency_contact and email): err_msg = "lack of arguments" params = locals() params.pop("self") self.render("auth/register.html", **params) return if password != password1: err_msg = "two times input password no match" params = locals() params.pop("self") self.render("auth/register.html", **params) return user = dao.get_user(username=username) if user: err_msg = "user alreay exist" params = locals() params.pop("self") self.render("auth/register.html", **params) return dao.add_user(username, password, age, sex, department, position, mobile, emergency_contact, email) self.redirect("/login/")
def get(self): user = self.get_current_user() user = dao.get_user(user) user_id = user.oid print 'name:', user.to_json() print 'perm:', user.perm if user.perm == enums.ACADEMY: status = 1 if user.perm == enums.BUSINESS: status = 2 if user.perm == enums.CLUSTER: status = 3 transaction_list = dao.get_transaction_list_by_status(status) result = [] for transaction in transaction_list: tmp = {} user = dao.get_user_by_user_id(transaction.user_id) tmp['id'] = str(transaction.id) tmp['user'] = user.username tmp['ttype'] = transaction.ttype tmp['title'] = transaction.title tmp['content'] = transaction.content result.append(tmp) self.render('auth/review_list.html', transaction_list=result)
def get(self): user = self.get_current_user() print user user = dao.get_user(user) self.render('auth/user_info.html', user=user)