def post(self, sid): result = {'status': False, 'msg': 0} captcha = self.get_cookie("captcha") user = self.get_current_user() if captcha and user: content = self.get_argument("content", None) vcode = self.get_argument("vcode", None) if content and vcode and len(vcode) == 4: if vcode == captcha: consult = Consult() consult.uid = user.id consult.sid = sid consult.mobile = user.mobile consult.content = content try: consult.save() result['status'] = True result['msg'] = 200 except Exception, ex: logging.error(ex) result['msg'] = 500 else: result['msg'] = 401 else: result['msg'] = 400
def post(self, sid): result = {'status' : False, 'msg' : 0} captcha = self.get_cookie("captcha") user = self.get_current_user() if captcha and user: content = self.get_argument("content", None) vcode = self.get_argument("vcode", None) if content and vcode and len(vcode) == 4: if vcode == captcha: consult = Consult() consult.uid = user.id consult.sid = sid consult.mobile = user.mobile consult.content = content try: consult.save() result['status'] = True result['msg'] = 200 except Exception, ex: logging.error(ex) result['msg'] = 500 else: result['msg'] = 401 else: result['msg'] = 400