def tag_delete(): uid = request.get_json()['id'] t = Tag.is_exist(uid=uid) if t: u = Tag.query.filter_by(id=uid).first() u.delete() return NoException(msg='删除成功') else: return ParameterException(msg="查无此人", error_code=602)
def tag_upload(): # form = TagImageForm() # print(form) file = request.files.get('file') form = TagImageForm(data={'file': file}) if form.validate(): img = form.file.data file_name = uuid.uuid4().hex + '.' + img.filename.split('.')[-1] path = os.getcwd() + '\\app' + UPLOAD_PATH + '\\' + file_name img.save(path) t = Tag.is_exist(tag_id=1) if t: u = Tag.query.filter_by(id=1).first() u.update(icon_url=file_name) return NoException(msg="上传成功") else: return ParameterException(msg="查无此人", error_code=602) else: raise ParameterException()