add multi deliver request

This commit is contained in:
thomaschen 2013-09-11 15:44:38 +08:00 committed by chris
parent 0a1ebf18e3
commit 883496ede1
2 changed files with 18 additions and 14 deletions

View File

@ -28,8 +28,12 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
end
##
send_request("http://localhost:4000", @ask_question, @ask_reply) if params[:ask_reply][:status] == '轉介其他單位'
binding.pry
params[:school][:depts].each do |dns|
send_request(dns, @ask_question, @ask_reply)
end unless params[:school].nil?
##
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end
@ -39,7 +43,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
require 'json'
uri_path = "/panel/ask/back_end/ask_requests/auth_request"
uri = URI.parse(dep_dns + uri_path)
uri = URI.parse("http://" + dep_dns + uri_path)
body = {
'auth_token' => '3kjlfksjDFJ'
@ -53,7 +57,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
if response.code == "200"
uri_path = "/panel/ask/back_end/ask_requests/transfer_request"
uri = URI.parse(dep_dns + uri_path)
uri = URI.parse("http://" + dep_dns + uri_path)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
body = {

View File

@ -39,17 +39,17 @@
</tr>
<tr>
<td colspan="5" class="dept_options">
<%= check_box("schoool", "depts", {:multiple => true}, "總務長室暨總務處秘書室", nil) %><%= label_tag(:dep1, "總務長室暨總務處秘書室") %>
<%= check_box("schoool", "depts", {:multiple => true}, "文書組", nil) %><%= label_tag(:dep2, "文書組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "保管組", nil) %><%= label_tag(:dep4, "保管組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "營繕組", nil) %><%= label_tag(:dep5, "營繕組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "出納組", nil) %><%= label_tag(:dep6, "出納組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "採購組", nil) %><%= label_tag(:dep7, "採購組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "經營管理組", nil) %><%= label_tag(:dep8, "經營管理組") %>
<%= check_box("schoool", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %>
<%= check_box("schoool", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %>
<%= check_box("schoool", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "localhost:3000", nil) %><%= label_tag(:dep1, "總務長室暨總務處秘書室") %>
<%= check_box("school", "depts", {:multiple => true}, "localhost:4000", nil) %><%= label_tag(:dep2, "文書組") %>
<%= check_box("school", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %>
<%= check_box("school", "depts", {:multiple => true}, "保管組", nil) %><%= label_tag(:dep4, "保管組") %>
<%= check_box("school", "depts", {:multiple => true}, "營繕組", nil) %><%= label_tag(:dep5, "營繕組") %>
<%= check_box("school", "depts", {:multiple => true}, "出納組", nil) %><%= label_tag(:dep6, "出納組") %>
<%= check_box("school", "depts", {:multiple => true}, "採購組", nil) %><%= label_tag(:dep7, "採購組") %>
<%= check_box("school", "depts", {:multiple => true}, "經營管理組", nil) %><%= label_tag(:dep8, "經營管理組") %>
<%= check_box("school", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %>
<%= check_box("school", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %>
<%= check_box("school", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %>
</td>
</tr>
<tr>