Merge branch 'foodcourt' of gitlab.com:code2lab/SXRestaurant into foodcourt

This commit is contained in:
Myat Zin Wai Maw
2020-02-18 17:22:32 +06:30
2 changed files with 21 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ class Api::ShopsController < Api::ApiController
skip_before_action :set_current_tenant_by_subdomain_or_name, only: [:index, :show]
def index
@shops = Shop.select('id, logo, name, shop_code').all
@shops = Shop.select('id, logo, name, shop_code').where.not(cloud_url: nil).all
end
def show
@@ -13,4 +13,23 @@ class Api::ShopsController < Api::ApiController
def get_tax_profiles
@inclusive_tax, @exclusive_tax = TaxProfile.calculate_tax("online_order")
end
def lookup_domain
if ["index", "show"].include? action_name
if ENV["SERVER_CODE"] == "cloud" && request.subdomains.last && request.subdomains.last != "www"
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
if (!@license.nil?)
logger.info "Location - " + @license.dbschema
ActiveRecord::Base.establish_connection(website_connection(@license))
else
logger.info 'License is nil'
not_found
end
elsif ENV["SERVER_MODE"] == "application" || (request.subdomains.last && request.subdomains.last != "www")
not_found unless check_license(request.host)
end
else
super
end
end
end

View File

@@ -132,9 +132,7 @@ class ActionController::API
# render :json => [{ status: false, message: 'Invalid Access!'}]
end
elsif ENV["SERVER_MODE"] == "application" || (request.subdomains.last && request.subdomains.last != "www")
unless check_license(request.host)
not_found
end
not_found unless check_license(request.host)
else
not_found
end