本文整理汇总了Python中DoctorSpring.models.User.update方法的典型用法代码示例。如果您正苦于以下问题:Python User.update方法的具体用法?Python User.update怎么用?Python User.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoctorSpring.models.User
的用法示例。
在下文中一共展示了User.update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateAcountInfo
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def updateAcountInfo():
type=request.args.get('type')
if type:
type=string.atoi(type) #医生:1 病人:2
else:
type=2
userId=None
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
form=UserUpdateForm(request.form)
paraRs=form.validate()
if rs.SUCCESS.status==paraRs.status:
User.update(userId,form.name,form.account,form.mobile,form.address,form.email,form.identityCode,form.yibaoCard)
if type==1:
doctor=Doctor(userId)
doctor.identityPhone=form.identityPhone
hospitalId=Doctor.update(doctor)
if hospitalId:
hospital=Hospital(form.hospitalName)
hospital.id=hospitalId
Hospital.updateHospital(hospital)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例2: avatarfileUpload
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def avatarfileUpload():
userId=None
userId=request.form.get("userId")
if session.has_key('userId') and userId is None:
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
userId = string.atoi(userId)
user=User.getById(userId,None)
if user is None:
return json.dumps(rs.ResultStatus(rs.FAILURE.status,"账户不存在"),ensure_ascii=False )
try:
if request.method == 'POST':
file_infos = []
files = request.files
for key, file in files.iteritems():
if file and isPicture(file.filename):
filename = file.filename
# file_url = oss_util.uploadFile(diagnoseId, filename)
from DoctorSpring.util.oss_util import uploadAvatarFromFileStorage
fileurl = uploadAvatarFromFileStorage(userId, filename, file,'',{})
if fileurl:
user.imagePath=fileurl
User.update(userId,imagePath=fileurl)
file_infos.append(dict(
name=filename,
url=fileurl))
return jsonify(files=file_infos)
else:
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
except Exception,e:
print e.message
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例3: resetPasswd
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def resetPasswd(mobileNumber):
userId=str(int(User.get_id_by_phone(mobileNumber)[0]))
form=UserResetPasswdForm(request.form)
result=form.validate()
if result.status==rs.SUCCESS.status:
user = User.getById(userId)
newHashPasswd=generate_password_hash(form.newPasswd)
User.update(userId,passwd=newHashPasswd)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
示例4: checkVerifyCode
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def checkVerifyCode():
code=request.form.get('verifyCode')
mobile=request.form.get('mobile')
verifyCode=session.get('verifyCode')
userId=session.get('userId')
if verifyCode is None:
result=rs.ResultStatus(rs.FAILURE.status,"请重新产生验证码")
return json.dumps(result.__dict__,ensure_ascii=False)
if code is None:
result=rs.ResultStatus(rs.FAILURE.status,"验证码不能为空,请输入验证码")
return json.dumps(result.__dict__,ensure_ascii=False)
if code == verifyCode:
if mobile:
import re
#p = re.compile(r"((13|14|15|18)d{9}$)")
if len(mobile)==11:
user=User.update(userId,mobile=mobile,isBindPhone=constant.UserPhoneBind.Binded);
if user:
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"更新失败")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"输入的电话号码格式有问题")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"请输入电话号码")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"验证码错误,请重新输入验证码")
return json.dumps(result.__dict__,ensure_ascii=False)
示例5: updateDoctorInfo
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def updateDoctorInfo():
form=DoctorUpdateForm(request.form)
doctor=Doctor(form.userId)
doctor.departmentId=form.department
doctor.hospitalId=form.hospital
doctor.status=form.status
doctor.title=form.title
Doctor.update(doctor)
doctor=Doctor.getByUserId(form.userId)
if doctor:
for skill in form.skills:
doctorsKill=Doctor2Skill(doctor.id,skill)
Doctor2Skill.save(doctorsKill)
User.update(form.userId,status=constant.ModelStatus.Normal)
result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,None)
return json.dumps(result.__dict__,ensure_ascii=False)
示例6: changePasswd
# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import update [as 别名]
def changePasswd():
userId=None
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
form=UserChangePasswdForm(request.form)
result=form.validate()
if result.status==rs.SUCCESS.status:
user = User.getById(userId)
if user and user.check_password(form.oldPasswd):
newHashPasswd=generate_password_hash(form.newPasswd)
User.update(userId,passwd=newHashPasswd)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
resultStatus=rs.ResultStatus(rs.FAILURE.status,"未登录或者密码错误")
return json.dumps(resultStatus.__dict__,ensure_ascii=False)
return json.dumps(result.__dict__,ensure_ascii=False)