add option for dep_dns
This commit is contained in:
parent
24b9f4015b
commit
3f9cdec426
|
@ -28,17 +28,18 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||||
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
|
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
|
||||||
end
|
end
|
||||||
##
|
##
|
||||||
send_request(@ask_question, @ask_reply) if params[:ask_reply][:status] == '轉介其他單位'
|
send_request("http://localhost:4000", @ask_question, @ask_reply) if params[:ask_reply][:status] == '轉介其他單位'
|
||||||
##
|
##
|
||||||
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
|
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_request(current_question, current_reply)
|
def send_request(dep_dns, current_question, current_reply)
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
uri = URI.parse("http://localhost:4000/panel/ask/back_end/ask_requests/auth_request")
|
uri_path = "/panel/ask/back_end/ask_requests/auth_request"
|
||||||
|
uri = URI.parse(dep_dns + uri_path)
|
||||||
|
|
||||||
body = {
|
body = {
|
||||||
'auth_token' => '3kjlfksjDFJ'
|
'auth_token' => '3kjlfksjDFJ'
|
||||||
|
@ -51,7 +52,8 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||||
puts "Response #{response.code} #{response.message}: #{response.body}"
|
puts "Response #{response.code} #{response.message}: #{response.body}"
|
||||||
|
|
||||||
if response.code == "200"
|
if response.code == "200"
|
||||||
uri = URI.parse("http://localhost:4000/panel/ask/back_end/ask_requests/transfer_request")
|
uri_path = "/panel/ask/back_end/ask_requests/transfer_request"
|
||||||
|
uri = URI.parse(dep_dns + uri_path)
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
request = Net::HTTP::Post.new(uri.request_uri)
|
request = Net::HTTP::Post.new(uri.request_uri)
|
||||||
body = {
|
body = {
|
||||||
|
|
Loading…
Reference in New Issue