def profile(): data = { 'sub': session['sub'], 'phone': request.form.get('phone'), 'email': request.form.get('email'), 'intro': request.form.get('intro'), } userModel = User().load(data) res, msg = userModel.check_arrt() if not res: res = my_json_res(CODE.ERROR, {}, msg) else: userModel.update_profile() res = my_json_res(CODE.SUCCESS, {}, '更改个人信息成功') return Response(res, content_type='application/json')
def update_profile(): data = { 'sub': request.form.get('sub'), 'phone': request.form.get('phone'), 'email': request.form.get('email'), } user = User().load(data) res, msg = user.check_arrt() if not res: return Response(my_json_res(CODE.ERROR, {}, msg), content_type='application/json') if not user.update_profile(): return Response(my_json_res(CODE.ERROR, {}, '更改信息失败'), content_type='application/json') return Response(my_json_res(CODE.SUCCESS, {}, '更改信息成功'), content_type='application/json')