Esempio n. 1
0
 def unlock(self):
     # 获取对应的值
     pid = request.params["pid"]
     sid = request.params["sid"]
     orderno = request.params["orderno"]
     # 获取目标对象
     play = Play.get(pid)
     # 判断是否存在
     if not play:
         return Code.play_does_not_exist, request.params
     # 获取目标对象
     order = Order.getby_orderno(orderno)
     # 判断是否存在
     if not order:
         return Code.order_does_not_exist, request.params
     # 解锁的座位数目
     unlock_seats_num = PlaySeat.unlock(orderno, pid, sid)
     # 判断解锁操作是否执行
     if not unlock_seats_num:
         return Code.seat_unlock_failed, {}
     # 修改状态
     order.status = OrderStatus.unlocked.value
     # 执行修改保存
     order.save()
     return {"unlock_seats_num": unlock_seats_num}
Esempio n. 2
0
 def unlock(self):
     pid = request.params['pid']
     sid = request.params['sid']
     orderno = request.params['orderno']
     order = Order.getby_orderno(orderno)
     if not order:
         return Code.order_does_not_exist
     if order.status != OrderStatus.locked.value:
         return Code.order_status_error
     unlock_seats_num = PlaySeat.unlock(orderno, pid, sid)
     if not unlock_seats_num:
         return Code.seat_unlock_failed
     order.status = OrderStatus.unlocked.value
     order.save()
     return {'unlocked_seats_num': unlock_seats_num}
Esempio n. 3
0
 def unlock(self):
     pid = request.params["pid"]
     sid = request.params["sid"]
     orderno = request.params["orderno"]
     order = Order.getby_orderno(orderno)
     if not order:
         return Code.order_does_not_exist, {'orderno': orderno}
     if order.status != OrderStatus.locked.value:
         return Code.order_status_error, {}
     unlocked_seats_num = PlaySeat.unlock(orderno, pid, sid)
     if not unlocked_seats_num:
         return Code.seat_unlock_failed, {}
     order.status = OrderStatus.unlocked.value
     order.save()
     return {'unlocked_seats_num': unlocked_seats_num}
Esempio n. 4
0
    def unlock(self):
        pid = request.params['pid']

        sid = request.params['sid']
        orderno = request.params['orderno']
        play = Play.get(pid)
        if not play:
            return Code.play_does_not_exist, request.params

        order = Order.getby_orderno(orderno)
        if not order:
            return Code.order_does_not_exist, request.params
        unlock_seats_num = PlaySeat.unlock(orderno, pid, sid)
        if not unlock_seats_num:
            return Code.seat_lock_failed, {}
        order.status = OrderStatus.unlocked.value
        order.save()
        return {'unlock_seats_num': unlock_seats_num}