From 3f9cdec426e46305a160ec59a161e33e1c3b44cc Mon Sep 17 00:00:00 2001 From: thomaschen <99703040@nccu.edu.tw> Date: Wed, 11 Sep 2013 13:55:13 +0800 Subject: [PATCH] add option for dep_dns --- .../panel/ask/back_end/ask_replies_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vendor/built_in_modules/ask_new/app/controllers/panel/ask/back_end/ask_replies_controller.rb b/vendor/built_in_modules/ask_new/app/controllers/panel/ask/back_end/ask_replies_controller.rb index 8b1b66db8..41d2900a9 100644 --- a/vendor/built_in_modules/ask_new/app/controllers/panel/ask/back_end/ask_replies_controller.rb +++ b/vendor/built_in_modules/ask_new/app/controllers/panel/ask/back_end/ask_replies_controller.rb @@ -28,17 +28,18 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id) 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') end - def send_request(current_question, current_reply) + def send_request(dep_dns, current_question, current_reply) require 'net/http' require 'uri' 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 = { 'auth_token' => '3kjlfksjDFJ' @@ -51,7 +52,8 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController puts "Response #{response.code} #{response.message}: #{response.body}" 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) request = Net::HTTP::Post.new(uri.request_uri) body = {