check api issue
This commit is contained in:
@@ -178,10 +178,9 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
Rails.logger.debug "Doemal URL" + base_url
|
||||
post_url = base_url + url
|
||||
|
||||
if !waiting_time.nil? && !min_type.nil? && reason.nil?
|
||||
if waiting_time != ""
|
||||
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
|
||||
elsif !reason.nil?
|
||||
elsif reason != ""
|
||||
send_params = {id: ref_no, status: status, reason: reason}
|
||||
else
|
||||
send_params = {id: ref_no, status: status}
|
||||
@@ -290,28 +289,46 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.check_new_order
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='new'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_send_to_kitchen
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_ready_to_delivery
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user