fix error

This commit is contained in:
邱博亞 2023-05-08 22:38:15 +08:00
parent e4ac28c1da
commit d5fe077a26
1 changed files with 9 additions and 3 deletions

View File

@ -113,14 +113,20 @@ class Admin::RegisterApiController < ApplicationController
request = Net::HTTP::Post.new("/store/confirmation") request = Net::HTTP::Post.new("/store/confirmation")
request.body = params_to_send.to_query request.body = params_to_send.to_query
begin begin
response = http.request(request) success_flag = false
if response.code == '200' begin
response = http.request(request)
success_flag = (response.code == '200')
rescue => e
end
if success_flag
return response return response
else else
response = Net::HTTP.post_form(URI("https://#{params[:site_domain]}/store/confirmation"),params_to_send) #if response.code == 301,use https to resend /store/confirmation response = Net::HTTP.post_form(URI("https://#{params[:site_domain]}/store/confirmation"),params_to_send) #if response.code == 301,use https to resend /store/confirmation
return response return response
end end
rescue rescue => e
puts ['e', e, e.backtrace]
params[:success] = 'error' params[:success] = 'error'
end end
end end