From 65986361245e6ee7b1a570c33f5dc39a4373210c Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 9 Sep 2021 14:44:46 +0800 Subject: [PATCH] fix error --- app/controllers/admin/register_api_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/register_api_controller.rb b/app/controllers/admin/register_api_controller.rb index 4ae52df..f01d7ce 100644 --- a/app/controllers/admin/register_api_controller.rb +++ b/app/controllers/admin/register_api_controller.rb @@ -29,7 +29,7 @@ class Admin::RegisterApiController < ApplicationController response["error"] = "SITE_ALREADY_REGISTERED" end if !site.nil? - p1 = fork {register_client_site(site.site_token) } + p1 = fork {register_client_site(site,site.site_token) } Process.detach(p1) end render :json => ((params[:success] == 'error') ? response.merge({'success'=>params[:success]}).to_json : response.to_json) @@ -65,8 +65,7 @@ class Admin::RegisterApiController < ApplicationController watch_list_save_flag = (params['user']!= 'rulingcom' && params['user'].to_s != '') user_name = params['user'] puts ['user_name',user_name] - site_anncs = SiteAnnc - .where(visible: true) + site_anncs = SiteAnnc.where(visible: true) .select{|v| v.send_all || v.recieve_sites.include?(site)}.collect do |v| if watch_list_save_flag watch_list = v.watch_list @@ -103,7 +102,10 @@ class Admin::RegisterApiController < ApplicationController render :json => ((params[:success] == 'error') ? response.merge(params).to_json : response.to_json) end - def register_client_site(store_token) + def register_client_site(site=nil,store_token) + if !site.nil? + send_confirmation_email(site.admin_email, site.confirmation_token, site.site_token) + end params_to_send = {'store_token' => store_token, "site_token" => params[:site_token]} uri = URI.parse("http://#{params[:site_domain]}/") http = Net::HTTP.new(uri.host,uri.port)