Commit 803caef7 by Aeolus

修改库存上报接口

parent da952b28
......@@ -113,11 +113,15 @@ def run_hatch_open():
rent_detail.is_take = 1
db.session.add(rent_detail)
# 查询到柜子中的物品 数量减一
sql = "update earphone_hatch set left_count = left_count - 1 where machine_no = '{}' and hatch_no='{}'".format(
machine_no, hatch_no)
db.session.execute(sql)
db.session.commit()
# 当数量小于等于1时,将柜子物品状态改为已售空
left_res = Hatch.query.filter(Hatch.hatch_no == hatch_no,
Hatch.machine_no == machine_no).first()
left_res.left_count = left_res.left_count - 1
# 当数量等于1时,将柜子物品状态改为已售空
if left_res.left_count == 0:
if left_res.left_count <= 0:
left_res.status = 2
# 执行语句
db.session.add(left_res)
......
......@@ -189,7 +189,6 @@ def wx_pay_callback():
rent_detail.content = i.content
rent_detail.summary = i.summary
db.session.add(rent_detail)
db.session.add(i)
total_fee += rent_detail.price
if total_fee != int(callback_data['total_fee']):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment