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

@ -112,15 +112,21 @@ class Admin::RegisterApiController < ApplicationController
http = Net::HTTP.new(uri.host,uri.port) http = Net::HTTP.new(uri.host,uri.port)
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
success_flag = false
begin begin
response = http.request(request) response = http.request(request)
if response.code == '200' 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