Exemple #1
0
	def POST(self):
		 #user hasn`t login 
	 	 if web.ctx.session.user_info is None:
			 raise web.seeother("/")
	 	 user_info = web.ctx.session.user_info

		 input = web.input(title=None, content=None)
	 	 
		 if input.title is not None or input.content is not None:
	 	 	 title = input.title
			 content = input.content

		 else:
			 return render.message_post(title=u"给物业留言", user_id=user_info["id"], message_code=-1)

	 	 try:
		 	 db.insert("message", content=content, title=title, poster=user_info["id"])
		 except Exception, e:
	 	 	 return render.message_post(title=u"给物业留言", user_id=user_info["id"], message_code=-2)
Exemple #2
0
	 def POST(self):
	 	 #user hasn`t login 
	 	 if web.ctx.session.user_info is None:
			 raise web.seeother("/")

		 user_info = web.ctx.session.user_info
		 input = web.input(address=None, tel=None, des=None)
	 	 
		 if input.tel is not None or input.address is not None or input.des is not None:
	 	 	 tel = input.tel
			 des = input.des
			 address = input.address
		 else:
			 return render.trouble_post(title=u"故障报修", user_id=user_info["user_id"], message_code=-1)

	 	 try:
		 	 db.insert("trouble", address=address, reporter=user_id, des=des, tel=tel)
		 except Exception, e:
	 	 	 return render.trouble_post(title=u"故障报修", user_id=user_id, message_code=-2)