Beispiel #1
0
def create_client():
	form = ClientValidator().validate_for_api()  # 参数校验,直接在此抛出异常,并中指代码
	promise = {
		ClientTypeEnum.USER_EMAIL: __register_user_by_email
	}
	promise[form.type.data]()
	return RenewSuccess()
Beispiel #2
0
def renew_address():
	address_info = AddressNew().validate_for_api().data
	uid = g.user.uid
	with db.auto_check_empty(UserException):
		user = User.query.filter_by(id=uid).first_or_404()
	user.save_address(address_info)
	return RenewSuccess()
Beispiel #3
0
def upload_file():
	'''文件上传'''
	form = UploadPDFValidator().validate_for_api()
	origin_file = request.files[form.origin.name]
	origin_file.save(os.path.join(current_app.config['UPLOAD_FOLDER'], origin_file.filename))
	comparer_file = request.files[form.comparer.name]
	comparer_file.save(os.path.join(current_app.config['UPLOAD_FOLDER'], comparer_file.filename))

	return RenewSuccess()
Beispiel #4
0
def update_user():
    return RenewSuccess()