def getMobileVerifyCode(): try: from DoctorSpring.util import verify_code, sms_utils verifyCode = verify_code.generatorVerifyCode() LOG.info("产生验证码") session['verifyCode'] = verifyCode telPhoneNo = None userId = session.get('userId') diagnoseId = request.args.get('diagnoseId') diagnose = Diagnose.getDiagnoseById(diagnoseId) if diagnose and hasattr(diagnose, 'patient') and diagnose.patient: telPhoneNo = diagnose.patient.identityPhone if telPhoneNo is None and hasattr( diagnose.patient, 'user') and diagnose.patient.user: telPhoneNo = diagnose.patient.user.phone if telPhoneNo is None: user = User.getById(userId) telPhoneNo = user.phone if telPhoneNo: smsRc = sms_utils.RandCode() template_param = {'param1': verifyCode} smsRc.send_emp_sms(telPhoneNo, smsRc.TEMPLATE_ID_1, json.dumps(template_param)) return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False) else: LOG.error("诊断[%s]发送验证码错误" % diagnoseId) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False) except Exception, e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
def getMobileVerifyCode(): try: from DoctorSpring.util import verify_code,sms_utils verifyCode= verify_code.generatorVerifyCode() LOG.info("产生验证码") session['verifyCode']=verifyCode telPhoneNo=None userId=session.get('userId') diagnoseId=request.args.get('diagnoseId') diagnose=Diagnose.getDiagnoseById(diagnoseId) if diagnose and hasattr(diagnose,'patient') and diagnose.patient: telPhoneNo=diagnose.patient.identityPhone if telPhoneNo is None and hasattr(diagnose.patient,'user') and diagnose.patient.user: telPhoneNo=diagnose.patient.user.phone if telPhoneNo is None: user=User.getById(userId) telPhoneNo=user.phone if telPhoneNo: smsRc=sms_utils.RandCode() template_param = {'param1':verifyCode} smsRc.send_emp_sms(telPhoneNo,smsRc.TEMPLATE_ID_1,json.dumps(template_param)) return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False) else: LOG.error("诊断[%s]发送验证码错误"%diagnoseId) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False) except Exception,e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
def getMobileVerifyCodePwd(phoneNumber=None): from DoctorSpring.util import verify_code,sms_utils telPhoneNo=str(phoneNumber) verifyCode= verify_code.generatorVerifyCode() LOG.info("产生验证码 to " + phoneNumber) #LOG.info(type(str(phoneNumber))) session['verifyCode']=verifyCode smsRc=sms_utils.RandCode() template_param = {'param1':verifyCode} smsRc.send_emp_sms(telPhoneNo,smsRc.TEMPLATE_ID_1,json.dumps(template_param)) return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
def getMobileVerifyCodePwd(phoneNumber=None): from DoctorSpring.util import verify_code, sms_utils telPhoneNo = str(phoneNumber) verifyCode = verify_code.generatorVerifyCode() LOG.info("产生验证码 to " + phoneNumber) #LOG.info(type(str(phoneNumber))) session['verifyCode'] = verifyCode smsRc = sms_utils.RandCode() template_param = {'param1': verifyCode} smsRc.send_emp_sms(telPhoneNo, smsRc.TEMPLATE_ID_1, json.dumps(template_param)) return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)