def image_upload(): """ 'callbackBody':'filename=$(fname)&filesize=$(fsize)' """ filename = request.values.get('filename', '') param = request.values.get('param', '') if filename == '': return jsonify({'code': '0'}) url = qiniu_setting['bucket_domain'] + filename item = g.Item.query.filter_by(name=filename).first() if item: return jsonify({'code': '-2'}) item = g.Item(name=filename, url=url, param=param) g.db.session.add(item) g.db.session.commit() return jsonify({ 'code': '1', 'filename': filename, 'url': url, 'param': param, })
def postItem(args): db = get_db() item = g.Item(name=args['name']) item.sell_in = args['sell_in'] item.quality = args['quality'] item.save()