31 lines
925 B
Ruby
31 lines
925 B
Ruby
class Api::SoundEffectController < Api::ApiController
|
|
|
|
#sound effect / alarm api for doemal side calling
|
|
def sound_effect
|
|
shop = Shop.find_by_id(1)
|
|
if !shop.nil?
|
|
shop_code = shop.shop_code
|
|
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")
|
|
if !order_audio.nil?
|
|
audio = order_audio.image
|
|
end
|
|
else
|
|
shop_code = nil
|
|
audio = nil
|
|
end
|
|
|
|
if !shop_code.nil? && !audio.nil?
|
|
if ENV["SERVER_MODE"] == 'cloud'
|
|
from = request.subdomain + "." + request.domain
|
|
else
|
|
from = ""
|
|
end
|
|
ActionCable.server.broadcast "sound_effect_channel",data: {status: params[:status], message: params[:message]},shop_code: shop_code,from:from,audio:audio
|
|
else
|
|
render :json => { :status => true, :message => "Something wrongs!" }
|
|
end
|
|
end
|
|
#sound effect / alarm api for doemal side calling
|
|
|
|
end
|